aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/solib-darwin.c22
-rw-r--r--gdb/solib-dsbt.c34
-rw-r--r--gdb/solib-frv.c2
-rw-r--r--gdb/solib-svr4.c6
-rw-r--r--gdb/solib.c4
-rw-r--r--gdb/solist.h7
6 files changed, 33 insertions, 42 deletions
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index 98c81bb..fe6483e 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -75,19 +75,17 @@ struct darwin_info
static const registry<program_space>::key<darwin_info>
solib_darwin_pspace_data;
-/* Get the current darwin data. If none is found yet, add it now. This
+/* Get the darwin solib data for PSPACE. If none is found yet, add it now. This
function always returns a valid object. */
-static struct darwin_info *
-get_darwin_info (void)
+static darwin_info *
+get_darwin_info (program_space *pspace)
{
- struct darwin_info *info;
-
- info = solib_darwin_pspace_data.get (current_program_space);
- if (info != NULL)
+ darwin_info *info = solib_darwin_pspace_data.get (pspace);
+ if (info != nullptr)
return info;
- return solib_darwin_pspace_data.emplace (current_program_space);
+ return solib_darwin_pspace_data.emplace (pspace);
}
/* Return non-zero if the version in dyld_all_image is known. */
@@ -225,7 +223,7 @@ darwin_current_sos (void)
struct so_list *head = NULL;
struct so_list *tail = NULL;
int i;
- struct darwin_info *info = get_darwin_info ();
+ darwin_info *info = get_darwin_info (current_program_space);
/* Be sure image infos are loaded. */
darwin_load_image_infos (info);
@@ -506,7 +504,7 @@ darwin_solib_create_inferior_hook (int from_tty)
if (!target_has_execution ())
return;
- struct darwin_info *info = get_darwin_info ();
+ darwin_info *info = get_darwin_info (current_program_space);
CORE_ADDR load_addr;
info->all_image_addr = 0;
@@ -601,9 +599,9 @@ darwin_solib_create_inferior_hook (int from_tty)
}
static void
-darwin_clear_solib (void)
+darwin_clear_solib (program_space *pspace)
{
- struct darwin_info *info = get_darwin_info ();
+ darwin_info *info = get_darwin_info (pspace);
info->all_image_addr = 0;
info->all_image.version = 0;
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index c29b2b8..1ec4afa 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -166,19 +166,17 @@ struct dsbt_info
/* Per-program-space data key. */
static const registry<program_space>::key<dsbt_info> solib_dsbt_pspace_data;
-/* Get the current dsbt data. If none is found yet, add it now. This
+/* Get the dsbt solib data for PSPACE. If none is found yet, add it now. This
function always returns a valid object. */
-static struct dsbt_info *
-get_dsbt_info (void)
+static dsbt_info *
+get_dsbt_info (program_space *pspace)
{
- struct dsbt_info *info;
-
- info = solib_dsbt_pspace_data.get (current_program_space);
- if (info != NULL)
+ dsbt_info *info = solib_dsbt_pspace_data.get (pspace);
+ if (info != nullptr)
return info;
- return solib_dsbt_pspace_data.emplace (current_program_space);
+ return solib_dsbt_pspace_data.emplace (pspace);
}
@@ -270,9 +268,6 @@ decode_loadmap (const gdb_byte *buf)
return int_ldmbuf;
}
-
-static struct dsbt_info *get_dsbt_info (void);
-
/* Interrogate the Linux kernel to find out where the program was loaded.
There are two load maps; one for the executable and one for the
interpreter (only in the case of a dynamically linked executable). */
@@ -280,7 +275,7 @@ static struct dsbt_info *get_dsbt_info (void);
static void
dsbt_get_initial_loadmaps (void)
{
- struct dsbt_info *info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (current_program_space);
gdb::optional<gdb::byte_vector> buf
= target_read_alloc (current_inferior ()->top_target (),
TARGET_OBJECT_FDPIC, "exec");
@@ -442,7 +437,7 @@ lm_base (void)
struct bound_minimal_symbol got_sym;
CORE_ADDR addr;
gdb_byte buf[TIC6X_PTR_SIZE];
- struct dsbt_info *info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (current_program_space);
/* One of our assumptions is that the main executable has been relocated.
Bail out if this has not happened. (Note that post_create_inferior
@@ -524,7 +519,7 @@ dsbt_current_sos (void)
CORE_ADDR lm_addr;
struct so_list *sos_head = NULL;
struct so_list **sos_next_ptr = &sos_head;
- struct dsbt_info *info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (current_program_space);
/* Make sure that the main executable has been relocated. This is
required in order to find the address of the global offset table,
@@ -645,7 +640,7 @@ dsbt_current_sos (void)
static int
dsbt_in_dynsym_resolve_code (CORE_ADDR pc)
{
- struct dsbt_info *info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (current_program_space);
return ((pc >= info->interp_text_sect_low && pc < info->interp_text_sect_high)
|| (pc >= info->interp_plt_sect_low && pc < info->interp_plt_sect_high)
@@ -675,7 +670,6 @@ static int
enable_break (void)
{
asection *interp_sect;
- struct dsbt_info *info;
if (current_program_space->exec_bfd () == NULL)
return 0;
@@ -683,7 +677,7 @@ enable_break (void)
if (!target_has_execution ())
return 0;
- info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (current_program_space);
info->interp_text_sect_low = 0;
info->interp_text_sect_high = 0;
@@ -803,7 +797,7 @@ dsbt_relocate_main_executable (void)
{
struct int_elf32_dsbt_loadmap *ldm;
int changed;
- struct dsbt_info *info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (current_program_space);
dsbt_get_initial_loadmaps ();
ldm = info->exec_loadmap;
@@ -875,9 +869,9 @@ dsbt_solib_create_inferior_hook (int from_tty)
}
static void
-dsbt_clear_solib (void)
+dsbt_clear_solib (program_space *pspace)
{
- struct dsbt_info *info = get_dsbt_info ();
+ dsbt_info *info = get_dsbt_info (pspace);
info->lm_base_cache = 0;
info->main_lm_addr = 0;
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index d4e84a1..c61ed79 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -806,7 +806,7 @@ frv_solib_create_inferior_hook (int from_tty)
}
static void
-frv_clear_solib (void)
+frv_clear_solib (program_space *pspace)
{
lm_base_cache = 0;
enable_break2_done = 0;
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 7bc6ca4..1f8b8b3 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -3178,11 +3178,9 @@ svr4_solib_create_inferior_hook (int from_tty)
}
static void
-svr4_clear_solib (void)
+svr4_clear_solib (program_space *pspace)
{
- struct svr4_info *info;
-
- info = get_svr4_info (current_program_space);
+ svr4_info *info = get_svr4_info (pspace);
info->debug_base = 0;
info->debug_loader_offset_p = 0;
info->debug_loader_offset = 0;
diff --git a/gdb/solib.c b/gdb/solib.c
index e821181..54a4c39 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1241,7 +1241,7 @@ clear_solib (void)
}
if (ops->clear_solib != nullptr)
- ops->clear_solib ();
+ ops->clear_solib (current_program_space);
}
/* Shared library startup support. When GDB starts up the inferior,
@@ -1411,7 +1411,7 @@ reload_shared_libraries (const char *ignored, int from_tty,
/* Reset or free private data structures not associated with
so_list entries. */
if (ops->clear_solib != nullptr)
- ops->clear_solib ();
+ ops->clear_solib (current_program_space);
/* Remove any previous solib event breakpoint. This is usually
done in common code, at breakpoint_init_inferior time, but
diff --git a/gdb/solist.h b/gdb/solist.h
index 0f764b2..b3a06b8 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -96,9 +96,10 @@ struct target_so_ops
It is also called before free_so when SO is about to be freed. */
void (*clear_so) (struct so_list *so);
- /* Reset or free private data structures not associated with
- so_list entries. */
- void (*clear_solib) (void);
+ /* Free private data structures associated to PSPACE. This method
+ should not free resources associated to individual so_list entries,
+ those are cleared by the clear_so method. */
+ void (*clear_solib) (program_space *pspace);
/* Target dependent code to run after child process fork. */
void (*solib_create_inferior_hook) (int from_tty);