This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Fixed shared library handling in solib-pa64.c
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gdb-patches at sourceware dot org
- Cc: randolph at tausq dot org
- Date: Tue, 5 Aug 2008 18:11:24 -0400 (EDT)
- Subject: [patch] Fixed shared library handling in solib-pa64.c
The change below fixes the problem referred to in the NEWS file regarding
the hppa64-hp-hpux11* target. The problem was a NULL load map pointer was
being passed in the dlgetmodinfo and dlgetname calls. This was causing
pa64_target_read_memory() to return 0, and as a result the dlgetmodinfo
call was failing.
It's not entirely clear why the code to find the load map was failing
but I believe it is because the dynamic loader had not initialized the
map at the time the call to find the map was made.
As described here <http://docs.hp.com/en/B2355-60130/dlmodinfo.3C.html>,
it is not necessary to supply a memory read function for the calls to
dlgetmodinfo and dlgetname. This causes the dynamic loader to use its
own data structures to find the correct module.
Getting rid of the code to find the load map results in some simplification.
Please install if ok.
Thanks,
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2008-08-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* solib-pa64.c (dld_cache_t): Remove load_map and load_map_addr fileds.
(pa64_target_read_memory): Delete.
(read_dld_descriptor): Don't read load map pointer. Don't specify
memory read function in call to dlgetmodinfo.
(read_dynamic_info): Don't handle DT_HP_LOAD_MAP.
(pa64_current_sos): Don't specify memory read function in dlgetmodinfo
and dlgetname calls.
(pa64_open_symbol_file_object): Likewise.
Index: solib-pa64.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-pa64.c,v
retrieving revision 1.10
diff -u -3 -p -r1.10 solib-pa64.c
--- solib-pa64.c 1 Jan 2008 22:53:13 -0000 1.10
+++ solib-pa64.c 5 Aug 2008 21:11:29 -0000
@@ -66,8 +66,6 @@ typedef struct
struct bfd_section *dyninfo_sect;
int have_read_dld_descriptor;
int is_valid;
- CORE_ADDR load_map;
- CORE_ADDR load_map_addr;
struct load_module_desc dld_desc;
}
dld_cache_t;
@@ -111,16 +109,6 @@ pa64_clear_solib (void)
{
}
-/* Wrapper for target_read_memory for dlgetmodinfo. */
-
-static void *
-pa64_target_read_memory (void *buffer, CORE_ADDR ptr, size_t bufsiz, int ident)
-{
- if (target_read_memory (ptr, buffer, bufsiz) != 0)
- return 0;
- return buffer;
-}
-
/* Read the dynamic linker's internal shared library descriptor.
This must happen after dld starts running, so we can't do it in
@@ -152,22 +140,9 @@ read_dld_descriptor (void)
error (_("Unable to read in .dynamic section information."));
}
- /* Read the load map pointer. */
- if (target_read_memory (dld_cache.load_map_addr,
- (char *) &dld_cache.load_map,
- sizeof (dld_cache.load_map))
- != 0)
- {
- error (_("Error while reading in load map pointer."));
- }
-
/* Read in the dld load module descriptor */
- if (dlgetmodinfo (-1,
- &dld_cache.dld_desc,
- sizeof (dld_cache.dld_desc),
- pa64_target_read_memory,
- 0,
- dld_cache.load_map)
+ if (dlgetmodinfo (-1, &dld_cache.dld_desc, sizeof (dld_cache.dld_desc),
+ 0, 0, 0)
== 0)
{
error (_("Error trying to get information about dynamic linker."));
@@ -231,19 +206,6 @@ read_dynamic_info (asection *dyninfo_sec
error (_("Error while reading in .dynamic section of the program."));
}
}
- else if (dyn_tag == DT_HP_LOAD_MAP)
- {
- /* Dld will place the address of the load map at load_map_addr
- after it starts running. */
- if (target_read_memory (entry_addr + offsetof(Elf64_Dyn,
- d_un.d_ptr),
- (char*) &dld_cache_p->load_map_addr,
- sizeof (dld_cache_p->load_map_addr))
- != 0)
- {
- error (_("Error while reading in .dynamic section of the program."));
- }
- }
else
{
/* tag is not of interest */
@@ -256,7 +218,7 @@ read_dynamic_info (asection *dyninfo_sec
/* Verify that we read in required info. These fields are re-set to zero
in pa64_solib_restart. */
- if (dld_cache_p->dld_flags_addr != 0 && dld_cache_p->load_map_addr != 0)
+ if (dld_cache_p->dld_flags_addr != 0)
dld_cache_p->is_valid = 1;
else
return 0;
@@ -468,15 +430,11 @@ pa64_current_sos (void)
continue;
/* Read in the load module descriptor. */
- if (dlgetmodinfo (dll_index, &dll_desc, sizeof (dll_desc),
- pa64_target_read_memory, 0, dld_cache.load_map)
- == 0)
+ if (dlgetmodinfo (dll_index, &dll_desc, sizeof (dll_desc), 0, 0, 0) == 0)
break;
/* Get the name of the shared library. */
- dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc),
- pa64_target_read_memory,
- 0, dld_cache.load_map);
+ dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc), 0, 0, 0);
new = (struct so_list *) xmalloc (sizeof (struct so_list));
memset (new, 0, sizeof (struct so_list));
@@ -535,14 +493,11 @@ pa64_open_symbol_file_object (void *from
return 0;
/* Read in the load module descriptor. */
- if (dlgetmodinfo (0, &dll_desc, sizeof (dll_desc),
- pa64_target_read_memory, 0, dld_cache.load_map) == 0)
+ if (dlgetmodinfo (0, &dll_desc, sizeof (dll_desc), 0, 0, 0) == 0)
return 0;
/* Get the name of the shared library. */
- dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc),
- pa64_target_read_memory,
- 0, dld_cache.load_map);
+ dll_path = (char *)dlgetname (&dll_desc, sizeof (dll_desc), 0, 0, 0);
/* Have a pathname: read the symbol file. */
symbol_file_add_main (dll_path, from_tty);