/* * This provides the callbacks and functions that KGDB needs to share between * the core, I/O and arch-specific portions. * * Author: Amit Kale <amitkale@linsyssoft.com> and * Tom Rini <trini@kernel.crashing.org> * * 2001-2004 (c) Amit S. Kale and 2003-2005 (c) MontaVista Software, Inc. * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied.
*/ #ifndef _KGDB_H_ #define _KGDB_H_
/** * kgdb_skipexception - (optional) exit kgdb_handle_exception early * @exception: Exception vector number * @regs: Current &struct pt_regs. * * On some architectures it is required to skip a breakpoint * exception when it occurs after a breakpoint has been removed. * This can be implemented in the architecture specific portion of kgdb.
*/ externint kgdb_skipexception(int exception, struct pt_regs *regs);
/** * kgdb_breakpoint - compiled in breakpoint * * This will be implemented as a static inline per architecture. This * function is called by the kgdb core to execute an architecture * specific trap to cause kgdb to enter the exception processing. *
*/ void kgdb_breakpoint(void);
/* * Functions each KGDB-supporting architecture must provide:
*/
/** * kgdb_arch_init - Perform any architecture specific initialization. * * This function will handle the initialization of any architecture * specific callbacks.
*/ externint kgdb_arch_init(void);
/** * kgdb_arch_exit - Perform any architecture specific uninitalization. * * This function will handle the uninitalization of any architecture * specific callbacks, for dynamic registration and unregistration.
*/ externvoid kgdb_arch_exit(void);
/** * pt_regs_to_gdb_regs - Convert ptrace regs to GDB regs * @gdb_regs: A pointer to hold the registers in the order GDB wants. * @regs: The &struct pt_regs of the current process. * * Convert the pt_regs in @regs into the format for registers that * GDB expects, stored in @gdb_regs.
*/ externvoid pt_regs_to_gdb_regs(unsignedlong *gdb_regs, struct pt_regs *regs);
/** * sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs * @gdb_regs: A pointer to hold the registers in the order GDB wants. * @p: The &struct task_struct of the desired process. * * Convert the register values of the sleeping process in @p to * the format that GDB expects. * This function is called when kgdb does not have access to the * &struct pt_regs and therefore it should fill the gdb registers * @gdb_regs with what has been saved in &struct thread_struct * thread field during switch_to.
*/ externvoid
sleeping_thread_to_gdb_regs(unsignedlong *gdb_regs, struct task_struct *p);
/** * gdb_regs_to_pt_regs - Convert GDB regs to ptrace regs. * @gdb_regs: A pointer to hold the registers we've received from GDB. * @regs: A pointer to a &struct pt_regs to hold these values in. * * Convert the GDB regs in @gdb_regs into the pt_regs, and store them * in @regs.
*/ externvoid gdb_regs_to_pt_regs(unsignedlong *gdb_regs, struct pt_regs *regs);
/** * kgdb_arch_handle_exception - Handle architecture specific GDB packets. * @vector: The error vector of the exception that happened. * @signo: The signal number of the exception that happened. * @err_code: The error code of the exception that happened. * @remcom_in_buffer: The buffer of the packet we have read. * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. * @regs: The &struct pt_regs of the current process. * * This function MUST handle the 'c' and 's' command packets, * as well packets to set / remove a hardware breakpoint, if used. * If there are additional packets which the hardware needs to handle, * they are handled here. The code should return -1 if it wants to * process more packets, and a %0 or %1 if it wants to exit from the * kgdb callback.
*/ externint
kgdb_arch_handle_exception(int vector, int signo, int err_code, char *remcom_in_buffer, char *remcom_out_buffer, struct pt_regs *regs);
/** * kgdb_arch_handle_qxfer_pkt - Handle architecture specific GDB XML * packets. * @remcom_in_buffer: The buffer of the packet we have read. * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
*/
/** * kgdb_call_nmi_hook - Call kgdb_nmicallback() on the current CPU * @ignored: This parameter is only here to match the prototype. * * If you're using the default implementation of kgdb_roundup_cpus() * this function will be called per CPU. If you don't implement * kgdb_call_nmi_hook() a default will be used.
*/
externvoid kgdb_call_nmi_hook(void *ignored);
/** * kgdb_roundup_cpus - Get other CPUs into a holding pattern * * On SMP systems, we need to get the attention of the other CPUs * and get them into a known state. This should do what is needed * to get the other CPUs to call kgdb_wait(). Note that on some arches, * the NMI approach is not used for rounding up all the CPUs. Normally * those architectures can just not implement this and get the default. * * On non-SMP systems, this is not called.
*/ externvoid kgdb_roundup_cpus(void);
/** * kgdb_arch_set_pc - Generic call back to the program counter * @regs: Current &struct pt_regs. * @pc: The new value for the program counter * * This function handles updating the program counter and requires an * architecture specific implementation.
*/ externvoid kgdb_arch_set_pc(struct pt_regs *regs, unsignedlong pc);
/** * kgdb_arch_late - Perform any architecture specific initialization. * * This function will handle the late initialization of any * architecture specific callbacks. This is an optional function for * handling things like late initialization of hw breakpoints. The * default implementation does nothing.
*/ externvoid kgdb_arch_late(void);
/** * struct kgdb_arch - Describe architecture specific values. * @gdb_bpt_instr: The instruction to trigger a breakpoint. * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. * @set_breakpoint: Allow an architecture to specify how to set a software * breakpoint. * @remove_breakpoint: Allow an architecture to specify how to remove a * software breakpoint. * @set_hw_breakpoint: Allow an architecture to specify how to set a hardware * breakpoint. * @remove_hw_breakpoint: Allow an architecture to specify how to remove a * hardware breakpoint. * @disable_hw_break: Allow an architecture to specify how to disable * hardware breakpoints for a single cpu. * @remove_all_hw_break: Allow an architecture to specify how to remove all * hardware breakpoints. * @correct_hw_break: Allow an architecture to specify how to correct the * hardware debug registers.
*/ struct kgdb_arch { unsignedchar gdb_bpt_instr[BREAK_INSTR_SIZE]; unsignedlong flags;
int (*set_breakpoint)(unsignedlong, char *); int (*remove_breakpoint)(unsignedlong, char *); int (*set_hw_breakpoint)(unsignedlong, int, enum kgdb_bptype); int (*remove_hw_breakpoint)(unsignedlong, int, enum kgdb_bptype); void (*disable_hw_break)(struct pt_regs *regs); void (*remove_all_hw_break)(void); void (*correct_hw_break)(void);
};
/** * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB. * @name: Name of the I/O driver. * @read_char: Pointer to a function that will return one char. * @write_char: Pointer to a function that will write one char. * @flush: Pointer to a function that will flush any pending writes. * @init: Pointer to a function that will initialize the device. * @deinit: Pointer to a function that will deinit the device. Implies that * this I/O driver is temporary and expects to be replaced. Called when * an I/O driver is replaced or explicitly unregistered. * @pre_exception: Pointer to a function that will do any prep work for * the I/O driver. * @post_exception: Pointer to a function that will do any cleanup work * for the I/O driver. * @cons: valid if the I/O device is a console; else NULL.
*/ struct kgdb_io { constchar *name; int (*read_char) (void); void (*write_char) (u8); void (*flush) (void); int (*init) (void); void (*deinit) (void); void (*pre_exception) (void); void (*post_exception) (void); struct console *cons;
};
externint
kgdb_handle_exception(int ex_vector, int signo, int err_code, struct pt_regs *regs); externint kgdb_nmicallback(int cpu, void *regs); externint kgdb_nmicallin(int cpu, int trapnr, void *regs, int err_code,
atomic_t *snd_rdy); externvoid gdbstub_exit(int status);
/* * kgdb and kprobes both use the same (kprobe) blocklist (which makes sense * given they are both typically hooked up to the same trap meaning on most * architectures one cannot be used to debug the other) * * However on architectures where kprobes is not (yet) implemented we permit * breakpoints everywhere rather than blocking everything by default.
*/ staticinlinebool kgdb_within_blocklist(unsignedlong addr)
{ #ifdef CONFIG_KGDB_HONOUR_BLOCKLIST return within_kprobe_blacklist(addr); #else returnfalse; #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.