* [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
@ 2011-03-23 15:49 Jan Kratochvil
2011-03-23 17:16 ` Roland McGrath
2011-03-23 22:18 ` Ulrich Drepper
0 siblings, 2 replies; 7+ messages in thread
From: Jan Kratochvil @ 2011-03-23 15:49 UTC (permalink / raw)
To: elfutils-devel; +Cc: binutils, gdb-patches
Hi,
the elfutils part.
before the fix:
binary:
[11] .text PROGBITS 00000000100003e0 0003e0 000410 00 AX 0 0 16
[22] .opd PROGBITS 0000000010010ad8 000ad8 0000b8 00 WA 0 0 8
[28] .gnu_debuglink PROGBITS 0000000000000000 000c2c 00001c 00 0 0 4
.debug:
[11] .text NOBITS 00000000100003e0 000250 000410 00 AX 0 0 16
[22] .opd NOBITS 0000000010010ad8 000250 0000b8 00 WA 0 0 8
^^^^^^^^
[30] .debug_info PROGBITS 0000000000000000 0002b1 0000b1 00 0 0 1
after the fix:
binary:
[11] .text PROGBITS 00000000100003e0 0003e0 000410 00 AX 0 0 16
[22] .opd PROGBITS 0000000010010ad8 000ad8 0000b8 00 WA 0 0 8
[28] .gnu_debuglink PROGBITS 0000000000000000 000c2c 00001c 00 0 0 4
.debug:
[11] .text NOBITS 00000000100003e0 000250 000410 00 AX 0 0 16
[22] .opd PROGBITS 0000000010010ad8 000250 0000b8 00 WA 0 0 8
^^^^^^^^
[30] .debug_info PROGBITS 0000000000000000 000369 0000b1 00 0 0 1
The patch has been regression tested on x86_64-fedora14-linux-gnu,
ppc64-rhel61-linux-gnu.
Thanks,
Jan
src/
2011-03-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* strip.c (handle_elf): Provide `.opd' copy for the .debug file.
--- a/src/strip.c
+++ b/src/strip.c
@@ -883,7 +883,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
bool discard_section = (shdr_info[cnt].idx > 0
&& shdr_info[cnt].debug_data == NULL
&& shdr_info[cnt].shdr.sh_type != SHT_NOTE
- && cnt != ehdr->e_shstrndx);
+ && cnt != ehdr->e_shstrndx
+ && strcmp (shdr_info[cnt].name, ".opd") != 0);
/* Set the section header in the new file. */
GElf_Shdr debugshdr = shdr_info[cnt].shdr;
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
2011-03-23 15:49 [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls Jan Kratochvil
@ 2011-03-23 17:16 ` Roland McGrath
2011-03-23 18:05 ` Jan Kratochvil
2011-03-23 22:18 ` Ulrich Drepper
1 sibling, 1 reply; 7+ messages in thread
From: Roland McGrath @ 2011-03-23 17:16 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: elfutils-devel, binutils, gdb-patches
What's the rationale for including the .opd section in the .debug file? It
is really just like any other text or data. Why can't you use the symbols
from the .debug file and read the data from the main file just like you do
for "p initialized_variable" or "disas function" without an inferior?
Thanks,
Roland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
2011-03-23 17:16 ` Roland McGrath
@ 2011-03-23 18:05 ` Jan Kratochvil
2011-03-24 3:09 ` Alan Modra
2011-03-24 10:44 ` Roland McGrath
0 siblings, 2 replies; 7+ messages in thread
From: Jan Kratochvil @ 2011-03-23 18:05 UTC (permalink / raw)
To: Roland McGrath; +Cc: elfutils-devel, binutils, gdb-patches
Hi Roland,
On Wed, 23 Mar 2011 17:47:36 +0100, Roland McGrath wrote:
> What's the rationale for including the .opd section in the .debug file?
the synthetic `.funcname' instructions-pointing symbols are generated on ppc64
by BFD on its own from the function descriptor ELF symbols `funcname'.
(DWARF symbols `funcname' point to the instructions which may be confusing.)
BFD has no idea about the linkage of the binary and the .debug BFD files.
Only GDB connects the binary and the .debug BFD files content for the user.
IIUC there would be needed some new API part to generate the synthetic symbols
in cooperation with GDB providing the BFD files .debug_link read out linkage
to the BFD synthetic functions producer.
> It is really just like any other text or data.
I agree it is only a workaround of the BFD design. For libc.so.6 2172512
bytes the .opd section is 42472 bytes (1.95%).
> Why can't you use the symbols
> from the .debug file and read the data from the main file just like you do
> for "p initialized_variable" or "disas function" without an inferior?
`p'/`disas' are GDB functionality. `.funcname' symbols are BFD functionality.
Thanks,
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
2011-03-23 18:05 ` Jan Kratochvil
@ 2011-03-24 3:09 ` Alan Modra
2011-04-04 11:19 ` obsolete: " Jan Kratochvil
2011-03-24 10:44 ` Roland McGrath
1 sibling, 1 reply; 7+ messages in thread
From: Alan Modra @ 2011-03-24 3:09 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Roland McGrath, elfutils-devel, binutils, gdb-patches
On Wed, Mar 23, 2011 at 06:21:32PM +0100, Jan Kratochvil wrote:
> BFD has no idea about the linkage of the binary and the .debug BFD files.
> Only GDB connects the binary and the .debug BFD files content for the user.
I think the correct fix is for gdb to use the binary bfd when calling
get_synthetic_symtab. That isn't as simple as it sounds, because you
obviously need to use symbols from the debug info file. See oprofile
code handling exactly this situation in libutils++/bfd_support.cpp.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 7+ messages in thread
* obsolete: Re: [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
2011-03-24 3:09 ` Alan Modra
@ 2011-04-04 11:19 ` Jan Kratochvil
0 siblings, 0 replies; 7+ messages in thread
From: Jan Kratochvil @ 2011-04-04 11:19 UTC (permalink / raw)
To: elfutils-devel, binutils; +Cc: Roland McGrath, gdb-patches
On Thu, 24 Mar 2011 00:30:21 +0100, Alan Modra wrote:
> I think the correct fix is for gdb to use the binary bfd when calling
> get_synthetic_symtab. That isn't as simple as it sounds, because you
> obviously need to use symbols from the debug info file. See oprofile
> code handling exactly this situation in libutils++/bfd_support.cpp.
thanks for the advice, implemented now only in GDB as:
[patch 0/3 ppc64] eu-strip vs. func addresses for GDB inferior calls #2
http://sourceware.org/ml/gdb-patches/2011-04/msg00045.html
therefore this former elfutils + binutils patchset [2/3]+[3/3] is now obsolete.
Regards,
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
2011-03-23 18:05 ` Jan Kratochvil
2011-03-24 3:09 ` Alan Modra
@ 2011-03-24 10:44 ` Roland McGrath
1 sibling, 0 replies; 7+ messages in thread
From: Roland McGrath @ 2011-03-24 10:44 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: elfutils-devel, binutils, gdb-patches
> the synthetic `.funcname' instructions-pointing symbols are generated on ppc64
> by BFD on its own from the function descriptor ELF symbols `funcname'.
I see. There were previous variants of the ppc64 tools (and perhaps
still are modes) in which actual .funcname symbols were defined as
well. I suspect that history is why BFD is organized this way.
> (DWARF symbols `funcname' point to the instructions which may be confusing.)
It is confusing if you use a noncanonical term like "DWARF symbol". In
DWARF, there are well-defined entities like DIEs that have well-defined
attributes that are specifically about PC values, and so none of that is
confusing on its own. It is just wrong to imagine that DWARF defines
something called a symbol that is akin to an ELF symbol.
> I agree it is only a workaround of the BFD design.
Then BFD should just be fixed.
Alan surely knows more about this particular stuff than anyone else.
His suggestions about BFD and GDB internals are probably the most useful.
Thanks,
Roland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls
2011-03-23 15:49 [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls Jan Kratochvil
2011-03-23 17:16 ` Roland McGrath
@ 2011-03-23 22:18 ` Ulrich Drepper
1 sibling, 0 replies; 7+ messages in thread
From: Ulrich Drepper @ 2011-03-23 22:18 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: elfutils-devel, binutils, gdb-patches
On Wed, Mar 23, 2011 at 11:29, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> @@ -883,7 +883,8 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
> bool discard_section = (shdr_info[cnt].idx > 0
> && shdr_info[cnt].debug_data == NULL
> && shdr_info[cnt].shdr.sh_type != SHT_NOTE
> - && cnt != ehdr->e_shstrndx);
> + && cnt != ehdr->e_shstrndx
> + && strcmp (shdr_info[cnt].name, ".opd") != 0);
PPC-specific code has no place in the generic strip code.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-04 11:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 15:49 [2/3, ppc64, elfutils patch] eu-strip vs. func addresses for GDB inferior calls Jan Kratochvil
2011-03-23 17:16 ` Roland McGrath
2011-03-23 18:05 ` Jan Kratochvil
2011-03-24 3:09 ` Alan Modra
2011-04-04 11:19 ` obsolete: " Jan Kratochvil
2011-03-24 10:44 ` Roland McGrath
2011-03-23 22:18 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox