aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1994-12-27 21:52:00 +0000
committerJeff Law <law@redhat.com>1994-12-27 21:52:00 +0000
commit706dc3ce33370d5fc71234ceb106f7cec1f135f3 (patch)
treec4f6796b458866086b8e41d7a2cde2711c4d8531 /gdb/breakpoint.c
parent8675437ee145b62db1460222d80f0cdae48ba51a (diff)
downloadgdb-706dc3ce33370d5fc71234ceb106f7cec1f135f3.zip
gdb-706dc3ce33370d5fc71234ceb106f7cec1f135f3.tar.gz
gdb-706dc3ce33370d5fc71234ceb106f7cec1f135f3.tar.bz2
* breakpoint.c (watchpoint_check): Don't bother restoring the
"selected" frame anymore, it's not necessary. Initialize the frame cache before trying to find the current frame in the frame chain.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c122
1 files changed, 62 insertions, 60 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 45c3df3..aa9ebf6 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -527,7 +527,7 @@ insert_breakpoints ()
&& ! b->inserted
&& ! b->duplicate)
{
- FRAME saved_frame;
+ struct frame_info *saved_frame;
int saved_level, within_current_scope;
value_ptr mark = value_mark ();
value_ptr v;
@@ -542,10 +542,11 @@ insert_breakpoints ()
within_current_scope = 1;
else
{
- FRAME fr = find_frame_addr_in_frame_chain (b->watchpoint_frame);
- within_current_scope = (fr != NULL);
+ struct frame_info *fi =
+ find_frame_addr_in_frame_chain (b->watchpoint_frame);
+ within_current_scope = (fi != NULL);
if (within_current_scope)
- select_frame (fr, -1);
+ select_frame (fi, -1);
}
if (within_current_scope)
@@ -754,7 +755,7 @@ breakpoint_here_p (pc)
int
frame_in_dummy (frame)
- FRAME frame;
+ struct frame_info *frame;
{
struct breakpoint *b;
@@ -1101,20 +1102,19 @@ watchpoint_check (p)
{
bpstat bs = (bpstat) p;
struct breakpoint *b;
- FRAME saved_frame, fr;
+ struct frame_info *saved_frame, *fr;
int within_current_scope, saved_level;
- /* Save the current frame and level so we can restore it after
- evaluating the watchpoint expression on its own frame. */
- saved_frame = selected_frame;
- saved_level = selected_frame_level;
-
b = bs->breakpoint_at;
if (b->exp_valid_block == NULL)
within_current_scope = 1;
else
{
+ /* There is no current frame at this moment. If we're going to have
+ any chance of handling watchpoints on local variables, we'll need
+ the frame chain (so we can determine if we're in scope). */
+ reinit_frame_cache();
fr = find_frame_addr_in_frame_chain (b->watchpoint_frame);
within_current_scope = (fr != NULL);
if (within_current_scope)
@@ -1140,7 +1140,6 @@ watchpoint_check (p)
bs->old_val = b->val;
b->val = new_val;
/* We will stop here */
- select_frame (saved_frame, saved_level);
return WP_VALUE_CHANGED;
}
else
@@ -1148,7 +1147,6 @@ watchpoint_check (p)
/* Nothing changed, don't do anything. */
value_free_to_mark (mark);
/* We won't stop here */
- select_frame (saved_frame, saved_level);
return WP_VALUE_NOT_CHANGED;
}
}
@@ -1169,7 +1167,6 @@ which its expression is valid.\n", bs->breakpoint_at->number);
delete_breakpoint (b->related_breakpoint);
delete_breakpoint (b);
- select_frame (saved_frame, saved_level);
return WP_DELETED;
}
}
@@ -1193,7 +1190,7 @@ print_it_noop (bs)
}
/* Get a bpstat associated with having just stopped at address *PC
- and frame address FRAME_ADDRESS. Update *PC to point at the
+ and frame address CORE_ADDRESS. Update *PC to point at the
breakpoint (if we hit a breakpoint). NOT_A_BREAKPOINT is nonzero
if this is known to not be a real breakpoint (it could still be a
watchpoint, though). */
@@ -1357,7 +1354,7 @@ bpstat_stop_status (pc, not_a_breakpoint)
real_breakpoint = 1;
#endif
- if (b->frame && b->frame != FRAME_FP (get_current_frame ()))
+ if (b->frame && b->frame != (get_current_frame ())->frame)
bs->stop = 0;
else
{
@@ -1945,6 +1942,8 @@ set_raw_breakpoint (sal)
else
b->source_file = savestring (sal.symtab->filename,
strlen (sal.symtab->filename));
+ b->language = current_language->la_language;
+ b->input_radix = input_radix;
b->thread = -1;
b->line_number = sal.line;
b->enable = enabled;
@@ -2090,7 +2089,7 @@ hw_watchpoint_used_count(type, other_type_used)
void
set_longjmp_resume_breakpoint(pc, frame)
CORE_ADDR pc;
- FRAME frame;
+ struct frame_info *frame;
{
register struct breakpoint *b;
@@ -2100,7 +2099,7 @@ set_longjmp_resume_breakpoint(pc, frame)
b->address = pc;
b->enable = enabled;
if (frame != NULL)
- b->frame = FRAME_FP(frame);
+ b->frame = frame->frame;
else
b->frame = 0;
check_duplicates (b->address);
@@ -2115,7 +2114,7 @@ set_longjmp_resume_breakpoint(pc, frame)
struct breakpoint *
set_momentary_breakpoint (sal, frame, type)
struct symtab_and_line sal;
- FRAME frame;
+ struct frame_info *frame;
enum bptype type;
{
register struct breakpoint *b;
@@ -2123,7 +2122,7 @@ set_momentary_breakpoint (sal, frame, type)
b->type = type;
b->enable = enabled;
b->disposition = donttouch;
- b->frame = (frame ? FRAME_FP (frame) : 0);
+ b->frame = (frame ? frame->frame : 0);
return b;
}
@@ -2504,7 +2503,7 @@ watch_command_1 (arg, accessflag, from_tty)
struct expression *exp;
struct block *exp_valid_block;
struct value *val, *mark;
- FRAME frame, prev_frame;
+ struct frame_info *frame, *prev_frame;
char *exp_start = NULL;
char *exp_end = NULL;
char *tok, *end_tok;
@@ -2586,7 +2585,7 @@ watch_command_1 (arg, accessflag, from_tty)
if (frame)
{
prev_frame = get_prev_frame (frame);
- b->watchpoint_frame = FRAME_FP (frame);
+ b->watchpoint_frame = frame->frame;
}
else
b->watchpoint_frame = (CORE_ADDR)0;
@@ -2687,10 +2686,9 @@ static void awatch_command (arg, from_tty)
}
-/*
- * Helper routine for the until_command routine in infcmd.c. Here
- * because it uses the mechanisms of breakpoints.
- */
+/* Helper routine for the until_command routine in infcmd.c. Here
+ because it uses the mechanisms of breakpoints. */
+
/* ARGSUSED */
void
until_break_command (arg, from_tty)
@@ -2699,7 +2697,7 @@ until_break_command (arg, from_tty)
{
struct symtabs_and_lines sals;
struct symtab_and_line sal;
- FRAME prev_frame = get_prev_frame (selected_frame);
+ struct frame_info *prev_frame = get_prev_frame (selected_frame);
struct breakpoint *breakpoint;
struct cleanup *old_chain;
@@ -2733,11 +2731,8 @@ until_break_command (arg, from_tty)
if (prev_frame)
{
- struct frame_info *fi;
-
- fi = get_frame_info (prev_frame);
- sal = find_pc_line (fi->pc, 0);
- sal.pc = fi->pc;
+ sal = find_pc_line (prev_frame->pc, 0);
+ sal.pc = prev_frame->pc;
breakpoint = set_momentary_breakpoint (sal, prev_frame, bp_until);
make_cleanup(delete_breakpoint, breakpoint);
}
@@ -2848,7 +2843,6 @@ get_catch_sals (this_level_only)
register struct blockvector *bl;
register struct block *block;
int index, have_default = 0;
- struct frame_info *fi;
CORE_ADDR pc;
struct symtabs_and_lines sals;
struct sal_chain *sal_chain = 0;
@@ -2859,8 +2853,7 @@ get_catch_sals (this_level_only)
if (selected_frame == NULL)
error ("No selected frame.");
block = get_frame_block (selected_frame);
- fi = get_frame_info (selected_frame);
- pc = fi->pc;
+ pc = selected_frame->pc;
sals.nelts = 0;
sals.sals = NULL;
@@ -3303,6 +3296,8 @@ breakpoint_re_set_one (bint)
save_enable = b->enable;
b->enable = disabled;
+ set_language (b->language);
+ input_radix = b->input_radix;
s = b->addr_string;
sals = decode_line_1 (&s, 1, (struct symtab *)NULL, 0, (char ***)NULL);
for (i = 0; i < sals.nelts; i++)
@@ -3409,15 +3404,21 @@ void
breakpoint_re_set ()
{
struct breakpoint *b, *temp;
+ enum language save_language;
+ int save_input_radix;
static char message1[] = "Error in re-setting breakpoint %d:\n";
char message[sizeof (message1) + 30 /* slop */];
+ save_language = current_language->la_language;
+ save_input_radix = input_radix;
ALL_BREAKPOINTS_SAFE (b, temp)
{
sprintf (message, message1, b->number); /* Format possible error msg */
catch_errors (breakpoint_re_set_one, (char *) b, message,
RETURN_MASK_ALL);
}
+ set_language (save_language);
+ input_radix = save_input_radix;
create_longjmp_breakpoint("longjmp");
create_longjmp_breakpoint("_longjmp");
@@ -3543,7 +3544,7 @@ static void
enable_breakpoint (bpt)
struct breakpoint *bpt;
{
- FRAME save_selected_frame = NULL;
+ struct frame_info *save_selected_frame = NULL;
int save_selected_frame_level = -1;
int target_resources_ok, other_type_used;
struct value *mark;
@@ -3570,7 +3571,8 @@ enable_breakpoint (bpt)
{
if (bpt->exp_valid_block != NULL)
{
- FRAME fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
+ struct frame_info *fr =
+ find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
if (fr == NULL)
{
printf_filtered ("\
@@ -3692,7 +3694,7 @@ static void
enable_once_breakpoint (bpt)
struct breakpoint *bpt;
{
- FRAME save_selected_frame = NULL;
+ struct frame_info *save_selected_frame = NULL;
int save_selected_frame_level = -1;
int target_resources_ok, other_type_used;
struct value *mark;
@@ -3719,7 +3721,8 @@ enable_once_breakpoint (bpt)
{
if (bpt->exp_valid_block != NULL)
{
- FRAME fr = find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
+ struct frame_info *fr =
+ find_frame_addr_in_frame_chain (bpt->watchpoint_frame);
if (fr == NULL)
{
printf_filtered ("\
@@ -3796,9 +3799,8 @@ enable_delete_command (args, from_tty)
map_breakpoint_numbers (args, enable_delete_breakpoint);
}
-/*
- * Use default_breakpoint_'s, or nothing if they aren't valid.
- */
+/* Use default_breakpoint_'s, or nothing if they aren't valid. */
+
struct symtabs_and_lines
decode_line_spec_1 (string, funfirstline)
char *string;
@@ -3931,66 +3933,66 @@ This command may be abbreviated \"delete\".",
&deletelist);
add_com ("clear", class_breakpoint, clear_command,
- "Clear breakpoint at specified line or function.\n\
+ concat ("Clear breakpoint at specified line or function.\n\
Argument may be line number, function name, or \"*\" and an address.\n\
If line number is specified, all breakpoints in that line are cleared.\n\
If function is specified, breakpoints at beginning of function are cleared.\n\
-If an address is specified, breakpoints at that address are cleared.\n\n\
-With no argument, clears all breakpoints in the line that the selected frame\n\
+If an address is specified, breakpoints at that address are cleared.\n\n",
+"With no argument, clears all breakpoints in the line that the selected frame\n\
is executing in.\n\
\n\
-See also the \"delete\" command which clears breakpoints by number.");
+See also the \"delete\" command which clears breakpoints by number.", NULL));
add_com ("break", class_breakpoint, break_command,
- "Set breakpoint at specified line or function.\n\
+ 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\
-If an address is specified, break at that exact address.\n\
-With no arg, uses current execution address of selected stack frame.\n\
+If an address is specified, break at that exact address.\n",
+"With no arg, uses current execution address of selected stack frame.\n\
This is useful for breaking on return to a stack frame.\n\
\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.");
+Do \"help breakpoints\" for info on other commands dealing with breakpoints.", NULL));
add_com_alias ("b", "break", class_run, 1);
add_com_alias ("br", "break", class_run, 1);
add_com_alias ("bre", "break", class_run, 1);
add_com_alias ("brea", "break", class_run, 1);
add_info ("breakpoints", breakpoints_info,
- "Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
+ concat ("Status of user-settable breakpoints, or breakpoint number NUMBER.\n\
The \"Type\" column indicates one of:\n\
\tbreakpoint - normal breakpoint\n\
\twatchpoint - watchpoint\n\
The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\
the disposition of the breakpoint after it gets hit. \"dis\" means that the\n\
breakpoint will be disabled. The \"Address\" and \"What\" columns indicate the\n\
-address and file/line number respectively.\n\n\
-Convenience variable \"$_\" and default examine address for \"x\"\n\
+address and file/line number respectively.\n\n",
+"Convenience variable \"$_\" and default examine address for \"x\"\n\
are set to the address of the last breakpoint listed.\n\n\
Convenience variable \"$bpnum\" contains the number of the last\n\
-breakpoint set.");
+breakpoint set.", NULL));
#if MAINTENANCE_CMDS
add_cmd ("breakpoints", class_maintenance, maintenance_info_breakpoints,
- "Status of all breakpoints, or breakpoint number NUMBER.\n\
+ concat ("Status of all breakpoints, or breakpoint number NUMBER.\n\
The \"Type\" column indicates one of:\n\
\tbreakpoint - normal breakpoint\n\
\twatchpoint - watchpoint\n\
\tlongjmp - internal breakpoint used to step through longjmp()\n\
\tlongjmp resume - internal breakpoint at the target of longjmp()\n\
\tuntil - internal breakpoint used by the \"until\" command\n\
-\tfinish - internal breakpoint used by the \"finish\" command\n\
-The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\
+\tfinish - internal breakpoint used by the \"finish\" command\n",
+"The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\n\
the disposition of the breakpoint after it gets hit. \"dis\" means that the\n\
breakpoint will be disabled. The \"Address\" and \"What\" columns indicate the\n\
-address and file/line number respectively.\n\n\
-Convenience variable \"$_\" and default examine address for \"x\"\n\
+address and file/line number respectively.\n\n",
+"Convenience variable \"$_\" and default examine address for \"x\"\n\
are set to the address of the last breakpoint listed.\n\n\
Convenience variable \"$bpnum\" contains the number of the last\n\
-breakpoint set.",
+breakpoint set.", NULL),
&maintenanceinfolist);
#endif /* MAINTENANCE_CMDS */