From 3558b05ff57221e51b69cccd890f274e02e2df9f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 10 Nov 2011 08:56:39 -0700 Subject: [PATCH 2/4] make pspace optional --- gdb/ChangeLog | 12 ++++++++++++ gdb/breakpoint.c | 19 ++++++++++--------- gdb/breakpoint.h | 4 +++- gdb/elfread.c | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 431256a..7bc0370 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2011-11-16 Tom Tromey + * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow + breakpoint's pspace to be NULL. + * breakpoint.h (struct breakpoint) : Update comment. + * breakpoint.c (init_raw_breakpoint): Conditionally set + breakpoint's pspace. + (init_breakpoint_sal): Don't set breakpoint's pspace. + (prepare_re_set_context): Conditionally switch program space. + (addr_string_to_sals): Check executing_startup on location's + program space. + +2011-11-16 Tom Tromey + * breakpoint.h (enum enable_state) : Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2494520..66cdfbd 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5792,9 +5792,11 @@ init_raw_breakpoint (struct breakpoint *b, struct gdbarch *gdbarch, if (bptype != bp_catchpoint) gdb_assert (sal.pspace != NULL); - /* Store the program space that was used to set the breakpoint, for - breakpoint resetting. */ - b->pspace = sal.pspace; + /* Store the program space that was used to set the breakpoint, + except for ordinary breakpoints, which are independent of the + program space. */ + if (bptype != bp_breakpoint && bptype != bp_hardware_breakpoint) + b->pspace = sal.pspace; if (sal.symtab == NULL) b->source_file = NULL; @@ -7187,7 +7189,6 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, b->ignore_count = ignore_count; b->enable_state = enabled ? bp_enabled : bp_disabled; b->disposition = disposition; - b->pspace = sals.sals[0].pspace; if (type == bp_static_tracepoint) { @@ -7947,7 +7948,8 @@ create_breakpoint (struct gdbarch *gdbarch, b->disposition = tempflag ? disp_del : disp_donttouch; b->condition_not_parsed = 1; b->enable_state = enabled ? bp_enabled : bp_disabled; - b->pspace = current_program_space; + if (type_wanted != bp_breakpoint && type_wanted != bp_hardware_breakpoint) + b->pspace = current_program_space; b->py_bp_object = NULL; if (!internal) @@ -10904,9 +10906,6 @@ static struct breakpoint_ops base_breakpoint_ops = static void bkpt_re_set (struct breakpoint *b) { - if (current_program_space->executing_startup) - return; - /* FIXME: is this still reachable? */ if (b->addr_string == NULL) { @@ -11837,6 +11836,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found) if (e.error == NOT_FOUND_ERROR && (b->condition_not_parsed || (b->loc && b->loc->shlib_disabled) + || (b->loc && b->loc->pspace->executing_startup) || b->enable_state == bp_disabled)) not_found_and_ok = 1; @@ -11925,7 +11925,8 @@ prepare_re_set_context (struct breakpoint *b) input_radix = b->input_radix; cleanups = save_current_space_and_thread (); - switch_to_program_space_and_thread (b->pspace); + if (b->pspace != NULL) + switch_to_program_space_and_thread (b->pspace); set_language (b->language); return cleanups; diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7a8b4de..9defd02 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -567,7 +567,9 @@ struct breakpoint equals this. */ struct frame_id frame_id; - /* The program space used to set the breakpoint. */ + /* The program space used to set the breakpoint. This is only set + for breakpoints which are specific to a program space; for + ordinary breakpoints this is NULL. */ struct program_space *pspace; /* String we used to set the breakpoint (malloc'd). */ diff --git a/gdb/elfread.c b/gdb/elfread.c index a309a2c..067c77f 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1032,7 +1032,7 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) } gdb_assert (b->type == bp_gnu_ifunc_resolver); - gdb_assert (current_program_space == b->pspace); + gdb_assert (current_program_space == b->pspace || b->pspace == NULL); elf_gnu_ifunc_record_cache (b->addr_string, resolved_pc); sal = find_pc_line (resolved_pc, 0); -- 1.7.6.4