aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2001-09-20 20:07:55 +0000
committerKevin Buettner <kevinb@redhat.com>2001-09-20 20:07:55 +0000
commit1c4dcb577190b1b205381f74ac29eb0102811af6 (patch)
tree2916255d7159bcb4e3fe452a57ba719b0859dc70
parent2c8721ecf3252c9834ce50bedc88d20ca0a63bd8 (diff)
downloadgdb-1c4dcb577190b1b205381f74ac29eb0102811af6.zip
gdb-1c4dcb577190b1b205381f74ac29eb0102811af6.tar.gz
gdb-1c4dcb577190b1b205381f74ac29eb0102811af6.tar.bz2
Make set_solib_svr4_fetch_link_map_offsets() work as intended.
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/solib-svr4.c35
2 files changed, 41 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 238e732..69d6362 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2001-09-20 Kevin Buettner <kevinb@redhat.com>
+
+ * solib-svr4.c (fetch_link_map_offsets): Add comment.
+ (fetch_link_map_offsets_init): New static global.
+ (set_solib_svr4_fetch_link_map_offsets, init_fetch_link_map_offsets):
+ Revise implementation to use ``fetch_link_map_offsets_init''
+ instead of ``fetch_link_map_offsets''.
+
2001-09-20 Alan Modra <amodra@bigpond.net.au>
* coffread.c: Replace all occurrences of bfd_read with bfd_bread.
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index a23b56c..315c0c5 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -62,9 +62,21 @@
#endif
static struct link_map_offsets *default_svr4_fetch_link_map_offsets (void);
+
+/* fetch_link_map_offsets is the pointer to the architecture specific
+ link map offsets fetching function. It uses the gdbarch_swap
+ mechanism to change its value when the architecture changes. */
static struct link_map_offsets *(*fetch_link_map_offsets)(void) =
default_svr4_fetch_link_map_offsets;
+/* fetch_link_map_offsets_init is like the above, but obtains its
+ value from a call to set_solib_svr4_fetch_link_map_offsets().
+ This latter function is intended to be called from a *_gdbarch_init()
+ function. The value of ``fetch_link_map_offsets_init'' is used
+ to actually set ``fetch_link_map_offsets'' when the architecture
+ is installed. */
+static struct link_map_offsets *(*fetch_link_map_offsets_init)(void) = 0;
+
/* legacy_svr4_fetch_link_map_offsets_hook is a pointer to a function
which is used to fetch link map offsets. It will only be set
by solib-legacy.c, if at all. */
@@ -1642,16 +1654,35 @@ svr4_relocate_section_addresses (struct so_list *so,
sec->endaddr += LM_ADDR (so);
}
+/* set_solib_svr4_fetch_link_map_offsets() is intended to be called by
+ a <arch>_gdbarch_init() function. It uses ``fetch_link_map_offsets_init''
+ to temporarily hold a pointer to the link map offsets fetcher for
+ a particular architecture. Once the architecture is actually installed,
+ init_fetch_link_map_offsets(), below, will be called to install this
+ value in ``fetch_link_map_offsets''. After that, the gdbarch_swap
+ machinery will manage the contents of this variable whenever the
+ architecture changes. */
+
void
set_solib_svr4_fetch_link_map_offsets (struct link_map_offsets *(*flmo) (void))
{
- fetch_link_map_offsets = flmo;
+ fetch_link_map_offsets_init = flmo;
}
+/* Initialize the value of ``fetch_link_map_offsets'' when a new
+ architecture is created. set_solib_svr4_fetch_link_map_offsets()
+ is used to set the value that ``fetch_link_map_offsets'' should
+ be initialized to. */
+
static void
init_fetch_link_map_offsets (void)
{
- set_solib_svr4_fetch_link_map_offsets (default_svr4_fetch_link_map_offsets);
+ if (fetch_link_map_offsets_init != NULL)
+ fetch_link_map_offsets = fetch_link_map_offsets_init;
+ else
+ fetch_link_map_offsets = default_svr4_fetch_link_map_offsets;
+
+ fetch_link_map_offsets_init = NULL;
}
static struct target_so_ops svr4_so_ops;