/* * Kernel Debugger Architecture Independent Breakpoint Handler * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (c) 1999-2004 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved. */ #include <linux/string.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/kdb.h> #include <linux/kgdb.h> #include <linux/smp.h> #include <linux/sched.h> #include <linux/interrupt.h> #include "kdb_private.h" /* * Table of kdb_breakpoints */ kdb_bp_t kdb_breakpoints[KDB_MAXBPT]; static void kdb_setsinglestep(struct pt_regs *regs) { … } static char *kdb_rwtypes[] = …; static char *kdb_bptype(kdb_bp_t *bp) { … } static int kdb_parsebp(int argc, const char **argv, int *nextargp, kdb_bp_t *bp) { … } static int _kdb_bp_remove(kdb_bp_t *bp) { … } static void kdb_handle_bp(struct pt_regs *regs, kdb_bp_t *bp) { … } static int _kdb_bp_install(struct pt_regs *regs, kdb_bp_t *bp) { … } /* * kdb_bp_install * * Install kdb_breakpoints prior to returning from the * kernel debugger. This allows the kdb_breakpoints to be set * upon functions that are used internally by kdb, such as * printk(). This function is only called once per kdb session. */ void kdb_bp_install(struct pt_regs *regs) { … } /* * kdb_bp_remove * * Remove kdb_breakpoints upon entry to the kernel debugger. * * Parameters: * None. * Outputs: * None. * Returns: * None. * Locking: * None. * Remarks: */ void kdb_bp_remove(void) { … } /* * kdb_printbp * * Internal function to format and print a breakpoint entry. * * Parameters: * None. * Outputs: * None. * Returns: * None. * Locking: * None. * Remarks: */ static void kdb_printbp(kdb_bp_t *bp, int i) { … } /* * kdb_bp * * Handle the bp commands. * * [bp|bph] <addr-expression> [DATAR|DATAW] * * Parameters: * argc Count of arguments in argv * argv Space delimited command line arguments * Outputs: * None. * Returns: * Zero for success, a kdb diagnostic if failure. * Locking: * None. * Remarks: * * bp Set breakpoint on all cpus. Only use hardware assist if need. * bph Set breakpoint on all cpus. Force hardware register */ static int kdb_bp(int argc, const char **argv) { … } /* * kdb_bc * * Handles the 'bc', 'be', and 'bd' commands * * [bd|bc|be] <breakpoint-number> * [bd|bc|be] * * * Parameters: * argc Count of arguments in argv * argv Space delimited command line arguments * Outputs: * None. * Returns: * Zero for success, a kdb diagnostic for failure * Locking: * None. * Remarks: */ static int kdb_bc(int argc, const char **argv) { … } /* * kdb_ss * * Process the 'ss' (Single Step) command. * * ss * * Parameters: * argc Argument count * argv Argument vector * Outputs: * None. * Returns: * KDB_CMD_SS for success, a kdb error if failure. * Locking: * None. * Remarks: * * Set the arch specific option to trigger a debug trap after the next * instruction. */ static int kdb_ss(int argc, const char **argv) { … } static kdbtab_t bptab[] = …; static kdbtab_t bphcmd = …; /* Initialize the breakpoint table and register breakpoint commands. */ void __init kdb_initbptab(void) { … }