From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: gdb-patches@sourceware.org
Cc: randolph@tausq.org
Subject: [patch] Fixed shared library handling in solib-pa64.c
Date: Tue, 05 Aug 2008 22:12:00 -0000 [thread overview]
Message-ID: <20080805221125.A7C2F4E4A@hiauly1.hia.nrc.ca> (raw)
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);
next reply other threads:[~2008-08-05 22:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-05 22:12 John David Anglin [this message]
2008-08-06 13:06 ` Randolph Chung
2008-08-06 14:21 ` Daniel Jacobowitz
2008-08-06 14:59 ` John David Anglin
2008-08-06 18:20 ` [patch] Fix shared library handling in solib-pa64.c (take 2) John David Anglin
2008-08-06 19:26 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080805221125.A7C2F4E4A@hiauly1.hia.nrc.ca \
--to=dave@hiauly1.hia.nrc.ca \
--cc=gdb-patches@sourceware.org \
--cc=randolph@tausq.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox