/* 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.
#include "language.h"
#include <string.h>
#include "demangle.h"
+#include "annotate.h"
/* local function prototypes */
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;
#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;
static int breakpoint_count;
/* Set breakpoint count to NUM. */
+
static void
set_breakpoint_count (num)
int 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
/* 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;
/* 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;
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);
#endif
\f
/* 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:
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:
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");
}
add_info ("watchpoints", breakpoints_info,
"Synonym for ``info breakpoints''.");
+
}
/* OK, when we call objfile_relocate, we need to relocate breakpoints
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
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);
#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;
&& function != 0)
{
struct type *value_type;
- register value val;
+ register value_ptr val;
CORE_ADDR funcaddr;
value_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (function));
path_info ((char *)NULL, from_tty);
}
\f
-/* 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,
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. */