mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-04 12:31:38 +08:00
* breakpoint.c (breakpoint_re_set_one): Factor out breakpoint-resetting
code from here ... (re_set_breakpoint): ... to here ... (addr_string_to_sals): ... and here.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2011-03-30 Thiago Jung Bauermann <bauerman@br.ibm.com>
|
||||||
|
|
||||||
|
* breakpoint.c (breakpoint_re_set_one): Factor out breakpoint-resetting
|
||||||
|
code from here ...
|
||||||
|
(re_set_breakpoint): ... to here ...
|
||||||
|
(addr_string_to_sals): ... and here.
|
||||||
|
|
||||||
2011-03-29 Pierre Muller <muller@ics.u-strasbg.fr>
|
2011-03-29 Pierre Muller <muller@ics.u-strasbg.fr>
|
||||||
|
|
||||||
* Makefile.in (SFILES): Add missing C sources.
|
* Makefile.in (SFILES): Add missing C sources.
|
||||||
|
118
gdb/breakpoint.c
118
gdb/breakpoint.c
@ -10576,56 +10576,20 @@ update_breakpoint_locations (struct breakpoint *b,
|
|||||||
update_global_location_list (1);
|
update_global_location_list (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset a breakpoint given it's struct breakpoint * BINT.
|
/* Find the SaL locations corresponding to the given ADDR_STRING.
|
||||||
The value we return ends up being the return value from catch_errors.
|
On return, FOUND will be 1 if any SaL was found, zero otherwise. */
|
||||||
Unused in this case. */
|
|
||||||
|
|
||||||
static int
|
static struct symtabs_and_lines
|
||||||
breakpoint_re_set_one (void *bint)
|
addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
|
||||||
{
|
{
|
||||||
/* Get past catch_errs. */
|
|
||||||
struct breakpoint *b = (struct breakpoint *) bint;
|
|
||||||
int not_found = 0;
|
|
||||||
int *not_found_ptr = ¬_found;
|
|
||||||
struct symtabs_and_lines sals = {0};
|
|
||||||
struct symtabs_and_lines expanded = {0};
|
|
||||||
char *s;
|
char *s;
|
||||||
|
int marker_spec, not_found;
|
||||||
|
struct symtabs_and_lines sals;
|
||||||
struct gdb_exception e;
|
struct gdb_exception e;
|
||||||
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
|
||||||
int marker_spec = 0;
|
|
||||||
|
|
||||||
switch (b->type)
|
|
||||||
{
|
|
||||||
case bp_none:
|
|
||||||
warning (_("attempted to reset apparently deleted breakpoint #%d?"),
|
|
||||||
b->number);
|
|
||||||
return 0;
|
|
||||||
case bp_breakpoint:
|
|
||||||
case bp_hardware_breakpoint:
|
|
||||||
case bp_tracepoint:
|
|
||||||
case bp_fast_tracepoint:
|
|
||||||
case bp_static_tracepoint:
|
|
||||||
case bp_gnu_ifunc_resolver:
|
|
||||||
/* Do not attempt to re-set breakpoints disabled during startup. */
|
|
||||||
if (b->enable_state == bp_startup_disabled)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (b->addr_string == NULL)
|
|
||||||
{
|
|
||||||
/* Anything without a string can't be re-set. */
|
|
||||||
delete_breakpoint (b);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_radix = b->input_radix;
|
|
||||||
s = b->addr_string;
|
|
||||||
|
|
||||||
save_current_space_and_thread ();
|
|
||||||
switch_to_program_space_and_thread (b->pspace);
|
|
||||||
|
|
||||||
|
s = addr_string;
|
||||||
marker_spec = b->type == bp_static_tracepoint && is_marker_spec (s);
|
marker_spec = b->type == bp_static_tracepoint && is_marker_spec (s);
|
||||||
|
|
||||||
set_language (b->language);
|
|
||||||
TRY_CATCH (e, RETURN_MASK_ERROR)
|
TRY_CATCH (e, RETURN_MASK_ERROR)
|
||||||
{
|
{
|
||||||
if (marker_spec)
|
if (marker_spec)
|
||||||
@ -10641,7 +10605,7 @@ breakpoint_re_set_one (void *bint)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0,
|
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0,
|
||||||
NULL, not_found_ptr);
|
NULL, ¬_found);
|
||||||
}
|
}
|
||||||
if (e.reason < 0)
|
if (e.reason < 0)
|
||||||
{
|
{
|
||||||
@ -10694,12 +10658,75 @@ breakpoint_re_set_one (void *bint)
|
|||||||
|
|
||||||
if (b->type == bp_static_tracepoint && !marker_spec)
|
if (b->type == bp_static_tracepoint && !marker_spec)
|
||||||
sals.sals[0] = update_static_tracepoint (b, sals.sals[0]);
|
sals.sals[0] = update_static_tracepoint (b, sals.sals[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
*found = !not_found;
|
||||||
|
|
||||||
|
return sals;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reevaluate a hardware or software breakpoint and recreate its locations.
|
||||||
|
This is necessary after symbols are read (e.g., an executable or DSO
|
||||||
|
was loaded, or the inferior just started). */
|
||||||
|
|
||||||
|
static void
|
||||||
|
re_set_breakpoint (struct breakpoint *b)
|
||||||
|
{
|
||||||
|
int found;
|
||||||
|
struct symtabs_and_lines sals;
|
||||||
|
struct symtabs_and_lines expanded = {0};
|
||||||
|
struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
|
||||||
|
|
||||||
|
input_radix = b->input_radix;
|
||||||
|
save_current_space_and_thread ();
|
||||||
|
switch_to_program_space_and_thread (b->pspace);
|
||||||
|
set_language (b->language);
|
||||||
|
|
||||||
|
sals = addr_string_to_sals (b, b->addr_string, &found);
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
make_cleanup (xfree, sals.sals);
|
||||||
expanded = expand_line_sal_maybe (sals.sals[0]);
|
expanded = expand_line_sal_maybe (sals.sals[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
make_cleanup (xfree, sals.sals);
|
|
||||||
update_breakpoint_locations (b, expanded);
|
update_breakpoint_locations (b, expanded);
|
||||||
|
do_cleanups (cleanups);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reset a breakpoint given it's struct breakpoint * BINT.
|
||||||
|
The value we return ends up being the return value from catch_errors.
|
||||||
|
Unused in this case. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
breakpoint_re_set_one (void *bint)
|
||||||
|
{
|
||||||
|
/* Get past catch_errs. */
|
||||||
|
struct breakpoint *b = (struct breakpoint *) bint;
|
||||||
|
|
||||||
|
switch (b->type)
|
||||||
|
{
|
||||||
|
case bp_none:
|
||||||
|
warning (_("attempted to reset apparently deleted breakpoint #%d?"),
|
||||||
|
b->number);
|
||||||
|
return 0;
|
||||||
|
case bp_breakpoint:
|
||||||
|
case bp_hardware_breakpoint:
|
||||||
|
case bp_tracepoint:
|
||||||
|
case bp_fast_tracepoint:
|
||||||
|
case bp_static_tracepoint:
|
||||||
|
case bp_gnu_ifunc_resolver:
|
||||||
|
/* Do not attempt to re-set breakpoints disabled during startup. */
|
||||||
|
if (b->enable_state == bp_startup_disabled)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (b->addr_string == NULL)
|
||||||
|
{
|
||||||
|
/* Anything without a string can't be re-set. */
|
||||||
|
delete_breakpoint (b);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
re_set_breakpoint (b);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case bp_watchpoint:
|
case bp_watchpoint:
|
||||||
@ -10780,7 +10807,6 @@ breakpoint_re_set_one (void *bint)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_cleanups (cleanups);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user