/* Everything about breakpoints, for GDB.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+ Foundation, Inc.
This file is part of GDB.
#include "symfile.h"
#include "objfiles.h"
#include "linespec.h"
-#ifdef UI_OUT
+#include "completer.h"
+#include "gdb.h"
#include "ui-out.h"
-#endif
#include "gdb-events.h"
typedef struct
{
enum exception_event_kind kind;
- int enable;
+ int enable_p;
}
args_for_catchpoint_enable;
to pass to lookup_internalvar(). */
char *varname;
char *start = ++p;
- value_ptr val;
+ struct value *val;
while (isalnum (*p) || *p == '_')
p++;
ALL_BREAKPOINTS_SAFE (b, temp)
{
- if (b->enable == permanent)
+ if (b->enable_state == bp_permanent)
/* Permanent breakpoints cannot be inserted or removed. */
continue;
else if (b->type != bp_watchpoint
&& b->type != bp_catch_exec
&& b->type != bp_catch_throw
&& b->type != bp_catch_catch
- && b->enable != disabled
- && b->enable != shlib_disabled
- && b->enable != call_disabled
+ && b->enable_state != bp_disabled
+ && b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_call_disabled
&& !b->inserted
&& !b->duplicate)
{
{
/* See also: disable_breakpoints_in_shlibs. */
val = 0;
- b->enable = shlib_disabled;
+ b->enable_state = bp_shlib_disabled;
if (!disabled_breaks)
{
target_terminal_ours_for_output ();
return_val = val; /* remember failure */
}
else if (ep_is_exception_catchpoint (b)
- && b->enable != disabled
- && b->enable != shlib_disabled
- && b->enable != call_disabled
+ && b->enable_state != bp_disabled
+ && b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_call_disabled
&& !b->inserted
&& !b->duplicate)
target_terminal_ours_for_output ();
warning ("Cannot insert catchpoint %d; disabling it.",
b->number);
- b->enable = disabled;
+ b->enable_state = bp_disabled;
}
else
{
args_for_catchpoint_enable args;
args.kind = b->type == bp_catch_catch ?
EX_EVENT_CATCH : EX_EVENT_THROW;
- args.enable = 1;
+ args.enable_p = 1;
val = catch_errors (cover_target_enable_exception_callback,
&args,
message, RETURN_MASK_ALL);
target_terminal_ours_for_output ();
warning ("Cannot insert catchpoint %d; disabling it.",
b->number);
- b->enable = disabled;
+ b->enable_state = bp_disabled;
}
}
else if ((b->type == bp_hardware_watchpoint ||
b->type == bp_read_watchpoint ||
b->type == bp_access_watchpoint)
- && b->enable == enabled
- && b->disposition != del_at_next_stop
+ && b->enable_state == bp_enabled
+ && b->disposition != disp_del_at_next_stop
&& !b->inserted
&& !b->duplicate)
{
struct frame_info *saved_frame;
int saved_level, within_current_scope;
- value_ptr mark = value_mark ();
- value_ptr v;
+ struct value *mark = value_mark ();
+ struct value *v;
/* Save the current frame and level so we can restore it after
evaluating the watchpoint expression on its own frame. */
printf_filtered ("because the program has left the block \n");
printf_filtered ("in which its expression is valid.\n");
if (b->related_breakpoint)
- b->related_breakpoint->disposition = del_at_next_stop;
- b->disposition = del_at_next_stop;
+ b->related_breakpoint->disposition = disp_del_at_next_stop;
+ b->disposition = disp_del_at_next_stop;
}
/* Restore the frame and level. */
else if ((b->type == bp_catch_fork
|| b->type == bp_catch_vfork
|| b->type == bp_catch_exec)
- && b->enable == enabled
+ && b->enable_state == bp_enabled
&& !b->inserted
&& !b->duplicate)
{
{
int val;
- if (b->enable == permanent)
+ if (b->enable_state == bp_permanent)
/* Permanent breakpoints cannot be inserted or removed. */
return 0;
else if ((b->type == bp_hardware_watchpoint ||
b->type == bp_read_watchpoint ||
b->type == bp_access_watchpoint)
- && b->enable == enabled
+ && b->enable_state == bp_enabled
&& !b->duplicate)
{
- value_ptr v, n;
+ struct value *v;
+ struct value *n;
b->inserted = (is == mark_inserted);
/* Walk down the saved value chain. */
else if ((b->type == bp_catch_fork ||
b->type == bp_catch_vfork ||
b->type == bp_catch_exec)
- && b->enable == enabled
+ && b->enable_state == bp_enabled
&& !b->duplicate)
{
val = -1;
}
else if ((b->type == bp_catch_catch ||
b->type == bp_catch_throw)
- && b->enable == enabled
+ && b->enable_state == bp_enabled
&& !b->duplicate)
{
}
else if (ep_is_exception_catchpoint (b)
&& b->inserted /* sometimes previous insert doesn't happen */
- && b->enable == enabled
+ && b->enable_state == bp_enabled
&& !b->duplicate)
{
int any_breakpoint_here = 0;
ALL_BREAKPOINTS (b)
- if ((b->enable == enabled
- || b->enable == permanent)
+ if ((b->enable_state == bp_enabled
+ || b->enable_state == bp_permanent)
&& b->address == pc) /* bp is enabled and matches pc */
{
if (overlay_debugging &&
section_is_overlay (b->section) &&
!section_is_mapped (b->section))
continue; /* unmapped overlay -- can't be a match */
- else if (b->enable == permanent)
+ else if (b->enable_state == bp_permanent)
return permanent_breakpoint_here;
else
any_breakpoint_here = 1;
thread = pid_to_thread_id (ptid);
ALL_BREAKPOINTS (b)
- if (b->enable != disabled
- && b->enable != shlib_disabled
- && b->enable != call_disabled
+ if (b->enable_state != bp_disabled
+ && b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_call_disabled
&& b->address == pc
&& (b->thread == -1 || b->thread == thread))
{
struct breakpoint *
bpstat_find_step_resume_breakpoint (bpstat bsp)
{
+ int current_thread;
+
if (bsp == NULL)
error ("Internal error (bpstat_find_step_resume_breakpoint)");
+ current_thread = pid_to_thread_id (inferior_ptid);
+
for (; bsp != NULL; bsp = bsp->next)
{
if ((bsp->breakpoint_at != NULL) &&
- (bsp->breakpoint_at->type == bp_step_resume))
+ (bsp->breakpoint_at->type == bp_step_resume) &&
+ (bsp->breakpoint_at->thread == current_thread ||
+ bsp->breakpoint_at->thread == -1))
return bsp->breakpoint_at;
}
static enum print_stop_action
print_it_typical (bpstat bs)
{
-#ifdef UI_OUT
struct cleanup *old_chain;
struct ui_stream *stb;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
-#endif /* UI_OUT */
/* bs->breakpoint_at can be NULL if it was a momentary breakpoint
which has since been deleted. */
if (bs->breakpoint_at == NULL)
{
case bp_breakpoint:
case bp_hardware_breakpoint:
-#ifdef UI_OUT
annotate_breakpoint (bs->breakpoint_at->number);
ui_out_text (uiout, "\nBreakpoint ");
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "breakpoint-hit");
ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
ui_out_text (uiout, ", ");
return PRINT_SRC_AND_LOC;
-#else
- /* I think the user probably only wants to see one breakpoint
- number, not all of them. */
- annotate_breakpoint (bs->breakpoint_at->number);
- printf_filtered ("\nBreakpoint %d, ", bs->breakpoint_at->number);
- return PRINT_SRC_AND_LOC;
-#endif
break;
case bp_shlib_event:
if (bs->old_val != NULL)
{
annotate_watchpoint (bs->breakpoint_at->number);
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "watchpoint-trigger");
mention (bs->breakpoint_at);
ui_out_tuple_begin (uiout, "value");
ui_out_field_stream (uiout, "new", stb);
ui_out_tuple_end (uiout);
ui_out_text (uiout, "\n");
-#else
- mention (bs->breakpoint_at);
- printf_filtered ("\nOld value = ");
- value_print (bs->old_val, gdb_stdout, 0, Val_pretty_default);
- printf_filtered ("\nNew value = ");
- value_print (bs->breakpoint_at->val, gdb_stdout, 0,
- Val_pretty_default);
- printf_filtered ("\n");
-#endif
value_free (bs->old_val);
bs->old_val = NULL;
}
break;
case bp_read_watchpoint:
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
mention (bs->breakpoint_at);
ui_out_tuple_begin (uiout, "value");
ui_out_field_stream (uiout, "value", stb);
ui_out_tuple_end (uiout);
ui_out_text (uiout, "\n");
-#else
- mention (bs->breakpoint_at);
- printf_filtered ("\nValue = ");
- value_print (bs->breakpoint_at->val, gdb_stdout, 0,
- Val_pretty_default);
- printf_filtered ("\n");
-#endif
return PRINT_UNKNOWN;
break;
case bp_access_watchpoint:
-#ifdef UI_OUT
if (bs->old_val != NULL)
{
annotate_watchpoint (bs->breakpoint_at->number);
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
mention (bs->breakpoint_at);
ui_out_tuple_begin (uiout, "value");
else
{
mention (bs->breakpoint_at);
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
ui_out_tuple_begin (uiout, "value");
ui_out_text (uiout, "\nValue = ");
ui_out_field_stream (uiout, "new", stb);
ui_out_tuple_end (uiout);
ui_out_text (uiout, "\n");
-#else
- if (bs->old_val != NULL)
- {
- annotate_watchpoint (bs->breakpoint_at->number);
- mention (bs->breakpoint_at);
- printf_filtered ("\nOld value = ");
- value_print (bs->old_val, gdb_stdout, 0, Val_pretty_default);
- value_free (bs->old_val);
- bs->old_val = NULL;
- printf_filtered ("\nNew value = ");
- }
- else
- {
- mention (bs->breakpoint_at);
- printf_filtered ("\nValue = ");
- }
- value_print (bs->breakpoint_at->val, gdb_stdout, 0,
- Val_pretty_default);
- printf_filtered ("\n");
-#endif
return PRINT_UNKNOWN;
break;
here. */
case bp_finish:
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "function-finished");
-#endif
return PRINT_UNKNOWN;
break;
case bp_until:
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "location-reached");
-#endif
return PRINT_UNKNOWN;
break;
static int
breakpoint_cond_eval (PTR exp)
{
- value_ptr mark = value_mark ();
+ struct value *mark = value_mark ();
int i = !value_true (evaluate_expression ((struct expression *) exp));
value_free_to_mark (mark);
return i;
reinit_frame_cache ();
fr = find_frame_addr_in_frame_chain (b->watchpoint_frame);
within_current_scope = (fr != NULL);
+ /* in_function_epilogue_p() returns a non-zero value if we're still
+ in the function but the stack frame has already been invalidated.
+ Since we can't rely on the values of local variables after the
+ stack has been destroyed, we are treating the watchpoint in that
+ state as `not changed' without further checking. */
+ if (within_current_scope && fr == get_current_frame ()
+ && gdbarch_in_function_epilogue_p (current_gdbarch, read_pc ()))
+ return WP_VALUE_NOT_CHANGED;
if (within_current_scope)
/* If we end up stopping, the current frame will get selected
in normal_stop. So this call to select_frame won't affect
call free_all_values. We can't call free_all_values because
we might be in the middle of evaluating a function call. */
- value_ptr mark = value_mark ();
- value_ptr new_val = evaluate_expression (bs->breakpoint_at->exp);
+ struct value *mark = value_mark ();
+ struct value *new_val = evaluate_expression (bs->breakpoint_at->exp);
if (!value_equal (b->val, new_val))
{
release_value (new_val);
in this case, by the time we call print_it_typical() this bp
will be deleted already. So we have no choice but print the
information here. */
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
ui_out_field_string (uiout, "reason", "watchpoint-scope");
ui_out_text (uiout, "\nWatchpoint ");
ui_out_field_int (uiout, "wpnum", bs->breakpoint_at->number);
ui_out_text (uiout, " deleted because the program has left the block in\n\
which its expression is valid.\n");
-#else
- printf_filtered ("\
-Watchpoint %d deleted because the program has left the block in\n\
-which its expression is valid.\n", bs->breakpoint_at->number);
-#endif
if (b->related_breakpoint)
- b->related_breakpoint->disposition = del_at_next_stop;
- b->disposition = del_at_next_stop;
+ b->related_breakpoint->disposition = disp_del_at_next_stop;
+ b->disposition = disp_del_at_next_stop;
return WP_DELETED;
}
"Error evaluating expression for watchpoint %d\n";
char message[sizeof (message1) + 30 /* slop */ ];
- /* Get the address where the breakpoint would have been. */
+ /* Get the address where the breakpoint would have been.
+ The "not_a_breakpoint" argument is meant to distinguish
+ between a breakpoint trap event and a trace/singlestep
+ trap event. For a trace/singlestep trap event, we would
+ not want to subtract DECR_PC_AFTER_BREAK from the PC. */
+
bp_addr = *pc - (not_a_breakpoint && !SOFTWARE_SINGLE_STEP_P () ?
0 : DECR_PC_AFTER_BREAK);
ALL_BREAKPOINTS_SAFE (b, temp)
{
- if (b->enable == disabled
- || b->enable == shlib_disabled
- || b->enable == call_disabled)
+ if (b->enable_state == bp_disabled
+ || b->enable_state == bp_shlib_disabled
+ || b->enable_state == bp_call_disabled)
continue;
if (b->type != bp_watchpoint
/* Error from catch_errors. */
printf_filtered ("Watchpoint %d deleted.\n", b->number);
if (b->related_breakpoint)
- b->related_breakpoint->disposition = del_at_next_stop;
- b->disposition = del_at_next_stop;
+ b->related_breakpoint->disposition = disp_del_at_next_stop;
+ b->disposition = disp_del_at_next_stop;
/* We've already printed what needs to be printed. */
bs->print_it = print_it_done;
b->type == bp_access_watchpoint)
{
CORE_ADDR addr;
- value_ptr v;
+ struct value *v;
int found = 0;
addr = target_stopped_data_address ();
/* Error from catch_errors. */
printf_filtered ("Watchpoint %d deleted.\n", b->number);
if (b->related_breakpoint)
- b->related_breakpoint->disposition = del_at_next_stop;
- b->disposition = del_at_next_stop;
+ b->related_breakpoint->disposition = disp_del_at_next_stop;
+ b->disposition = disp_del_at_next_stop;
/* We've already printed what needs to be printed. */
bs->print_it = print_it_done;
break;
else
{
/* We will stop here */
- if (b->disposition == disable)
- b->enable = disabled;
+ if (b->disposition == disp_disable)
+ b->enable_state = bp_disabled;
bs->commands = b->commands;
if (b->silent)
bs->print = 0;
{
struct breakpoint *b;
ALL_BREAKPOINTS (b)
- if (b->enable == enabled && b->type == bp_watchpoint)
+ if (b->enable_state == bp_enabled && b->type == bp_watchpoint)
return 1;
return 0;
}
{
struct breakpoint *b;
ALL_BREAKPOINTS (b)
- if ((b->enable == enabled) &&
+ if ((b->enable_state == bp_enabled) &&
(b->inserted) &&
((b->type == bp_hardware_watchpoint) ||
(b->type == bp_read_watchpoint) ||
{"del", "dstp", "dis", "keep"};
static char bpenables[] = "nynny";
char wrap_indent[80];
-#ifdef UI_OUT
struct ui_stream *stb = ui_out_stream_new (uiout);
struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb);
-#endif
annotate_record ();
-#ifdef UI_OUT
ui_out_tuple_begin (uiout, "bkpt");
-#endif
/* 1 */
annotate_field (0);
-#ifdef UI_OUT
ui_out_field_int (uiout, "number", b->number);
-#else
- printf_filtered ("%-3d ", b->number);
-#endif
/* 2 */
annotate_field (1);
internal_error (__FILE__, __LINE__,
"bptypes table does not describe type #%d.",
(int) b->type);
-#ifdef UI_OUT
ui_out_field_string (uiout, "type", bptypes[(int) b->type].description);
-#else
- printf_filtered ("%-14s ", bptypes[(int) b->type].description);
-#endif
/* 3 */
annotate_field (2);
-#ifdef UI_OUT
ui_out_field_string (uiout, "disp", bpdisps[(int) b->disposition]);
-#else
- printf_filtered ("%-4s ", bpdisps[(int) b->disposition]);
-#endif
/* 4 */
annotate_field (3);
-#ifdef UI_OUT
- ui_out_field_fmt (uiout, "enabled", "%c", bpenables[(int) b->enable]);
+ ui_out_field_fmt (uiout, "enabled", "%c", bpenables[(int) b->enable_state]);
ui_out_spaces (uiout, 2);
-#else
- printf_filtered ("%-3c ", bpenables[(int) b->enable]);
-#endif
/* 5 and 6 */
strcpy (wrap_indent, " ");
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
is relatively readable). */
-#ifdef UI_OUT
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
print_expression (b->exp, stb->stream);
ui_out_field_stream (uiout, "what", stb);
-#else
- annotate_field (5);
- print_expression (b->exp, gdb_stdout);
-#endif
break;
case bp_catch_load:
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
is relatively readable). */
-#ifdef UI_OUT
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
ui_out_field_string (uiout, "what", b->dll_pathname);
ui_out_text (uiout, "\" ");
}
-#else
- annotate_field (5);
- if (b->dll_pathname == NULL)
- printf_filtered ("<any library> ");
- else
- printf_filtered ("library \"%s\" ", b->dll_pathname);
-#endif
break;
case bp_catch_fork:
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
is relatively readable). */
-#ifdef UI_OUT
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
ui_out_field_int (uiout, "what", b->forked_inferior_pid);
ui_out_spaces (uiout, 1);
}
-#else
- annotate_field (5);
- if (b->forked_inferior_pid != 0)
- printf_filtered ("process %d ", b->forked_inferior_pid);
- break;
-#endif
case bp_catch_exec:
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
is relatively readable). */
-#ifdef UI_OUT
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
ui_out_field_string (uiout, "what", b->exec_pathname);
ui_out_text (uiout, "\" ");
}
-#else
- annotate_field (5);
- if (b->exec_pathname != NULL)
- printf_filtered ("program \"%s\" ", b->exec_pathname);
-#endif
break;
case bp_catch_catch:
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
is relatively readable). */
-#ifdef UI_OUT
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
ui_out_field_string (uiout, "what", "exception catch");
ui_out_spaces (uiout, 1);
-#else
- annotate_field (5);
- printf_filtered ("exception catch ");
-#endif
break;
case bp_catch_throw:
/* Field 4, the address, is omitted (which makes the columns
not line up too nicely with the headers, but the effect
is relatively readable). */
-#ifdef UI_OUT
if (addressprint)
ui_out_field_skip (uiout, "addr");
annotate_field (5);
ui_out_field_string (uiout, "what", "exception throw");
ui_out_spaces (uiout, 1);
-#else
- annotate_field (5);
- printf_filtered ("exception throw ");
-#endif
break;
case bp_breakpoint:
case bp_call_dummy:
case bp_shlib_event:
case bp_thread_event:
-#ifdef UI_OUT
if (addressprint)
{
annotate_field (4);
print_address_symbolic (b->address, stb->stream, demangle, "");
ui_out_field_stream (uiout, "at", stb);
}
-#else
- if (addressprint)
- {
- char *tmp;
-
- annotate_field (4);
-
- if (TARGET_ADDR_BIT <= 32)
- tmp = longest_local_hex_string_custom (b->address
- & (CORE_ADDR) 0xffffffff,
- "08l");
- else
- tmp = longest_local_hex_string_custom (b->address, "016l");
-
- printf_filtered ("%s ", tmp);
- }
- annotate_field (5);
- *last_addr = b->address;
- if (b->source_file)
- {
- sym = find_pc_sect_function (b->address, b->section);
- if (sym)
- {
- fputs_filtered ("in ", gdb_stdout);
- fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
- wrap_here (wrap_indent);
- fputs_filtered (" at ", gdb_stdout);
- }
- fputs_filtered (b->source_file, gdb_stdout);
- printf_filtered (":%d", b->line_number);
- }
- else
- print_address_symbolic (b->address, gdb_stdout, demangle, " ");
-#endif
break;
}
if (b->thread != -1)
{
-#ifdef UI_OUT
/* FIXME: This seems to be redundant and lost here; see the
"stop only in" line a little further down. */
ui_out_text (uiout, " thread ");
ui_out_field_int (uiout, "thread", b->thread);
-#else
- printf_filtered (" thread %d", b->thread);
-#endif
}
-#ifdef UI_OUT
ui_out_text (uiout, "\n");
-#else
- printf_filtered ("\n");
-#endif
if (b->frame)
{
annotate_field (6);
-#ifdef UI_OUT
ui_out_text (uiout, "\tstop only in stack frame at ");
ui_out_field_core_addr (uiout, "frame", b->frame);
ui_out_text (uiout, "\n");
-#else
- printf_filtered ("\tstop only in stack frame at ");
- print_address_numeric (b->frame, 1, gdb_stdout);
- printf_filtered ("\n");
-#endif
}
if (b->cond)
{
annotate_field (7);
-#ifdef UI_OUT
ui_out_text (uiout, "\tstop only if ");
print_expression (b->cond, stb->stream);
ui_out_field_stream (uiout, "cond", stb);
ui_out_text (uiout, "\n");
-#else
- printf_filtered ("\tstop only if ");
- print_expression (b->cond, gdb_stdout);
- printf_filtered ("\n");
-#endif
}
if (b->thread != -1)
{
/* FIXME should make an annotation for this */
-#ifdef UI_OUT
ui_out_text (uiout, "\tstop only in thread ");
ui_out_field_int (uiout, "thread", b->thread);
ui_out_text (uiout, "\n");
-#else
- printf_filtered ("\tstop only in thread %d\n", b->thread);
-#endif
}
if (show_breakpoint_hit_counts && b->hit_count)
{
/* FIXME should make an annotation for this */
-#ifdef UI_OUT
if (ep_is_catchpoint (b))
ui_out_text (uiout, "\tcatchpoint");
else
ui_out_text (uiout, " time\n");
else
ui_out_text (uiout, " times\n");
-#else
- if (ep_is_catchpoint (b))
- printf_filtered ("\tcatchpoint");
- else
- printf_filtered ("\tbreakpoint");
- printf_filtered (" already hit %d time%s\n",
- b->hit_count, (b->hit_count == 1 ? "" : "s"));
-#endif
}
-#ifdef UI_OUT
/* Output the count also if it is zero, but only if this is
mi. FIXME: Should have a better test for this. */
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
if (show_breakpoint_hit_counts && b->hit_count == 0)
ui_out_field_int (uiout, "times", b->hit_count);
-#endif
if (b->ignore_count)
{
annotate_field (8);
-#ifdef UI_OUT
ui_out_text (uiout, "\tignore next ");
ui_out_field_int (uiout, "ignore", b->ignore_count);
ui_out_text (uiout, " hits\n");
-#else
- printf_filtered ("\tignore next %d hits\n", b->ignore_count);
-#endif
}
if ((l = b->commands))
{
annotate_field (9);
-#ifdef UI_OUT
ui_out_tuple_begin (uiout, "script");
print_command_lines (uiout, l, 4);
ui_out_tuple_end (uiout);
-#else
- while (l)
- {
- print_command_line (l, 4, gdb_stdout);
- l = l->next;
- }
-#endif
}
-#ifdef UI_OUT
ui_out_tuple_end (uiout);
do_cleanups (old_chain);
-#endif
}
struct captured_breakpoint_query_args
};
static int
-do_captured_breakpoint_query (void *data)
+do_captured_breakpoint_query (struct ui_out *uiout, void *data)
{
struct captured_breakpoint_query_args *args = data;
register struct breakpoint *b;
}
enum gdb_rc
-gdb_breakpoint_query (/* output object, */ int bnum)
+gdb_breakpoint_query (struct ui_out *uiout, int bnum)
{
struct captured_breakpoint_query_args args;
args.bnum = bnum;
/* For the moment we don't trust print_one_breakpoint() to not throw
an error. */
- return catch_errors (do_captured_breakpoint_query, &args,
- NULL, RETURN_MASK_ALL);
+ return catch_exceptions (uiout, do_captured_breakpoint_query, &args,
+ NULL, RETURN_MASK_ALL);
}
-/* Print information on breakpoint number BNUM, or -1 if all.
- If WATCHPOINTS is zero, process only breakpoints; if WATCHPOINTS
- is nonzero, process only watchpoints. */
+/* Return non-zero if B is user settable (breakpoints, watchpoints,
+ catchpoints, et.al.). */
+
+static int
+user_settable_breakpoint (const struct breakpoint *b)
+{
+ return (b->type == bp_breakpoint
+ || b->type == bp_catch_load
+ || b->type == bp_catch_unload
+ || b->type == bp_catch_fork
+ || b->type == bp_catch_vfork
+ || b->type == bp_catch_exec
+ || b->type == bp_catch_catch
+ || b->type == bp_catch_throw
+ || b->type == bp_hardware_breakpoint
+ || b->type == bp_watchpoint
+ || b->type == bp_read_watchpoint
+ || b->type == bp_access_watchpoint
+ || b->type == bp_hardware_watchpoint);
+}
+
+/* Print information on user settable breakpoint (watchpoint, etc)
+ number BNUM. If BNUM is -1 print all user settable breakpoints.
+ If ALLFLAG is non-zero, include non- user settable breakpoints. */
static void
breakpoint_1 (int bnum, int allflag)
{
register struct breakpoint *b;
CORE_ADDR last_addr = (CORE_ADDR) -1;
- int found_a_breakpoint = 0;
+ int nr_printable_breakpoints;
-#ifdef UI_OUT
+ /* Compute the number of rows in the table. */
+ nr_printable_breakpoints = 0;
+ ALL_BREAKPOINTS (b)
+ if (bnum == -1
+ || bnum == b->number)
+ {
+ if (allflag || user_settable_breakpoint (b))
+ nr_printable_breakpoints++;
+ }
+
if (addressprint)
- ui_out_table_begin (uiout, 6, "BreakpointTable");
+ ui_out_table_begin (uiout, 6, nr_printable_breakpoints, "BreakpointTable");
else
- ui_out_table_begin (uiout, 5, "BreakpointTable");
-#endif /* UI_OUT */
+ ui_out_table_begin (uiout, 5, nr_printable_breakpoints, "BreakpointTable");
+
+ if (nr_printable_breakpoints > 0)
+ annotate_breakpoints_headers ();
+ if (nr_printable_breakpoints > 0)
+ annotate_field (0);
+ ui_out_table_header (uiout, 3, ui_left, "number", "Num"); /* 1 */
+ if (nr_printable_breakpoints > 0)
+ annotate_field (1);
+ ui_out_table_header (uiout, 14, ui_left, "type", "Type"); /* 2 */
+ if (nr_printable_breakpoints > 0)
+ annotate_field (2);
+ ui_out_table_header (uiout, 4, ui_left, "disp", "Disp"); /* 3 */
+ if (nr_printable_breakpoints > 0)
+ annotate_field (3);
+ ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb"); /* 4 */
+ if (addressprint)
+ {
+ if (nr_printable_breakpoints > 0)
+ annotate_field (4);
+ if (TARGET_ADDR_BIT <= 32)
+ ui_out_table_header (uiout, 10, ui_left, "addr", "Address");/* 5 */
+ else
+ ui_out_table_header (uiout, 18, ui_left, "addr", "Address");/* 5 */
+ }
+ if (nr_printable_breakpoints > 0)
+ annotate_field (5);
+ ui_out_table_header (uiout, 40, ui_noalign, "what", "What"); /* 6 */
+ ui_out_table_body (uiout);
+ if (nr_printable_breakpoints > 0)
+ annotate_breakpoints_table ();
ALL_BREAKPOINTS (b)
if (bnum == -1
{
/* We only print out user settable breakpoints unless the
allflag is set. */
- if (!allflag
- && b->type != bp_breakpoint
- && b->type != bp_catch_load
- && b->type != bp_catch_unload
- && b->type != bp_catch_fork
- && b->type != bp_catch_vfork
- && b->type != bp_catch_exec
- && b->type != bp_catch_catch
- && b->type != bp_catch_throw
- && b->type != bp_hardware_breakpoint
- && b->type != bp_watchpoint
- && b->type != bp_read_watchpoint
- && b->type != bp_access_watchpoint
- && b->type != bp_hardware_watchpoint)
- continue;
-
- if (!found_a_breakpoint++)
- {
- annotate_breakpoints_headers ();
-#ifdef UI_OUT
- annotate_field (0);
- ui_out_table_header (uiout, 3, ui_left, "Num"); /* 1 */
- annotate_field (1);
- ui_out_table_header (uiout, 14, ui_left, "Type"); /* 2 */
- annotate_field (2);
- ui_out_table_header (uiout, 4, ui_left, "Disp"); /* 3 */
- annotate_field (3);
- ui_out_table_header (uiout, 3, ui_left, "Enb"); /* 4 */
- if (addressprint)
- {
- annotate_field (4);
- if (TARGET_ADDR_BIT <= 32)
- ui_out_table_header (uiout, 10, ui_left, "Address"); /* 5 */
- else
- ui_out_table_header (uiout, 18, ui_left, "Address"); /* 5 */
- }
- annotate_field (5);
- ui_out_table_header (uiout, 40, ui_noalign, "What"); /* 6 */
- ui_out_table_body (uiout);
-#else
- annotate_field (0);
- printf_filtered ("Num ");
- annotate_field (1);
- printf_filtered ("Type ");
- annotate_field (2);
- printf_filtered ("Disp ");
- annotate_field (3);
- printf_filtered ("Enb ");
- if (addressprint)
- {
- annotate_field (4);
- if (TARGET_ADDR_BIT <= 32)
- printf_filtered ("Address ");
- else
- printf_filtered ("Address ");
- }
- annotate_field (5);
- printf_filtered ("What\n");
-#endif /* UI_OUT */
- annotate_breakpoints_table ();
- }
-
- print_one_breakpoint (b, &last_addr);
+ if (allflag || user_settable_breakpoint (b))
+ print_one_breakpoint (b, &last_addr);
}
- if (!found_a_breakpoint)
+ ui_out_table_end (uiout);
+
+ if (nr_printable_breakpoints == 0)
{
-#ifdef UI_OUT
if (bnum == -1)
ui_out_message (uiout, 0, "No breakpoints or watchpoints.\n");
else
ui_out_message (uiout, 0, "No breakpoint or watchpoint number %d.\n",
bnum);
-#else
- if (bnum == -1)
- printf_filtered ("No breakpoints or watchpoints.\n");
- else
- printf_filtered ("No breakpoint or watchpoint number %d.\n", bnum);
-#endif /* UI_OUT */
}
else
{
set_next_address (last_addr);
}
-#ifdef UI_OUT
- ui_out_table_end (uiout);
-#endif /* UI_OUT */
/* FIXME? Should this be moved up so that it is only called when
there have been breakpoints? */
annotate_breakpoints_table_end ();
others--;
printf_filtered ("%d%s%s ",
b->number,
- ((b->enable == disabled ||
- b->enable == shlib_disabled ||
- b->enable == call_disabled) ? " (disabled)"
- : b->enable == permanent ? " (permanent)"
+ ((b->enable_state == bp_disabled ||
+ b->enable_state == bp_shlib_disabled ||
+ b->enable_state == bp_call_disabled) ? " (disabled)"
+ : b->enable_state == bp_permanent ? " (permanent)"
: ""),
(others > 1) ? ","
: ((others == 1) ? " and" : ""));
default_breakpoint_line = line;
}
+/* Return true iff it is meaningful to use the address member of
+ BPT. For some breakpoint types, the address member is irrelevant
+ and it makes no sense to attempt to compare it to other addresses
+ (or use it for any other purpose either).
+
+ More specifically, each of the following breakpoint types will always
+ have a zero valued address and we don't want check_duplicates() to mark
+ breakpoints of any of these types to be a duplicate of an actual
+ breakpoint at address zero:
+
+ bp_watchpoint
+ bp_hardware_watchpoint
+ bp_read_watchpoint
+ bp_access_watchpoint
+ bp_catch_exec
+ bp_longjmp_resume
+ bp_catch_fork
+ bp_catch_vork */
+
+static int
+breakpoint_address_is_meaningful (struct breakpoint *bpt)
+{
+ enum bptype type = bpt->type;
+
+ return (type != bp_watchpoint
+ && type != bp_hardware_watchpoint
+ && type != bp_read_watchpoint
+ && type != bp_access_watchpoint
+ && type != bp_catch_exec
+ && type != bp_longjmp_resume
+ && type != bp_catch_fork
+ && type != bp_catch_vfork);
+}
+
/* Rescan breakpoints at the same address and section as BPT,
marking the first one as "first" and any others as "duplicates".
This is so that the bpt instruction is only inserted once.
CORE_ADDR address = bpt->address;
asection *section = bpt->section;
- /* Watchpoints are uninteresting. */
- if (bpt->type == bp_watchpoint
- || bpt->type == bp_hardware_watchpoint
- || bpt->type == bp_read_watchpoint
- || bpt->type == bp_access_watchpoint)
+ if (! breakpoint_address_is_meaningful (bpt))
return;
ALL_BREAKPOINTS (b)
- if (b->enable != disabled
- && b->enable != shlib_disabled
- && b->enable != call_disabled
+ if (b->enable_state != bp_disabled
+ && b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_call_disabled
&& b->address == address
- && (overlay_debugging == 0 || b->section == section))
+ && (overlay_debugging == 0 || b->section == section)
+ && breakpoint_address_is_meaningful (b))
{
/* Have we found a permanent breakpoint? */
- if (b->enable == permanent)
+ if (b->enable_state == bp_permanent)
{
perm_bp = b;
break;
"another breakpoint was inserted on top of "
"a permanent breakpoint");
- if (b->enable != disabled
- && b->enable != shlib_disabled
- && b->enable != call_disabled
+ if (b->enable_state != bp_disabled
+ && b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_call_disabled
&& b->address == address
- && (overlay_debugging == 0 || b->section == section))
+ && (overlay_debugging == 0 || b->section == section)
+ && breakpoint_address_is_meaningful (b))
b->duplicate = 1;
}
}
b->input_radix = input_radix;
b->thread = -1;
b->line_number = sal.line;
- b->enable = enabled;
+ b->enable_state = bp_enabled;
b->next = 0;
b->silent = 0;
b->ignore_count = 0;
void
make_breakpoint_permanent (struct breakpoint *b)
{
- b->enable = permanent;
+ b->enable_state = bp_permanent;
/* By definition, permanent breakpoints are already present in the code. */
b->inserted = 1;
b = set_raw_breakpoint (sal,
func_name != NULL ? bp_longjmp : bp_longjmp_resume);
- b->disposition = donttouch;
- b->enable = disabled;
+ b->disposition = disp_donttouch;
+ b->enable_state = bp_disabled;
b->silent = 1;
if (func_name)
b->addr_string = xstrdup (func_name);
ALL_BREAKPOINTS (b)
if (b->type == bp_longjmp)
{
- b->enable = enabled;
+ b->enable_state = bp_enabled;
check_duplicates (b);
}
}
if (b->type == bp_longjmp
|| b->type == bp_longjmp_resume)
{
- b->enable = disabled;
+ b->enable_state = bp_disabled;
check_duplicates (b);
}
}
b = set_raw_breakpoint (sal, bp_thread_event);
b->number = internal_breakpoint_number--;
- b->disposition = donttouch;
- b->enable = enabled;
+ b->disposition = disp_donttouch;
+ b->enable_state = bp_enabled;
/* addr_string has to be used or breakpoint_re_set will delete me. */
sprintf (addr_string, "*0x%s", paddr (b->address));
b->addr_string = xstrdup (addr_string);
sal.section = find_pc_overlay (sal.pc);
b = set_raw_breakpoint (sal, bp_shlib_event);
b->number = internal_breakpoint_number--;
- b->disposition = donttouch;
+ b->disposition = disp_donttouch;
return b;
}
#if defined (PC_SOLIB)
if (((b->type == bp_breakpoint) ||
(b->type == bp_hardware_breakpoint)) &&
- b->enable == enabled &&
+ b->enable_state == bp_enabled &&
!b->duplicate &&
PC_SOLIB (b->address))
{
- b->enable = shlib_disabled;
+ b->enable_state = bp_shlib_disabled;
if (!silent)
{
if (!disabled_shlib_breaks)
struct breakpoint *b;
ALL_BREAKPOINTS (b)
- if (b->enable == shlib_disabled)
+ if (b->enable_state == bp_shlib_disabled)
{
char buf[1];
/* Do not reenable the breakpoint if the shared library
is still not mapped in. */
if (target_read_memory (b->address, buf, 1) == 0)
- b->enable = enabled;
+ b->enable_state = bp_enabled;
}
}
else if (addr_start)
b->addr_string = savestring (addr_start, addr_end - addr_start);
- b->enable = enabled;
- b->disposition = tempflag ? del : donttouch;
+ b->enable_state = bp_enabled;
+ b->disposition = tempflag ? disp_del : disp_donttouch;
if (dll_pathname == NULL)
b->dll_pathname = NULL;
NULL : savestring (cond_string, strlen (cond_string));
b->thread = thread;
b->addr_string = NULL;
- b->enable = enabled;
- b->disposition = tempflag ? del : donttouch;
+ b->enable_state = bp_enabled;
+ b->disposition = tempflag ? disp_del : disp_donttouch;
b->forked_inferior_pid = 0;
mention (b);
NULL : savestring (cond_string, strlen (cond_string));
b->thread = thread;
b->addr_string = NULL;
- b->enable = enabled;
- b->disposition = tempflag ? del : donttouch;
+ b->enable_state = bp_enabled;
+ b->disposition = tempflag ? disp_del : disp_donttouch;
mention (b);
}
ALL_BREAKPOINTS (b)
{
- if (b->type == bp_hardware_breakpoint && b->enable == enabled)
+ if (b->type == bp_hardware_breakpoint && b->enable_state == bp_enabled)
i++;
}
*other_type_used = 0;
ALL_BREAKPOINTS (b)
{
- if (b->enable == enabled)
+ if (b->enable_state == bp_enabled)
{
if (b->type == type)
i++;
else if ((b->type == bp_hardware_watchpoint ||
b->type == bp_read_watchpoint ||
b->type == bp_access_watchpoint)
- && b->enable == enabled)
+ && b->enable_state == bp_enabled)
*other_type_used = 1;
}
}
if (b->type == bp_longjmp_resume)
{
b->address = pc;
- b->enable = enabled;
+ b->enable_state = bp_enabled;
if (frame != NULL)
b->frame = frame->frame;
else
|| (b->type == bp_read_watchpoint)
|| (b->type == bp_access_watchpoint)
|| ep_is_exception_catchpoint (b))
- && (b->enable == enabled))
+ && (b->enable_state == bp_enabled))
{
- b->enable = call_disabled;
+ b->enable_state = bp_call_disabled;
check_duplicates (b);
}
}
|| (b->type == bp_read_watchpoint)
|| (b->type == bp_access_watchpoint)
|| ep_is_exception_catchpoint (b))
- && (b->enable == call_disabled))
+ && (b->enable_state == bp_call_disabled))
{
- b->enable = enabled;
+ b->enable_state = bp_enabled;
check_duplicates (b);
}
}
{
register struct breakpoint *b;
b = set_raw_breakpoint (sal, type);
- b->enable = enabled;
- b->disposition = donttouch;
+ b->enable_state = bp_enabled;
+ b->disposition = disp_donttouch;
b->frame = (frame ? frame->frame : 0);
/* If we're debugging a multi-threaded program, then we
mention (struct breakpoint *b)
{
int say_where = 0;
-#ifdef UI_OUT
struct cleanup *old_chain;
struct ui_stream *stb;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
-#endif /* UI_OUT */
/* FIXME: This is misplaced; mention() is called by things (like hitting a
watchpoint) other than breakpoint creation. It should be possible to
case bp_none:
printf_filtered ("(apparently deleted?) Eventpoint %d: ", b->number);
break;
-#ifdef UI_OUT
case bp_watchpoint:
ui_out_text (uiout, "Watchpoint ");
ui_out_tuple_begin (uiout, "wpt");
ui_out_field_stream (uiout, "exp", stb);
ui_out_tuple_end (uiout);
break;
-#else
- case bp_watchpoint:
- printf_filtered ("Watchpoint %d: ", b->number);
- print_expression (b->exp, gdb_stdout);
- break;
- case bp_hardware_watchpoint:
- printf_filtered ("Hardware watchpoint %d: ", b->number);
- print_expression (b->exp, gdb_stdout);
- break;
-#endif
-#ifdef UI_OUT
case bp_read_watchpoint:
ui_out_text (uiout, "Hardware read watchpoint ");
ui_out_tuple_begin (uiout, "hw-rwpt");
ui_out_field_stream (uiout, "exp", stb);
ui_out_tuple_end (uiout);
break;
-#else
- case bp_read_watchpoint:
- printf_filtered ("Hardware read watchpoint %d: ", b->number);
- print_expression (b->exp, gdb_stdout);
- break;
- case bp_access_watchpoint:
- printf_filtered ("Hardware access (read/write) watchpoint %d: ",
- b->number);
- print_expression (b->exp, gdb_stdout);
- break;
-#endif
case bp_breakpoint:
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
{
say_where = 0;
break;
}
-#endif
printf_filtered ("Breakpoint %d", b->number);
say_where = 1;
break;
case bp_hardware_breakpoint:
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
{
say_where = 0;
break;
}
-#endif
printf_filtered ("Hardware assisted breakpoint %d", b->number);
say_where = 1;
break;
if (b->source_file)
printf_filtered (": file %s, line %d.",
b->source_file, b->line_number);
- TUIDO (((TuiOpaqueFuncPtr) tui_vAllSetHasBreakAt, b, 1));
- TUIDO (((TuiOpaqueFuncPtr) tuiUpdateAllExecInfos));
}
-#ifdef UI_OUT
do_cleanups (old_chain);
-#endif
-#ifdef UI_OUT
- if (interpreter_p && strcmp (interpreter_p, "mi") == 0)
+ if (ui_out_is_mi_like_p (uiout))
return;
-#endif
printf_filtered ("\n");
}
\f
b->addr_string = addr_string[i];
b->cond_string = cond_string[i];
b->ignore_count = ignore_count;
- b->enable = enabled;
+ b->enable_state = bp_enabled;
b->disposition = disposition;
mention (b);
}
create_breakpoints (sals, addr_string, cond, cond_string,
hardwareflag ? bp_hardware_breakpoint : bp_breakpoint,
- tempflag ? del : donttouch,
+ tempflag ? disp_del : disp_donttouch,
thread, ignore_count, from_tty);
if (sals.nelts > 1)
create_breakpoints (sals, addr_string, cond, cond_string,
args->hardwareflag ? bp_hardware_breakpoint : bp_breakpoint,
- args->tempflag ? del : donttouch,
+ args->tempflag ? disp_del : disp_donttouch,
args->thread, args->ignore_count, 0/*from-tty*/);
/* That's it. Discard the cleanups for data inserted into the
b = set_raw_breakpoint (sal, bp_type);
set_breakpoint_count (breakpoint_count + 1);
b->number = breakpoint_count;
- b->disposition = donttouch;
+ b->disposition = disp_donttouch;
b->exp = exp;
b->exp_valid_block = exp_valid_block;
b->exp_string = savestring (exp_start, exp_end - exp_start);
set_breakpoint_count (breakpoint_count + 1);
scope_breakpoint->number = breakpoint_count;
- scope_breakpoint->enable = enabled;
+ scope_breakpoint->enable_state = bp_enabled;
/* Automatically delete the breakpoint when it hits. */
- scope_breakpoint->disposition = del;
+ scope_breakpoint->disposition = disp_del;
/* Only break in the proper frame (help with recursion). */
scope_breakpoint->frame = prev_frame->frame;
return found_memory_cnt;
}
-#ifdef UI_OUT
void
watch_command_wrapper (char *arg, int from_tty)
{
watch_command (arg, from_tty);
}
-#endif
+
static void
watch_command (char *arg, int from_tty)
{
watch_command_1 (arg, hw_write, from_tty);
}
-#ifdef UI_OUT
void
rwatch_command_wrapper (char *arg, int from_tty)
{
rwatch_command (arg, from_tty);
}
-#endif
+
static void
rwatch_command (char *arg, int from_tty)
{
watch_command_1 (arg, hw_read, from_tty);
}
-#ifdef UI_OUT
void
awatch_command_wrapper (char *arg, int from_tty)
{
awatch_command (arg, from_tty);
}
-#endif
+
static void
awatch_command (char *arg, int from_tty)
{
if (blocks_searched[index] == 0)
{
struct block *b = BLOCKVECTOR_BLOCK (bl, index);
- int nsyms;
register int i;
register struct symbol *sym;
- nsyms = BLOCK_NSYMS (b);
-
- for (i = 0; i < nsyms; i++)
+ ALL_BLOCK_SYMBOLS (b, i, sym)
{
- sym = BLOCK_SYM (b, i);
if (STREQ (SYMBOL_NAME (sym), "default"))
{
if (have_default)
NULL : savestring (cond_string, strlen (cond_string));
b->thread = thread;
b->addr_string = NULL;
- b->enable = enabled;
- b->disposition = tempflag ? del : donttouch;
+ b->enable_state = bp_enabled;
+ b->disposition = tempflag ? disp_del : disp_donttouch;
mention (b);
}
{
args_for_catchpoint_enable *args = arg;
struct symtab_and_line *sal;
- sal = target_enable_exception_callback (args->kind, args->enable);
+ sal = target_enable_exception_callback (args->kind, args->enable_p);
if (sal == NULL)
return 0;
else if (sal == (struct symtab_and_line *) -1)
b->number = breakpoint_count;
b->cond = cond;
- b->enable = enabled;
- b->disposition = tempflag ? del : donttouch;
+ b->enable_state = bp_enabled;
+ b->disposition = tempflag ? disp_del : disp_donttouch;
mention (b);
}
b = set_raw_breakpoint (sal, bp_breakpoint);
- b->disposition = del;
- b->enable = enabled;
+ b->disposition = disp_del;
+ b->enable_state = bp_enabled;
b->silent = 1;
b->number = internal_breakpoint_number--;
return b;
struct breakpoint *b, *temp;
for (; bs; bs = bs->next)
- if (bs->breakpoint_at && bs->breakpoint_at->disposition == del
+ if (bs->breakpoint_at && bs->breakpoint_at->disposition == disp_del
&& bs->stop)
delete_breakpoint (bs->breakpoint_at);
ALL_BREAKPOINTS_SAFE (b, temp)
{
- if (b->disposition == del_at_next_stop)
+ if (b->disposition == disp_del_at_next_stop)
delete_breakpoint (b);
}
}
breakpoint_delete_event (bpt->number);
if (bpt->inserted)
- remove_breakpoint (bpt, mark_uninserted);
+ remove_breakpoint (bpt, mark_inserted);
if (breakpoint_chain == bpt)
breakpoint_chain = bpt->next;
sprintf (message, message1, bpt->number);
args.kind = bpt->type == bp_catch_catch ?
EX_EVENT_CATCH : EX_EVENT_THROW;
- args.enable = 0;
+ args.enable_p = 0;
catch_errors (cover_target_enable_exception_callback, &args,
message, RETURN_MASK_ALL);
}
break;
}
- /* Before turning off the visuals for the bp, check to see that
- there are no other bps at the same address. */
- if (tui_version)
- {
- int clearIt;
-
- ALL_BREAKPOINTS (b)
- {
- clearIt = (b->address != bpt->address);
- if (!clearIt)
- break;
- }
-
- if (clearIt)
- {
- TUIDO (((TuiOpaqueFuncPtr) tui_vAllSetHasBreakAt, bpt, 0));
- TUIDO (((TuiOpaqueFuncPtr) tuiUpdateAllExecInfos));
- }
- }
-
check_duplicates (bpt);
/* If this breakpoint was inserted, and there is another breakpoint
at the same address, we need to insert the other breakpoint. */
if (b->address == bpt->address
&& b->section == bpt->section
&& !b->duplicate
- && b->enable != disabled
- && b->enable != shlib_disabled
- && b->enable != call_disabled)
+ && b->enable_state != bp_disabled
+ && b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_call_disabled)
{
int val;
breakpoint at the same address as the one being deleted.
If there is a permanent breakpoint somewhere, it should
always be the only one inserted. */
- if (b->enable == permanent)
+ if (b->enable_state == bp_permanent)
internal_error (__FILE__, __LINE__,
"another breakpoint was inserted on top of "
"a permanent breakpoint");
int i;
struct symtabs_and_lines sals;
char *s;
- enum enable save_enable;
+ enum enable_state save_enable;
switch (b->type)
{
delete_breakpoint (b);
return 0;
}
- /* In case we have a problem, disable this breakpoint. We'll restore
- its status if we succeed. */
- save_enable = b->enable;
- b->enable = disabled;
+ /* HACK: cagney/2001-11-11: kettenis/2001-11-11: MarkK wrote:
+
+ ``And a hack it is, although Apple's Darwin version of GDB
+ contains an almost identical hack to implement a "future
+ break" command. It seems to work in many real world cases,
+ but it is easy to come up with a test case where the patch
+ doesn't help at all.''
+
+ ``It seems that the way GDB implements breakpoints - in -
+ shared - libraries was designed for a.out shared library
+ systems (SunOS 4) where shared libraries were loaded at a
+ fixed address in memory. Since ELF shared libraries can (and
+ will) be loaded at any address in memory, things break.
+ Fixing this is not trivial. Therefore, I'm not sure whether
+ we should add this hack to the branch only. I cannot
+ guarantee that things will be fixed on the trunk in the near
+ future.''
+
+ In case we have a problem, disable this breakpoint. We'll
+ restore its status if we succeed. Don't disable a
+ shlib_disabled breakpoint though. There's a fair chance we
+ can't re-set it if the shared library it's in hasn't been
+ loaded yet. */
+ save_enable = b->enable_state;
+ if (b->enable_state != bp_shlib_disabled)
+ b->enable_state = bp_disabled;
set_language (b->language);
input_radix = b->input_radix;
breakpoints_changed ();
}
b->section = sals.sals[i].section;
- b->enable = save_enable; /* Restore it, this worked. */
+ b->enable_state = save_enable; /* Restore it, this worked. */
/* Now that this is re-enabled, check_duplicates
xfree (b->cond);
b->cond = parse_exp_1 (&s, (struct block *) 0, 0);
}
- if (b->enable == enabled)
+ if (b->enable_state == bp_enabled)
mention (b);
value_free_to_mark (mark);
break;
return;
/* You can't disable permanent breakpoints. */
- if (bpt->enable == permanent)
+ if (bpt->enable_state == bp_permanent)
return;
- bpt->enable = disabled;
+ bpt->enable_state = bp_disabled;
check_duplicates (bpt);
error ("Hardware breakpoints used exceeds limit.");
}
- if (bpt->enable != permanent)
- bpt->enable = enabled;
+ if (bpt->enable_state != bp_permanent)
+ bpt->enable_state = bp_enabled;
bpt->disposition = disposition;
check_duplicates (bpt);
breakpoints_changed ();
printf_filtered ("\
Cannot enable watchpoint %d because the block in which its expression\n\
is valid is not currently in scope.\n", bpt->number);
- bpt->enable = disabled;
+ bpt->enable_state = bp_disabled;
return;
}
printf_filtered ("\
Cannot enable watchpoint %d because target watch resources\n\
have been allocated for other watchpoints.\n", bpt->number);
- bpt->enable = disabled;
+ bpt->enable_state = bp_disabled;
value_free_to_mark (mark);
return;
}
static void
enable_once_breakpoint (struct breakpoint *bpt)
{
- do_enable_breakpoint (bpt, disable);
+ do_enable_breakpoint (bpt, disp_disable);
}
/* ARGSUSED */
static void
enable_delete_breakpoint (struct breakpoint *bpt)
{
- do_enable_breakpoint (bpt, del);
+ do_enable_breakpoint (bpt, disp_del);
}
/* ARGSUSED */
Usage is `condition N COND', where N is an integer and COND is an\n\
expression to be evaluated whenever breakpoint N is reached. ");
- add_com ("tbreak", class_breakpoint, tbreak_command,
- "Set a temporary breakpoint. Args like \"break\" command.\n\
+ c = add_com ("tbreak", class_breakpoint, tbreak_command,
+ "Set a temporary breakpoint. Args like \"break\" command.\n\
Like \"break\" except the breakpoint is only temporary,\n\
so it will be deleted when hit. Equivalent to \"break\" followed\n\
by using \"enable delete\" on the breakpoint number.");
- add_com ("txbreak", class_breakpoint, tbreak_at_finish_command,
- "Set temporary breakpoint at procedure exit. Either there should\n\
+ c->completer = location_completer;
+
+ c = add_com ("txbreak", class_breakpoint, tbreak_at_finish_command,
+ "Set temporary breakpoint at procedure exit. Either there should\n\
be no argument or the argument must be a depth.\n");
+ c->completer = location_completer;
- add_com ("hbreak", class_breakpoint, hbreak_command,
- "Set a hardware assisted breakpoint. Args like \"break\" command.\n\
+ c = add_com ("hbreak", class_breakpoint, hbreak_command,
+ "Set a hardware assisted breakpoint. Args like \"break\" command.\n\
Like \"break\" except the breakpoint requires hardware support,\n\
some target hardware may not have this support.");
+ c->completer = location_completer;
- add_com ("thbreak", class_breakpoint, thbreak_command,
- "Set a temporary hardware assisted breakpoint. Args like \"break\" command.\n\
+ c = add_com ("thbreak", class_breakpoint, thbreak_command,
+ "Set a temporary hardware assisted breakpoint. Args like \"break\" command.\n\
Like \"hbreak\" except the breakpoint is only temporary,\n\
so it will be deleted when hit.");
+ c->completer = location_completer;
add_prefix_cmd ("enable", class_breakpoint, enable_command,
"Enable some breakpoints.\n\
\n\
See also the \"delete\" command which clears breakpoints by number.", NULL));
- add_com ("break", class_breakpoint, break_command,
- concat ("Set breakpoint at specified line or function.\n\
+ c = add_com ("break", class_breakpoint, break_command,
+ concat ("Set breakpoint at specified line or function.\n\
Argument may be line number, function name, or \"*\" and an address.\n\
If line number is specified, break at start of code for that line.\n\
If function is specified, break at start of code for that function.\n\
Multiple breakpoints at one place are permitted, and useful if conditional.\n\
\n\
Do \"help breakpoints\" for info on other commands dealing with breakpoints.", NULL));
+ c->completer = location_completer;
+
add_com_alias ("b", "break", class_run, 1);
add_com_alias ("br", "break", class_run, 1);
add_com_alias ("bre", "break", class_run, 1);
so it will be deleted when hit. Equivalent to \"catch\" followed\n\
by using \"enable delete\" on the catchpoint number.");
- add_com ("watch", class_breakpoint, watch_command,
- "Set a watchpoint for an expression.\n\
+ c = add_com ("watch", class_breakpoint, watch_command,
+ "Set a watchpoint for an expression.\n\
A watchpoint stops execution of your program whenever the value of\n\
an expression changes.");
+ c->completer = location_completer;
- add_com ("rwatch", class_breakpoint, rwatch_command,
- "Set a read watchpoint for an expression.\n\
+ c = add_com ("rwatch", class_breakpoint, rwatch_command,
+ "Set a read watchpoint for an expression.\n\
A watchpoint stops execution of your program whenever the value of\n\
an expression is read.");
+ c->completer = location_completer;
- add_com ("awatch", class_breakpoint, awatch_command,
- "Set a watchpoint for an expression.\n\
+ c = add_com ("awatch", class_breakpoint, awatch_command,
+ "Set a watchpoint for an expression.\n\
A watchpoint stops execution of your program whenever the value of\n\
an expression is either read or written.");
+ c->completer = location_completer;
add_info ("watchpoints", breakpoints_info,
"Synonym for ``info breakpoints''.");