public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>, GDB <gdb@sourceware.org>
Subject: Re: RFC: Add support for SHF_COMPRESSED
Date: Wed, 18 Mar 2015 21:29:00 -0000	[thread overview]
Message-ID: <CAMe9rOqR4tgNr9CvZXoGsO4ASxZyaAp47J4DL=VNtC9AuLYKGA@mail.gmail.com> (raw)
In-Reply-To: <55031C360200007800069EAF@mail.emea.novell.com>

On Fri, Mar 13, 2015 at 9:19 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 13.03.15 at 17:13, <hjl.tools@gmail.com> wrote:
>> On Fri, Mar 13, 2015 at 9:05 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>> On 13.03.15 at 16:31, <hjl.tools@gmail.com> wrote:
>>>> I am working on SHF_COMPRESSED support:
>>>>
>>>> http://www.sco.com/developers/gabi/latest/ch4.sheader.html
>>>>
>>>> We already have .zdebug* sections, which aren't compatible
>>>> with SHF_COMPRESSED scheme due to missing compression
>>>> header.   What section names should we use for SHF_COMPRESSED
>>>> debug sections.  Using .debug* or .zdebug*  will break existing tools.
>>>> I am thinking .zlibdebug*  or ..Zdebug*.  Any suggestions?
>>>
>>> Why would they need to have different names anyway? They're
>>> distinguishable by the flag.
>>
>> Won't the exiting tools, like GDB, choke on compressed .debug* sections?
>
> If they're well behaved, they shouldn't (they should just ignore
> them).
>

I implemented SHF_COMPRESSED on users/hjl/compressed
branch. The old gdb doesn't understand SHF_COMPRESSED:

Reading symbols from bfd.gz...Dwarf Error: wrong version in
compilation unit header (is 136, should be 2, 3, or 4) [in module
/export/home/hjl/bugs/binutils/compressed-2/bfd.gz]
(no debugging symbols found)...done.
(gdb)

and the new gdb works fine:

Reading symbols from gold.gz...done.
(gdb) b main
Breakpoint 1 at 0x400450: file x.c, line 6.
(gdb) r
Starting program: /export/home/hjl/bugs/binutils/compressed-2/gold.gz

Breakpoint 1, main () at x.c:6
6  printf ("hello world\n");
(gdb)

I added --compressed-debug-sections=[none|zlib] to as and
objcopy.  I updated gold to decompress SHF_COMPRESSED
section.  I didn't add --compressed-debug-sections=[none|zlib]
to gold since I don't know if this name is a final choice nor
gold maintainers want such an option.

I wrote some as/objcopy tests:

[hjl@gnu-6 compressed-1]$ make
./as --x32 --nocompress-debug-sections -o x.o x.s
./as --x32 --compressed-debug-sections=zlib -o compressed0.o x.s
./objcopy --compressed-debug-sections=zlib x.o compressed.o
cmp compressed.o compressed0.o
./as --x32 --compress-debug-sections -o compress0.o x.s
./objcopy --compress-debug-sections x.o compress.o
cmp compress.o compress0.o
./objcopy --compressed-debug-sections=none x.o decompressed.o
cmp x.o decompressed.o
./objcopy --compressed-debug-sections=none compressed.o decompressed.o
cmp compressed.o decompressed.o
./objcopy --compressed-debug-sections=none compress.o decompressed.o
cmp compress.o decompressed.o
./objcopy --decompress-debug-sections compressed.o decompressed.o
cmp x.o decompressed.o
./objcopy --decompress-debug-sections compress.o decompressed.o
cmp x.o decompressed.o
cp x.o y.o
ar rv libx.a y.o
ar: creating libx.a
a - y.o
ar rc libx.a y.o
./objcopy --compressed-debug-sections=zlib x.o compressed1.o
cmp compressed1.o compressed.o
./objcopy --compressed-debug-sections=zlib compress.o compressed2.o
cmp compressed2.o compressed.o
./objcopy --compress-debug-sections compressed.o compresse1.o
cmp compresse1.o compress.o
./objcopy --compressed-debug-sections=zlib libx.a liby.a
ar xv liby.a y.o
x - y.o
cmp y.o compressed.o
./objcopy --compress-debug-sections liby.a
ar xv liby.a y.o
x - y.o
cmp y.o compress.o
./objcopy --compressed-debug-sections=zlib liby.a
ar xv liby.a y.o
x - y.o
cmp y.o compressed.o
./objcopy --decompress-debug-sections liby.a
ar xv liby.a y.o
x - y.o
cmp y.o decompressed.o
[hjl@gnu-6 compressed-1]$

and ld/gold/gdb tests:

gcc -mx32 -B./ -g -Wa,--compressed-debug-sections=zlib -c x.c -o x.o
gcc -mx32 -B./ -o bfd x.o -fuse-ld=bfd
gcc -mx32 -B./ -o gold x.o -fuse-ld=gold
./objcopy --compressed-debug-sections=zlib gold gold.gz
./objcopy --compressed-debug-sections=zlib bfd bfd.gz
./gdb -batch -x gdb.cmd bfd.gz
Breakpoint 1 at 0x4003b0: file x.c, line 6.

Breakpoint 1, main () at x.c:6
6  printf ("hello world\n");
A debugging session is active.

Inferior 1 [process 5951] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
./gdb -batch -x gdb.cmd gold.gz
Breakpoint 1 at 0x400450: file x.c, line 6.

Breakpoint 1, main () at x.c:6
6  printf ("hello world\n");
A debugging session is active.

Inferior 1 [process 5962] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]
[hjl@gnu-6 compressed-2]$

Any feedbacks?

Thanks.

-- 
H.J.

  reply	other threads:[~2015-03-18 21:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 15:31 H.J. Lu
2015-03-13 16:05 ` Jan Beulich
2015-03-13 16:13   ` H.J. Lu
2015-03-13 16:19     ` Jan Beulich
2015-03-18 21:29       ` H.J. Lu [this message]
2015-03-19 18:19         ` Cary Coutant
2015-03-19 18:50           ` H.J. Lu
2015-03-20  9:01           ` Pedro Alves
2015-03-20 12:07             ` H.J. Lu
2015-03-20 13:36               ` H.J. Lu
2015-03-23 12:31                 ` H.J. Lu

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='CAMe9rOqR4tgNr9CvZXoGsO4ASxZyaAp47J4DL=VNtC9AuLYKGA@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=gdb@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).