diff options
author | Tom Tromey <tom@tromey.com> | 2020-05-08 14:21:22 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-05-08 14:21:22 -0600 |
commit | 94c93c35b50d0783fdfda277508d0ae6c3e372fb (patch) | |
tree | e7df63b540b33dc1f070c3394b1ad942121470eb /gdb/breakpoint.c | |
parent | a1fd1ac9def557cbb7570cf90178a00cb26e7fef (diff) | |
download | gdb-94c93c35b50d0783fdfda277508d0ae6c3e372fb.zip gdb-94c93c35b50d0783fdfda277508d0ae6c3e372fb.tar.gz gdb-94c93c35b50d0783fdfda277508d0ae6c3e372fb.tar.bz2 |
Remove ALL_PSPACES
This removes the ALL_PSPACES macro. In this case it seemed cleanest
to change how program spaces are stored -- instead of using a linked
list, they are now stored in a std::vector.
gdb/ChangeLog
2020-05-08 Tom Tromey <tom@tromey.com>
* symtab.c (set_symbol_cache_size)
(maintenance_print_symbol_cache, maintenance_flush_symbol_cache)
(maintenance_print_symbol_cache_statistics): Update.
* symmisc.c (print_symbol_bcache_statistics)
(print_objfile_statistics, maintenance_print_objfiles)
(maintenance_info_symtabs, maintenance_check_symtabs)
(maintenance_expand_symtabs, maintenance_info_line_tables):
Update.
* symfile-debug.c (set_debug_symfile): Update.
* source.c (forget_cached_source_info): Update.
* python/python.c (gdbpy_progspaces): Update.
* psymtab.c (maintenance_info_psymtabs): Update.
* probe.c (parse_probes): Update.
* linespec.c (iterate_over_all_matching_symtabs)
(collect_symtabs_from_filename, search_minsyms_for_name): Update.
* guile/scm-progspace.c (gdbscm_progspaces): Update.
* exec.c (exec_target::close): Update.
* ada-tasks.c (ada_tasks_new_objfile_observer): Update.
* breakpoint.c (print_one_breakpoint_location)
(create_longjmp_master_breakpoint)
(create_std_terminate_master_breakpoint): Update.
* progspace.c (program_spaces): Now a std::vector.
(maybe_new_address_space): Update.
(add_program_space): Remove.
(program_space::program_space): Update.
(remove_program_space): Update.
(number_of_program_spaces): Remove.
(print_program_space, update_address_spaces): Update.
* progspace.h (program_spaces): Change type.
(ALL_PSPACES): Remove.
(number_of_program_spaces): Don't declare.
(struct program_space) <next>: Remove.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 228 |
1 files changed, 113 insertions, 115 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 4cba774..22ddb3d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3224,153 +3224,151 @@ create_overlay_event_breakpoint (void) static void create_longjmp_master_breakpoint (void) { - struct program_space *pspace; - scoped_restore_current_program_space restore_pspace; - ALL_PSPACES (pspace) - { - set_current_program_space (pspace); + for (struct program_space *pspace : program_spaces) + { + set_current_program_space (pspace); - for (objfile *objfile : current_program_space->objfiles ()) - { - int i; - struct gdbarch *gdbarch; - struct breakpoint_objfile_data *bp_objfile_data; + for (objfile *objfile : current_program_space->objfiles ()) + { + int i; + struct gdbarch *gdbarch; + struct breakpoint_objfile_data *bp_objfile_data; - gdbarch = objfile->arch (); + gdbarch = objfile->arch (); - bp_objfile_data = get_breakpoint_objfile_data (objfile); + bp_objfile_data = get_breakpoint_objfile_data (objfile); - if (!bp_objfile_data->longjmp_searched) - { - std::vector<probe *> ret - = find_probes_in_objfile (objfile, "libc", "longjmp"); + if (!bp_objfile_data->longjmp_searched) + { + std::vector<probe *> ret + = find_probes_in_objfile (objfile, "libc", "longjmp"); - if (!ret.empty ()) - { - /* We are only interested in checking one element. */ - probe *p = ret[0]; + if (!ret.empty ()) + { + /* We are only interested in checking one element. */ + probe *p = ret[0]; - if (!p->can_evaluate_arguments ()) - { - /* We cannot use the probe interface here, because it does - not know how to evaluate arguments. */ - ret.clear (); - } - } - bp_objfile_data->longjmp_probes = ret; - bp_objfile_data->longjmp_searched = 1; - } + if (!p->can_evaluate_arguments ()) + { + /* We cannot use the probe interface here, + because it does not know how to evaluate + arguments. */ + ret.clear (); + } + } + bp_objfile_data->longjmp_probes = ret; + bp_objfile_data->longjmp_searched = 1; + } - if (!bp_objfile_data->longjmp_probes.empty ()) - { - for (probe *p : bp_objfile_data->longjmp_probes) - { - struct breakpoint *b; - - b = create_internal_breakpoint (gdbarch, - p->get_relocated_address (objfile), - bp_longjmp_master, - &internal_breakpoint_ops); - b->location = new_probe_location ("-probe-stap libc:longjmp"); - b->enable_state = bp_disabled; - } + if (!bp_objfile_data->longjmp_probes.empty ()) + { + for (probe *p : bp_objfile_data->longjmp_probes) + { + struct breakpoint *b; + + b = create_internal_breakpoint (gdbarch, + p->get_relocated_address (objfile), + bp_longjmp_master, + &internal_breakpoint_ops); + b->location = new_probe_location ("-probe-stap libc:longjmp"); + b->enable_state = bp_disabled; + } - continue; - } + continue; + } - if (!gdbarch_get_longjmp_target_p (gdbarch)) - continue; + if (!gdbarch_get_longjmp_target_p (gdbarch)) + continue; - for (i = 0; i < NUM_LONGJMP_NAMES; i++) - { - struct breakpoint *b; - const char *func_name; - CORE_ADDR addr; - struct explicit_location explicit_loc; + for (i = 0; i < NUM_LONGJMP_NAMES; i++) + { + struct breakpoint *b; + const char *func_name; + CORE_ADDR addr; + struct explicit_location explicit_loc; - if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym)) - continue; + if (msym_not_found_p (bp_objfile_data->longjmp_msym[i].minsym)) + continue; - func_name = longjmp_names[i]; - if (bp_objfile_data->longjmp_msym[i].minsym == NULL) - { - struct bound_minimal_symbol m; + func_name = longjmp_names[i]; + if (bp_objfile_data->longjmp_msym[i].minsym == NULL) + { + struct bound_minimal_symbol m; - m = lookup_minimal_symbol_text (func_name, objfile); - if (m.minsym == NULL) - { - /* Prevent future lookups in this objfile. */ - bp_objfile_data->longjmp_msym[i].minsym = &msym_not_found; - continue; - } - bp_objfile_data->longjmp_msym[i] = m; - } + m = lookup_minimal_symbol_text (func_name, objfile); + if (m.minsym == NULL) + { + /* Prevent future lookups in this objfile. */ + bp_objfile_data->longjmp_msym[i].minsym = &msym_not_found; + continue; + } + bp_objfile_data->longjmp_msym[i] = m; + } - addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i]); - b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master, - &internal_breakpoint_ops); - initialize_explicit_location (&explicit_loc); - explicit_loc.function_name = ASTRDUP (func_name); - b->location = new_explicit_location (&explicit_loc); - b->enable_state = bp_disabled; - } - } - } + addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->longjmp_msym[i]); + b = create_internal_breakpoint (gdbarch, addr, bp_longjmp_master, + &internal_breakpoint_ops); + initialize_explicit_location (&explicit_loc); + explicit_loc.function_name = ASTRDUP (func_name); + b->location = new_explicit_location (&explicit_loc); + b->enable_state = bp_disabled; + } + } + } } /* Create a master std::terminate breakpoint. */ static void create_std_terminate_master_breakpoint (void) { - struct program_space *pspace; const char *const func_name = "std::terminate()"; scoped_restore_current_program_space restore_pspace; - ALL_PSPACES (pspace) - { - CORE_ADDR addr; + for (struct program_space *pspace : program_spaces) + { + CORE_ADDR addr; - set_current_program_space (pspace); + set_current_program_space (pspace); - for (objfile *objfile : current_program_space->objfiles ()) - { - struct breakpoint *b; - struct breakpoint_objfile_data *bp_objfile_data; - struct explicit_location explicit_loc; + for (objfile *objfile : current_program_space->objfiles ()) + { + struct breakpoint *b; + struct breakpoint_objfile_data *bp_objfile_data; + struct explicit_location explicit_loc; - bp_objfile_data = get_breakpoint_objfile_data (objfile); + bp_objfile_data = get_breakpoint_objfile_data (objfile); - if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym)) - continue; + if (msym_not_found_p (bp_objfile_data->terminate_msym.minsym)) + continue; - if (bp_objfile_data->terminate_msym.minsym == NULL) - { - struct bound_minimal_symbol m; + if (bp_objfile_data->terminate_msym.minsym == NULL) + { + struct bound_minimal_symbol m; - m = lookup_minimal_symbol (func_name, NULL, objfile); - if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text - && MSYMBOL_TYPE (m.minsym) != mst_file_text)) - { - /* Prevent future lookups in this objfile. */ - bp_objfile_data->terminate_msym.minsym = &msym_not_found; - continue; - } - bp_objfile_data->terminate_msym = m; - } + m = lookup_minimal_symbol (func_name, NULL, objfile); + if (m.minsym == NULL || (MSYMBOL_TYPE (m.minsym) != mst_text + && MSYMBOL_TYPE (m.minsym) != mst_file_text)) + { + /* Prevent future lookups in this objfile. */ + bp_objfile_data->terminate_msym.minsym = &msym_not_found; + continue; + } + bp_objfile_data->terminate_msym = m; + } - addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym); - b = create_internal_breakpoint (objfile->arch (), addr, - bp_std_terminate_master, - &internal_breakpoint_ops); - initialize_explicit_location (&explicit_loc); - explicit_loc.function_name = ASTRDUP (func_name); - b->location = new_explicit_location (&explicit_loc); - b->enable_state = bp_disabled; - } - } + addr = BMSYMBOL_VALUE_ADDRESS (bp_objfile_data->terminate_msym); + b = create_internal_breakpoint (objfile->arch (), addr, + bp_std_terminate_master, + &internal_breakpoint_ops); + initialize_explicit_location (&explicit_loc); + explicit_loc.function_name = ASTRDUP (func_name); + b->location = new_explicit_location (&explicit_loc); + b->enable_state = bp_disabled; + } + } } /* Install a master breakpoint on the unwinder's debug hook. */ @@ -6088,7 +6086,7 @@ print_one_breakpoint_location (struct breakpoint *b, there are several. Always display for MI. */ if (allflag || (!gdbarch_has_global_breakpoints (target_gdbarch ()) - && (number_of_program_spaces () > 1 + && (program_spaces.size () > 1 || number_of_inferiors () > 1) /* LOC is for existing B, it cannot be in moribund_locations and thus having NULL OWNER. */ |