* [RFA] Document lm_addr_check.
@ 2011-07-04 19:51 Thiago Jung Bauermann
2011-07-04 20:34 ` Jan Kratochvil
0 siblings, 1 reply; 2+ messages in thread
From: Thiago Jung Bauermann @ 2011-07-04 19:51 UTC (permalink / raw)
To: gdb-patches ml
Hi,
A long time ago I had to understand lm_addr_check and as a result I
wrote the comment below. I just ran across this forgotten patch. Could
someone more familiar with the code confirm that the comment is correct?
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center
2011-07-04 Thiago Jung Bauermann <bauerman@br.ibm.com>
* solib-svr4.c: (lm_addr_check): Document function.
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index d92a83c..e05b585 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -170,6 +170,16 @@ lm_dynamic_from_link_map (struct so_list *so)
ptr_type);
}
+/* Returns the load address of the given shared object.
+
+ The function also checks if the address of the .dynamic section as
+ calculated from the load address plus the section address in the
+ shared object file matches the actual .dynamic address as given by
+ the inferior's link map.
+
+ If they don't match, it tries to determine if the difference is due
+ to prelink and adjusts the load address accordingly, warning the user. */
+
static CORE_ADDR
lm_addr_check (struct so_list *so, bfd *abfd)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFA] Document lm_addr_check.
2011-07-04 19:51 [RFA] Document lm_addr_check Thiago Jung Bauermann
@ 2011-07-04 20:34 ` Jan Kratochvil
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kratochvil @ 2011-07-04 20:34 UTC (permalink / raw)
To: Thiago Jung Bauermann; +Cc: gdb-patches ml
Hi Thiago,
On Mon, 04 Jul 2011 21:49:16 +0200, Thiago Jung Bauermann wrote:
> static CORE_ADDR
> lm_addr_check (struct so_list *so, bfd *abfd)
->
> +/* Returns the load address of the given shared object.
It returns lm_info->l_addr where is the comment:
/* Amount by which addresses in the binary should be relocated to
match the inferior. This could most often be taken directly
from lm, but when prelinking is involved and the prelink base
address changes, we may need a different offset, we want to
warn about the difference and compute it only once. */
CORE_ADDR l_addr;
This is not the load address. Typically on a prelinked system where
everything works fine L_ADDR == 0 for everything.
> + The function also checks if the address of the .dynamic section as
> + calculated from the load address plus the section address in the
> + shared object file matches the actual .dynamic address as given by
> + the inferior's link map.
"checks" seems more like only a verification; but it in fact bases the
calculation on top of it.
> + If they don't match, it tries to determine if the difference is due
> + to prelink and adjusts the load address accordingly, warning the user. */
There is (now) "info_verbose", in normal cases it adjusts the load address
silently as it is a normal state, without any warning.
/* Returns lm_info->l_addr, the amount by which addresses in the binary should
be relocated to match the inferior.
The function calculates the difference by comparing address of the
PT_DYNAMIC segment as recognized by the dynamic linker (link_map->l_ld) and
the ABFD VMA address of the ".dynamic" section. The ABFD VMA address is
already relocated according to the ABFD load address.
If they don't match, GDB believes the difference is due to prelink and
adjusts the load address accordingly. User is given a warning if the
difference alignment looks as if ABFD does not match the inferior. */
I welcome if you can make the comment more understandable for the reader.
Thanks,
Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-04 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04 19:51 [RFA] Document lm_addr_check Thiago Jung Bauermann
2011-07-04 20:34 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox