diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/breakpoint.c | 63 | ||||
-rw-r--r-- | gdb/infcmd.c | 94 |
3 files changed, 75 insertions, 94 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e91117..7732611 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Wed Jul 13 18:58:15 1994 Stan Shebs (shebs@andros.cygnus.com) + + Breakpoint hit counts, from Bob Rusk (rrusk@mail.csd.harris.com). + * breakpoint.h (hit_count): New breakpoint field. + * breakpoint.c (show_breakpoint_hit_counts): New variable. + (clear_breakpoint_hit_counts): New function. + (bpstat_stop_status): Increment the hit count. + (breakpoint_1): Display the hit count. + * infcmd.c (run_command): Reset breakpoint hit counts. + * target.c (generic_mourn_inferior): Don't clear ignore counts if + displaying hit counts. + Tue Jul 12 12:23:15 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * elfread.c (elf_symfile_read): Unconditionally add dynamic diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index c2abcd0..7f9d0f2 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1,5 +1,6 @@ /* Everything about breakpoints, for GDB. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994 + Free Software Foundation, Inc. This file is part of GDB. @@ -35,6 +36,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "language.h" #include <string.h> #include "demangle.h" +#include "annotate.h" /* local function prototypes */ @@ -141,7 +143,6 @@ static int remove_breakpoint PARAMS ((struct breakpoint *)); extern int addressprint; /* Print machine addresses? */ -extern int demangle; /* Print de-mangled symbol names? */ /* Are we executing breakpoint commands? */ static int executing_breakpoint_commands; @@ -173,6 +174,10 @@ static int executing_breakpoint_commands; #define target_stopped_data_address() 0 #endif +/* True if breakpoint hit counts should be displayed in breakpoint info. */ + +int show_breakpoint_hit_counts = 1; + /* Chain of all breakpoints defined. */ static struct breakpoint *breakpoint_chain; @@ -182,6 +187,7 @@ static struct breakpoint *breakpoint_chain; static int breakpoint_count; /* Set breakpoint count to NUM. */ + static void set_breakpoint_count (num) int num; @@ -191,6 +197,17 @@ set_breakpoint_count (num) value_from_longest (builtin_type_int, (LONGEST) num)); } +/* Used in run_command to zero the hit count when a new run starts. */ + +void +clear_breakpoint_hit_counts () +{ + struct breakpoint *b; + + ALL_BREAKPOINTS (b) + b->hit_count = 0; +} + /* Default address, symtab and line to put a breakpoint at for "break" command with no arg. if default_breakpoint_valid is zero, the other three are @@ -1247,6 +1264,8 @@ bpstat_stop_status (pc, frame_address, not_a_breakpoint) /* Come here if it's a watchpoint, or if the break address matches */ + ++(b->hit_count); + bs = bpstat_alloc (b, bs); /* Alloc a bpstat to explain stop */ bs->stop = 1; @@ -1689,8 +1708,7 @@ breakpoint_1 (bnum, allflag) /* Field 4, the address, is omitted (which makes the columns not line up too nicely with the headers, but the effect is relatively readable). */ - if (annotation_level > 1) - printf_filtered ("\n\032\032field 5\n"); + annotate_field (5); print_expression (b->exp, gdb_stdout); break; @@ -1756,6 +1774,14 @@ breakpoint_1 (bnum, allflag) printf_filtered ("\n"); } + if (show_breakpoint_hit_counts && b->hit_count) + { + /* FIXME should make an annotation for this */ + + printf_filtered ("\tbreakpoint already hit %d times\n", + b->hit_count); + } + if (b->ignore_count) { annotate_field (8); @@ -2115,10 +2141,13 @@ clear_momentary_breakpoints () #endif /* Tell the user we have just set a breakpoint B. */ + static void mention (b) struct breakpoint *b; { + int say_where = 0; + switch (b->type) { case bp_watchpoint: @@ -2138,18 +2167,12 @@ mention (b) print_expression (b->exp, gdb_stdout); break; case bp_breakpoint: - printf_filtered ("Breakpoint %d at ", b->number); - print_address_numeric (b->address, 1, gdb_stdout); - if (b->source_file) - printf_filtered (": file %s, line %d.", - b->source_file, b->line_number); + printf_filtered ("Breakpoint %d", b->number); + say_where = 1; break; case bp_hardware_breakpoint: - printf_filtered ("Hardware assisted breakpoint %d at ", b->number); - print_address_numeric (b->address, 1, gdb_stdout); - if (b->source_file) - printf_filtered (": file %s, line %d.", - b->source_file, b->line_number); + printf_filtered ("Hardware assisted breakpoint %d", b->number); + say_where = 1; break; case bp_until: case bp_finish: @@ -2161,6 +2184,17 @@ mention (b) case bp_watchpoint_scope: break; } + if (say_where) + { + if (addressprint || b->source_file == NULL) + { + printf_filtered (" at "); + print_address_numeric (b->address, 1, gdb_stdout); + } + if (b->source_file) + printf_filtered (": file %s, line %d.", + b->source_file, b->line_number); + } printf_filtered ("\n"); } @@ -3974,6 +4008,7 @@ an expression is either read or written."); add_info ("watchpoints", breakpoints_info, "Synonym for ``info breakpoints''."); + } /* OK, when we call objfile_relocate, we need to relocate breakpoints diff --git a/gdb/infcmd.c b/gdb/infcmd.c index cb27ee7..ff97d3a 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -222,6 +222,8 @@ Start it from the beginning? ")) target_kill (); } + clear_breakpoint_hit_counts (); + exec_file = (char *) get_exec_file (0); /* The exec file is re-read every time we do a generic_mourn_inferior, so @@ -464,8 +466,11 @@ jump_command (arg, from_tty) addr = sal.pc; if (from_tty) - printf_filtered ("Continuing at %s.\n", - local_hex_string((unsigned long) addr)); + { + printf_filtered ("Continuing at "); + print_address_numeric (addr, 1, gdb_stdout); + printf_filtered (".\n"); + } clear_proceed_status (); proceed (addr, TARGET_SIGNAL_0, 0); @@ -572,7 +577,7 @@ run_stack_dummy (addr, buffer) #if CALL_DUMMY_LOCATION != AT_ENTRY_POINT sal.pc = addr - CALL_DUMMY_START_OFFSET + CALL_DUMMY_BREAKPOINT_OFFSET; #else - sal.pc = entry_point_address (); + sal.pc = CALL_DUMMY_ADDRESS (); #endif sal.symtab = NULL; sal.line = 0; @@ -741,7 +746,7 @@ finish_command (arg, from_tty) && function != 0) { struct type *value_type; - register value val; + register value_ptr val; CORE_ADDR funcaddr; value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function)); @@ -957,82 +962,6 @@ path_command (dirname, from_tty) path_info ((char *)NULL, from_tty); } -/* This routine is getting awfully cluttered with #if's. It's probably - time to turn this into READ_PC and define it in the tm.h file. - Ditto for write_pc. */ - -CORE_ADDR -read_pc () -{ -#ifdef TARGET_READ_PC - return TARGET_READ_PC (); -#else - return ADDR_BITS_REMOVE ((CORE_ADDR) read_register (PC_REGNUM)); -#endif -} - -void -write_pc (val) - CORE_ADDR val; -{ -#ifdef TARGET_WRITE_PC - TARGET_WRITE_PC (val); -#else - write_register (PC_REGNUM, (long) val); -#ifdef NPC_REGNUM - write_register (NPC_REGNUM, (long) val + 4); -#ifdef NNPC_REGNUM - write_register (NNPC_REGNUM, (long) val + 8); -#endif -#endif -#endif -} - -/* Cope with strage ways of getting to the stack and frame pointers */ - -CORE_ADDR -read_sp () -{ -#ifdef TARGET_READ_SP - return TARGET_READ_SP (); -#else - return read_register (SP_REGNUM); -#endif -} - -void -write_sp (val) - CORE_ADDR val; -{ -#ifdef TARGET_WRITE_SP - TARGET_WRITE_SP (val); -#else - write_register (SP_REGNUM, val); -#endif -} - - -CORE_ADDR -read_fp () -{ -#ifdef TARGET_READ_FP - return TARGET_READ_FP (); -#else - return read_register (FP_REGNUM); -#endif -} - -void -write_fp (val) - CORE_ADDR val; -{ -#ifdef TARGET_WRITE_FP - TARGET_WRITE_FP (val); -#else - write_register (FP_REGNUM, val); -#endif -} - const char * const reg_names[] = REGISTER_NAMES; /* Print out the machine register regnum. If regnum is -1, @@ -1242,7 +1171,12 @@ attach_command (args, from_tty) clear_proceed_status (); stop_soon_quietly = 1; +#ifndef MACH + /* Mach 3 does not generate any traps when attaching to inferior, + and to set up frames we can do this. */ + wait_for_inferior (); +#endif #ifdef SOLIB_ADD /* Add shared library symbols from the newly attached process, if any. */ |