* [patch] nto-tdep.c - adjust addr_low addr_high @ 2009-07-08 14:27 Aleksandar Ristovski 2009-07-21 17:16 ` Aleksandar Ristovski 2009-07-24 15:41 ` Pedro Alves 0 siblings, 2 replies; 5+ messages in thread From: Aleksandar Ristovski @ 2009-07-08 14:27 UTC (permalink / raw) To: gdb-patches [-- Attachment #1: Type: text/plain, Size: 248 bytes --] Hello, This adjusts so->addr_low and so->addr_high for proper "info sahredlibrary" output. Thanks, -- Aleksandar Ristovski QNX Software Systems ChangeLog: * nto-tdep.c (nto_relocate_section_address): Adjust so->addr_low and so->addr_high. [-- Attachment #2: nto-tdep.c-addr_low-20090708.diff --] [-- Type: text/x-patch, Size: 571 bytes --] Index: gdb/nto-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/nto-tdep.c,v retrieving revision 1.34 @@ -315,6 +316,10 @@ nto_relocate_section_addresses (struct s sec->addr = nto_truncate_ptr (sec->addr + LM_ADDR (so) - vaddr); sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR (so) - vaddr); + if (so->addr_low == 0) + so->addr_low = LM_ADDR (so); + if (so->addr_high < sec->endaddr) + so->addr_high = sec->endaddr; } /* This is cheating a bit because our linker code is in libc.so. If we ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] nto-tdep.c - adjust addr_low addr_high 2009-07-08 14:27 [patch] nto-tdep.c - adjust addr_low addr_high Aleksandar Ristovski @ 2009-07-21 17:16 ` Aleksandar Ristovski 2009-07-24 15:41 ` Pedro Alves 1 sibling, 0 replies; 5+ messages in thread From: Aleksandar Ristovski @ 2009-07-21 17:16 UTC (permalink / raw) To: gdb-patches ping? Aleksandar Ristovski wrote: > Hello, > > This adjusts so->addr_low and so->addr_high for proper "info > sahredlibrary" output. > > Thanks, > -- Aleksandar Ristovski QNX Software Systems ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] nto-tdep.c - adjust addr_low addr_high 2009-07-08 14:27 [patch] nto-tdep.c - adjust addr_low addr_high Aleksandar Ristovski 2009-07-21 17:16 ` Aleksandar Ristovski @ 2009-07-24 15:41 ` Pedro Alves 2009-07-28 0:09 ` Aleksandar Ristovski 1 sibling, 1 reply; 5+ messages in thread From: Pedro Alves @ 2009-07-24 15:41 UTC (permalink / raw) To: gdb-patches; +Cc: Aleksandar Ristovski On Wednesday 08 July 2009 15:26:55, Aleksandar Ristovski wrote: > This adjusts so->addr_low and so->addr_high for proper "info > sahredlibrary" output. > Index: gdb/nto-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/nto-tdep.c,v > retrieving revision 1.34 > @@ -315,6 +316,10 @@ nto_relocate_section_addresses (struct s > > sec->addr = nto_truncate_ptr (sec->addr + LM_ADDR (so) - vaddr); > sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR (so) - vaddr); > + if (so->addr_low == 0) > + so->addr_low = LM_ADDR (so); Isn't LM_ADDR an offset, not an absolute address? > + if (so->addr_high < sec->endaddr) > + so->addr_high = sec->endaddr; > } > > /* This is cheating a bit because our linker code is in libc.so. If we -- Pedro Alves ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] nto-tdep.c - adjust addr_low addr_high 2009-07-24 15:41 ` Pedro Alves @ 2009-07-28 0:09 ` Aleksandar Ristovski 2009-07-28 11:29 ` Pedro Alves 0 siblings, 1 reply; 5+ messages in thread From: Aleksandar Ristovski @ 2009-07-28 0:09 UTC (permalink / raw) To: Pedro Alves; +Cc: gdb-patches Pedro Alves wrote: > On Wednesday 08 July 2009 15:26:55, Aleksandar Ristovski wrote: > >> This adjusts so->addr_low and so->addr_high for proper "info >> sahredlibrary" output. > >> Index: gdb/nto-tdep.c >> =================================================================== >> RCS file: /cvs/src/src/gdb/nto-tdep.c,v >> retrieving revision 1.34 >> @@ -315,6 +316,10 @@ nto_relocate_section_addresses (struct s >> >> sec->addr = nto_truncate_ptr (sec->addr + LM_ADDR (so) - vaddr); >> sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR (so) - vaddr); >> + if (so->addr_low == 0) >> + so->addr_low = LM_ADDR (so); > > Isn't LM_ADDR an offset, not an absolute address? In our case, it's absolute address of .text (that is why we subtract vaddr as read from phdr). > >> + if (so->addr_high < sec->endaddr) >> + so->addr_high = sec->endaddr; >> } >> >> /* This is cheating a bit because our linker code is in libc.so. If we > Thanks, -- Aleksandar Ristovski QNX Software Systems ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] nto-tdep.c - adjust addr_low addr_high 2009-07-28 0:09 ` Aleksandar Ristovski @ 2009-07-28 11:29 ` Pedro Alves 0 siblings, 0 replies; 5+ messages in thread From: Pedro Alves @ 2009-07-28 11:29 UTC (permalink / raw) To: gdb-patches; +Cc: Aleksandar Ristovski On Monday 27 July 2009 21:54:54, Aleksandar Ristovski wrote: > Pedro Alves wrote: > > On Wednesday 08 July 2009 15:26:55, Aleksandar Ristovski wrote: > > > >> This adjusts so->addr_low and so->addr_high for proper "info > >> sahredlibrary" output. > > > >> Index: gdb/nto-tdep.c > >> =================================================================== > >> RCS file: /cvs/src/src/gdb/nto-tdep.c,v > >> retrieving revision 1.34 > >> @@ -315,6 +316,10 @@ nto_relocate_section_addresses (struct s > >> > >> sec->addr = nto_truncate_ptr (sec->addr + LM_ADDR (so) - vaddr); > >> sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR (so) - vaddr); > >> + if (so->addr_low == 0) > >> + so->addr_low = LM_ADDR (so); > > > > Isn't LM_ADDR an offset, not an absolute address? > > In our case, it's absolute address of .text (that is why we > subtract vaddr as read from phdr). Ah, I see. You always get l_addr from the link map. I take it you mean absolute address of the lowest segment -- if .text isn't the lowest loaded section, then LM_ADDR will be lower than the .text's virtual address in memory, IIUC. Patch is OK. I see now that 'nto-tdep.c:struct lm_info' is a 100% copy of the solib-svr4.c version --- and it has to be so to keep binary compatibility between the modules (why isn't this structure in a shared header, hasn't this been a headache before?) --- but it's comments end up being inaccurate for NTO: /* 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; IIUC, you won't reach solib-svr4.c:LM_ADDR_CHECK's offset computing, or it's warning on nto. lm_info->lm_addr ends up unused too, IIUC. This makes me wonder if there's no better way of implementing (and getting rid of) this NTO overriding of svr4_so_ops, e.g., with a gdbarch property that would be checked on solib-svr4.c:LM_ADDR_CHECK. Anyway, I'm diverging now. > > > >> + if (so->addr_high < sec->endaddr) > >> + so->addr_high = sec->endaddr; > >> } > >> > >> /* This is cheating a bit because our linker code is in libc.so. If we > > -- Pedro Alves ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-28 11:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-07-08 14:27 [patch] nto-tdep.c - adjust addr_low addr_high Aleksandar Ristovski 2009-07-21 17:16 ` Aleksandar Ristovski 2009-07-24 15:41 ` Pedro Alves 2009-07-28 0:09 ` Aleksandar Ristovski 2009-07-28 11:29 ` Pedro Alves
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox