-/* taken from arch/ppc/kernel/ppc-stub.c */
+/* taken from arch/powerpc/kernel/ppc-stub.c */
/****************************************************************************
****************************************************************************/
#include <common.h>
+#include <asm/ptrace.h>
#include <kgdb.h>
#include <command.h>
static char remcomRegBuffer[BUFMAX];
static int initialized = 0;
-static int kgdb_active = 0, first_entry = 1;
+static int kgdb_active;
static struct pt_regs entry_regs;
static long error_jmp_buf[BUFMAX/2];
static int longjmp_on_fault = 0;
return (0);
}
- /* probably should check which exception occured as well */
+ /* probably should check which exception occurred as well */
if (longjmp_on_fault) {
longjmp_on_fault = 0;
kgdb_longjmp(error_jmp_buf, KGDBERR_MEMFAULT);
kgdb_enter(regs, &kd);
- if (first_entry) {
- /*
- * the first time we enter kgdb, we save the processor
- * state so that we can return to the monitor if the
- * remote end quits gdb (or at least, tells us to quit
- * with the 'k' packet)
- */
- entry_regs = *regs;
- first_entry = 0;
- }
+ entry_regs = *regs;
ptr = remcomOutBuffer;
case 'k': /* kill the program, actually return to monitor */
kd.extype = KGDBEXIT_KILL;
*regs = entry_regs;
- first_entry = 1;
goto doexit;
case 'C': /* CSS continue with signal SS */
* kgdb_init must be called *after* the
* monitor is relocated into ram
*/
-void
-kgdb_init(void)
+int kgdb_init(void)
{
+ puts("KGDB: ");
+
kgdb_serial_init();
debugger_exception_handler = handle_exception;
initialized = 1;
putDebugStr("kgdb ready\n");
puts("ready\n");
+
+ return 0;
}
void
}
int
-do_kgdb(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+do_kgdb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
printf("Entering KGDB mode via exception handler...\n\n");
kgdb_breakpoint(argc - 1, argv + 1);