Commit ab6e570b authored by Paul Mundt's avatar Paul Mundt
Browse files

sh: Generic kgdb stub support.



This migrates from the old bitrotted kgdb stub implementation and moves
to the generic stub. In the process support for SH-2/SH-2A is also added,
which the old stub never provided.

Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent d7b01f78
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ config SUPERH32
	select HAVE_FUNCTION_TRACER
	select HAVE_FTRACE_MCOUNT_RECORD
	select HAVE_DYNAMIC_FTRACE
	select HAVE_ARCH_KGDB

config SUPERH64
	def_bool y if CPU_SH5
+0 −69
Original line number Diff line number Diff line
@@ -98,19 +98,6 @@ config IRQSTACKS
	  for handling hard and soft interrupts.  This can help avoid
	  overflowing the process kernel stacks.

config SH_KGDB
	bool "Include KGDB kernel debugger"
	select FRAME_POINTER
	select DEBUG_INFO
	depends on CPU_SH3 || CPU_SH4
	help
	  Include in-kernel hooks for kgdb, the Linux kernel source level
	  debugger.  See <http://kgdb.sourceforge.net/> for more information.
	  Unless you are intending to debug the kernel, say N here.

menu "KGDB configuration options"
	depends on SH_KGDB

config MORE_COMPILE_OPTIONS
	bool "Add any additional compile options"
	help
@@ -122,62 +109,6 @@ config COMPILE_OPTIONS
	string "Additional compile arguments"
	depends on MORE_COMPILE_OPTIONS

config KGDB_NMI
	def_bool n
	prompt "Enter KGDB on NMI"

config SH_KGDB_CONSOLE
	def_bool n
	prompt "Console messages through GDB"
	depends on !SERIAL_SH_SCI_CONSOLE && SERIAL_SH_SCI=y
	select SERIAL_CORE_CONSOLE

config KGDB_SYSRQ
	def_bool y
	prompt "Allow SysRq 'G' to enter KGDB"
	depends on MAGIC_SYSRQ

comment "Serial port setup"

config KGDB_DEFPORT
	int "Port number (ttySCn)"
	default "1"

config KGDB_DEFBAUD
	int "Baud rate"
	default "115200"

choice
	prompt "Parity"
	depends on SH_KGDB
	default KGDB_DEFPARITY_N

config KGDB_DEFPARITY_N
	bool "None"

config KGDB_DEFPARITY_E
	bool "Even"

config KGDB_DEFPARITY_O
	bool "Odd"

endchoice

choice
	prompt "Data bits"
	depends on SH_KGDB
	default KGDB_DEFBITS_8

config KGDB_DEFBITS_8
	bool "8"

config KGDB_DEFBITS_7
	bool "7"

endchoice

endmenu

if SUPERH64

config SH64_SR_WATCH
+19 −47
Original line number Diff line number Diff line
/*
 * May be copied or modified under the terms of the GNU General Public
 * License.  See linux/COPYING for more information.
 *
 * Based on original code by Glenn Engel, Jim Kingdon,
 * David Grothe <dave@gcom.com>, Tigran Aivazian, <tigran@sco.com> and
 * Amit S. Kale <akale@veritas.com>
 * 
 * Super-H port based on sh-stub.c (Ben Lee and Steve Chamberlain) by
 * Henry Bell <henry.bell@st.com>
 * 
 * Header file for low-level support for remote debug using GDB. 
 *
 */

#ifndef __KGDB_H
#define __KGDB_H
#ifndef __ASM_SH_KGDB_H
#define __ASM_SH_KGDB_H

#include <asm/cacheflush.h>
#include <asm/ptrace.h>

/* Same as pt_regs but has vbr in place of syscall_nr */
@@ -30,40 +16,26 @@ struct kgdb_regs {
        unsigned long vbr;
};

/* State info */
extern char kgdb_in_gdb_mode;
extern int kgdb_nofault;	/* Ignore bus errors (in gdb mem access) */
extern char in_nmi;		/* Debounce flag to prevent NMI reentry*/
enum regnames {
	GDB_R0, GDB_R1, GDB_R2, GDB_R3, GDB_R4, GDB_R5, GDB_R6, GDB_R7,
	GDB_R8, GDB_R9, GDB_R10, GDB_R11, GDB_R12, GDB_R13, GDB_R14, GDB_R15,

/* SCI */
extern int kgdb_portnum;
extern int kgdb_baud;
extern char kgdb_parity;
extern char kgdb_bits;
	GDB_PC, GDB_PR, GDB_SR, GDB_GBR, GDB_MACH, GDB_MACL, GDB_VBR,
};

/* Init and interface stuff */
extern int kgdb_init(void);
extern int (*kgdb_getchar)(void);
extern void (*kgdb_putchar)(int);
#define NUMREGBYTES    ((GDB_VBR + 1) * 4)

/* Trap functions */
typedef void (kgdb_debug_hook_t)(struct pt_regs *regs);
typedef void (kgdb_bus_error_hook_t)(void);
extern kgdb_debug_hook_t  *kgdb_debug_hook;
extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
static inline void arch_kgdb_breakpoint(void)
{
	__asm__ __volatile__ ("trapa #0x3c\n");
}

/* Console */
struct console;
void kgdb_console_write(struct console *co, const char *s, unsigned count);
extern int kgdb_console_setup(struct console *, char *);
/* State info */
extern char in_nmi;		/* Debounce flag to prevent NMI reentry*/

/* Prototypes for jmp fns */
#define _JBLEN 9
typedef        int jmp_buf[_JBLEN];
extern void    longjmp(jmp_buf __jmpb, int __retval);
extern int     setjmp(jmp_buf __jmpb);
#define BUFMAX                 2048

/* Forced breakpoint */
#define breakpoint()	__asm__ __volatile__("trapa   #0x3c")
#define CACHE_FLUSH_IS_SAFE	1
#define BREAK_INSTR_SIZE	2

#endif
#endif /* __ASM_SH_KGDB_H */
+2 −0
Original line number Diff line number Diff line
@@ -175,6 +175,8 @@ asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
BUILD_TRAP_HANDLER(address_error);
BUILD_TRAP_HANDLER(debug);
BUILD_TRAP_HANDLER(bug);
BUILD_TRAP_HANDLER(breakpoint);
BUILD_TRAP_HANDLER(singlestep);
BUILD_TRAP_HANDLER(fpu_error);
BUILD_TRAP_HANDLER(fpu_state_restore);

+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ obj-$(CONFIG_VSYSCALL) += vsyscall/
obj-$(CONFIG_SMP)		+= smp.o
obj-$(CONFIG_CF_ENABLER)	+= cf-enabler.o
obj-$(CONFIG_SH_STANDARD_BIOS)	+= sh_bios.o
obj-$(CONFIG_SH_KGDB)		+= kgdb_stub.o kgdb_jmp.o
obj-$(CONFIG_KGDB)		+= kgdb.o
obj-$(CONFIG_SH_CPU_FREQ)	+= cpufreq.o
obj-$(CONFIG_MODULES)		+= sh_ksyms_32.o module.o
obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
Loading