mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-30 09:09:16 +08:00
* breakpoint.c (init_raw_breakpoint): Call
add_location_to_breakpoint to replace duplicated code. (add_location_to_breakpoint): Adjust the breakpoint's address prior to allocating a location.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2011-11-14 Yao Qi <yao@codesourcery.com>
|
||||||
|
|
||||||
|
* breakpoint.c (init_raw_breakpoint): Call
|
||||||
|
add_location_to_breakpoint to replace duplicated code.
|
||||||
|
(add_location_to_breakpoint): Adjust the breakpoint's
|
||||||
|
address prior to allocating a location.
|
||||||
|
|
||||||
2011-11-12 Matt Rice <ratmice@gmail.com>
|
2011-11-12 Matt Rice <ratmice@gmail.com>
|
||||||
|
|
||||||
* macrocmd.c (macro_no_macro_info): New function.
|
* macrocmd.c (macro_no_macro_info): New function.
|
||||||
|
@ -111,6 +111,9 @@ static void mention (struct breakpoint *);
|
|||||||
static struct breakpoint *set_raw_breakpoint_without_location (struct gdbarch *,
|
static struct breakpoint *set_raw_breakpoint_without_location (struct gdbarch *,
|
||||||
enum bptype,
|
enum bptype,
|
||||||
const struct breakpoint_ops *);
|
const struct breakpoint_ops *);
|
||||||
|
static struct bp_location *add_location_to_breakpoint (struct breakpoint *,
|
||||||
|
const struct symtab_and_line *);
|
||||||
|
|
||||||
/* This function is used in gdbtk sources and thus can not be made
|
/* This function is used in gdbtk sources and thus can not be made
|
||||||
static. */
|
static. */
|
||||||
struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch,
|
struct breakpoint *set_raw_breakpoint (struct gdbarch *gdbarch,
|
||||||
@ -5763,33 +5766,13 @@ init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch,
|
|||||||
struct symtab_and_line sal, enum bptype bptype,
|
struct symtab_and_line sal, enum bptype bptype,
|
||||||
const struct breakpoint_ops *ops)
|
const struct breakpoint_ops *ops)
|
||||||
{
|
{
|
||||||
CORE_ADDR adjusted_address;
|
|
||||||
struct gdbarch *loc_gdbarch;
|
|
||||||
|
|
||||||
init_raw_breakpoint_without_location (b, gdbarch, bptype, ops);
|
init_raw_breakpoint_without_location (b, gdbarch, bptype, ops);
|
||||||
|
|
||||||
loc_gdbarch = get_sal_arch (sal);
|
add_location_to_breakpoint (b, &sal);
|
||||||
if (!loc_gdbarch)
|
|
||||||
loc_gdbarch = b->gdbarch;
|
|
||||||
|
|
||||||
if (bptype != bp_catchpoint)
|
if (bptype != bp_catchpoint)
|
||||||
gdb_assert (sal.pspace != NULL);
|
gdb_assert (sal.pspace != NULL);
|
||||||
|
|
||||||
/* Adjust the breakpoint's address prior to allocating a location.
|
|
||||||
Once we call allocate_bp_location(), that mostly uninitialized
|
|
||||||
location will be placed on the location chain. Adjustment of the
|
|
||||||
breakpoint may cause target_read_memory() to be called and we do
|
|
||||||
not want its scan of the location chain to find a breakpoint and
|
|
||||||
location that's only been partially initialized. */
|
|
||||||
adjusted_address = adjust_breakpoint_address (loc_gdbarch,
|
|
||||||
sal.pc, b->type);
|
|
||||||
|
|
||||||
b->loc = allocate_bp_location (b);
|
|
||||||
b->loc->gdbarch = loc_gdbarch;
|
|
||||||
b->loc->requested_address = sal.pc;
|
|
||||||
b->loc->address = adjusted_address;
|
|
||||||
b->loc->pspace = sal.pspace;
|
|
||||||
|
|
||||||
/* Store the program space that was used to set the breakpoint, for
|
/* Store the program space that was used to set the breakpoint, for
|
||||||
breakpoint resetting. */
|
breakpoint resetting. */
|
||||||
b->pspace = sal.pspace;
|
b->pspace = sal.pspace;
|
||||||
@ -5798,12 +5781,8 @@ init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch,
|
|||||||
b->source_file = NULL;
|
b->source_file = NULL;
|
||||||
else
|
else
|
||||||
b->source_file = xstrdup (sal.symtab->filename);
|
b->source_file = xstrdup (sal.symtab->filename);
|
||||||
b->loc->section = sal.section;
|
|
||||||
b->line_number = sal.line;
|
b->line_number = sal.line;
|
||||||
|
|
||||||
set_breakpoint_location_function (b->loc,
|
|
||||||
sal.explicit_pc || sal.explicit_line);
|
|
||||||
|
|
||||||
breakpoints_changed ();
|
breakpoints_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7097,21 +7076,32 @@ add_location_to_breakpoint (struct breakpoint *b,
|
|||||||
const struct symtab_and_line *sal)
|
const struct symtab_and_line *sal)
|
||||||
{
|
{
|
||||||
struct bp_location *loc, **tmp;
|
struct bp_location *loc, **tmp;
|
||||||
|
CORE_ADDR adjusted_address;
|
||||||
|
struct gdbarch *loc_gdbarch = get_sal_arch (*sal);
|
||||||
|
|
||||||
|
if (loc_gdbarch == NULL)
|
||||||
|
loc_gdbarch = b->gdbarch;
|
||||||
|
|
||||||
|
/* Adjust the breakpoint's address prior to allocating a location.
|
||||||
|
Once we call allocate_bp_location(), that mostly uninitialized
|
||||||
|
location will be placed on the location chain. Adjustment of the
|
||||||
|
breakpoint may cause target_read_memory() to be called and we do
|
||||||
|
not want its scan of the location chain to find a breakpoint and
|
||||||
|
location that's only been partially initialized. */
|
||||||
|
adjusted_address = adjust_breakpoint_address (loc_gdbarch,
|
||||||
|
sal->pc, b->type);
|
||||||
|
|
||||||
loc = allocate_bp_location (b);
|
loc = allocate_bp_location (b);
|
||||||
for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
|
for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
|
||||||
;
|
;
|
||||||
*tmp = loc;
|
*tmp = loc;
|
||||||
loc->gdbarch = get_sal_arch (*sal);
|
|
||||||
if (!loc->gdbarch)
|
|
||||||
loc->gdbarch = b->gdbarch;
|
|
||||||
loc->requested_address = sal->pc;
|
loc->requested_address = sal->pc;
|
||||||
loc->address = adjust_breakpoint_address (loc->gdbarch,
|
loc->address = adjusted_address;
|
||||||
loc->requested_address, b->type);
|
|
||||||
loc->pspace = sal->pspace;
|
loc->pspace = sal->pspace;
|
||||||
gdb_assert (loc->pspace != NULL);
|
gdb_assert (loc->pspace != NULL);
|
||||||
loc->section = sal->section;
|
loc->section = sal->section;
|
||||||
|
loc->gdbarch = loc_gdbarch;
|
||||||
set_breakpoint_location_function (loc,
|
set_breakpoint_location_function (loc,
|
||||||
sal->explicit_pc || sal->explicit_line);
|
sal->explicit_pc || sal->explicit_line);
|
||||||
return loc;
|
return loc;
|
||||||
|
Reference in New Issue
Block a user