int kgdb_arch_handle_exception(int exception_vector, int signo, int err_code, char *remcom_in_buffer, char *remcom_out_buffer, struct pt_regs *linux_regs)
{ unsignedlong addr; char *ptr;
switch (remcom_in_buffer[0]) { case'D': case'k': case'c': /* * Try to read optional parameter, pc unchanged if no parm. * If this was a compiled breakpoint, we need to move * to the next instruction or we will just breakpoint * over and over again.
*/
ptr = &remcom_in_buffer[1]; if (kgdb_hex2long(&ptr, &addr))
linux_regs->ARM_pc = addr; elseif (compiled_break == 1)
linux_regs->ARM_pc += 4;
/** * kgdb_arch_init - Perform any architecture specific initalization. * * This function will handle the initalization of any architecture * specific callbacks.
*/ int kgdb_arch_init(void)
{ int ret = register_die_notifier(&kgdb_notifier);
/** * kgdb_arch_exit - Perform any architecture specific uninitalization. * * This function will handle the uninitalization of any architecture * specific callbacks, for dynamic registration and unregistration.
*/ void kgdb_arch_exit(void)
{
unregister_undef_hook(&kgdb_brkpt_arm_hook);
unregister_undef_hook(&kgdb_brkpt_thumb_hook);
unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook);
unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook);
unregister_die_notifier(&kgdb_notifier);
}
int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt)
{ int err;
/* patch_text() only supports int-sized breakpoints */
BUILD_BUG_ON(sizeof(int) != BREAK_INSTR_SIZE);
err = copy_from_kernel_nofault(bpt->saved_instr, (char *)bpt->bpt_addr,
BREAK_INSTR_SIZE); if (err) return err;
/* Machine is already stopped, so we can use __patch_text() directly */
__patch_text((void *)bpt->bpt_addr,
*(unsignedint *)arch_kgdb_ops.gdb_bpt_instr);
return err;
}
int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt)
{ /* Machine is already stopped, so we can use __patch_text() directly */
__patch_text((void *)bpt->bpt_addr, *(unsignedint *)bpt->saved_instr);
return 0;
}
/* * Register our undef instruction hooks with ARM undef core. * We register a hook specifically looking for the KGB break inst * and we handle the normal undef case within the do_undefinstr * handler.
*/ conststruct kgdb_arch arch_kgdb_ops = { #ifndef __ARMEB__
.gdb_bpt_instr = {0xfe, 0xde, 0xff, 0xe7} #else/* ! __ARMEB__ */
.gdb_bpt_instr = {0xe7, 0xff, 0xde, 0xfe} #endif
};
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.