// SPDX-License-Identifier: GPL-2.0-or-later /* * Nios2 KGDB support * * Copyright (C) 2015 Altera Corporation * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> * * Based on the code posted by Kazuyasu on the Altera Forum at: * http://www.alteraforum.com/forum/showpost.php?p=77003&postcount=20
*/ #include <linux/ptrace.h> #include <linux/kgdb.h> #include <linux/kdebug.h> #include <linux/io.h>
int kgdb_arch_handle_exception(int vector, int signo, int err_code, char *remcom_in_buffer, char *remcom_out_buffer, struct pt_regs *regs)
{ char *ptr; unsignedlong addr;
switch (remcom_in_buffer[0]) { case's': case'c': /* handle the optional parameters */
ptr = &remcom_in_buffer[1]; if (kgdb_hex2long(&ptr, &addr))
regs->ea = addr;
return 0;
}
return -1; /* this means that we do not want to exit from the handler */
}
asmlinkage void kgdb_breakpoint_c(struct pt_regs *regs)
{ /* * The breakpoint entry code has moved the PC on by 4 bytes, so we must * move it back. This could be done on the host but we do it here
*/ if (!wait_for_remote_debugger)
regs->ea -= 4; else/* pass the first trap 30 code */
wait_for_remote_debugger = 0;
kgdb_handle_exception(30, SIGTRAP, 0, regs);
}
int kgdb_arch_init(void)
{
wait_for_remote_debugger = 1; return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.