PR symtab/12406:

* solib.c (update_solib_list): Update the program space's
	added_solibs and deleted_solibs fields.
	* progspace.h (struct program_space) <added_solibs,
	deleted_solibs>: New fields.
	(clear_program_space_solib_cache): Declare.
	* progspace.c (release_program_space): Call
	clear_program_space_solib_cache.
	(clear_program_space_solib_cache): New function.
	* infrun.c (handle_inferior_event) <TARGET_WAITKIND_LOADED>: Call
	bpstat_stop_status.  Use handle_solib_event.
	* breakpoint.c: Include gdb_regex.h.
	(print_solib_event): New function.
	(bpstat_print): Use print_solib_event.
	(bpstat_stop_status): Add special case for bp_shlib_event.
	(handle_solib_event): New function.
	(bpstat_what): Use handle_solib_event.
	(struct solib_catchpoint): New.
	(dtor_catch_solib, insert_catch_solib, remove_catch_solib)
	(breakpoint_hit_catch_solib, check_status_catch_solib)
	(print_it_catch_solib, print_one_catch_solib)
	(print_mention_catch_solib, print_recreate_catch_solib): New
	functions.
	(catch_solib_breakpoint_ops): New global.
	(catch_load_or_unload, catch_load_command_1)
	(catch_unload_command_1): New functions.
	(internal_bkpt_check_status): Add special case for
	bp_shlib_event.
	(internal_bkpt_print_it): Use print_solib_event.
	(initialize_breakpoint_ops): Initialize
	catch_solib_breakpoint_ops.
	(_initialize_breakpoint): Register "catch load" and "catch
	unload".
	* breakpoint.h (handle_solib_event): Declare.
	* NEWS: Add entry for "catch load" and "catch unload".
gdb/doc
	* gdb.texinfo (Set Catchpoints): Document "catch load" and "catch
	unload".
	(Files): Mention new catch commands.
	(GDB/MI Async Records): Likewise.
gdb/testsuite
	* lib/mi-support.exp (mi_expect_stop): Add special case for
	solib-event.
	* gdb.base/catch-load-so.c: New file.
	* gdb.base/catch-load.exp: New file.
	* gdb.base/catch-load.c: New file.
	* gdb.base/break-interp.exp (reach_1): Update regexp.
This commit is contained in:
Tom Tromey
2012-01-24 21:39:18 +00:00
parent fa86499982
commit edcc512082
16 changed files with 714 additions and 61 deletions

View File

@@ -23,6 +23,7 @@
#include "target.h"
#include "vec.h"
#include "gdb_vecs.h"
struct target_ops;
struct bfd;
@@ -32,6 +33,9 @@ struct exec;
struct address_space;
struct program_space_data;
typedef struct so_list *so_list_ptr;
DEF_VEC_P (so_list_ptr);
/* A program space represents a symbolic view of an address space.
Roughly speaking, it holds all the data associated with a
non-running-yet program (main executable, main symbols), and when
@@ -188,6 +192,14 @@ struct program_space
/* Number of calls to solib_add. */
unsigned solib_add_generation;
/* When an solib is added, it is also added to this vector. This
is so we can properly report solib changes to the user. */
VEC (so_list_ptr) *added_solibs;
/* When an solib is removed, its name is added to this vector.
This is so we can properly report solib changes to the user. */
VEC (char_ptr) *deleted_solibs;
/* Per pspace data-pointers required by other GDB modules. */
void **data;
unsigned num_data;
@@ -278,6 +290,11 @@ extern void update_address_spaces (void);
anymore. */
extern void prune_program_spaces (void);
/* Reset saved solib data at the start of an solib event. This lets
us properly collect the data when calling solib_add, so it can then
later be printed. */
extern void clear_program_space_solib_cache (struct program_space *);
/* Keep a registry of per-pspace data-pointers required by other GDB
modules. */