From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86908 invoked by alias); 18 Mar 2015 21:29:21 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 86882 invoked by uid 89); 18 Mar 2015 21:29:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 18 Mar 2015 21:29:19 +0000 Received: by oier21 with SMTP id r21so49442725oie.1; Wed, 18 Mar 2015 14:29:17 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.60.60.71 with SMTP id f7mr31244036oer.0.1426714157234; Wed, 18 Mar 2015 14:29:17 -0700 (PDT) Received: by 10.76.134.102 with HTTP; Wed, 18 Mar 2015 14:29:17 -0700 (PDT) In-Reply-To: <55031C360200007800069EAF@mail.emea.novell.com> References: <550318C90200007800069E5B@mail.emea.novell.com> <55031C360200007800069EAF@mail.emea.novell.com> Date: Wed, 18 Mar 2015 21:29:00 -0000 Message-ID: Subject: Re: RFC: Add support for SHF_COMPRESSED From: "H.J. Lu" To: Jan Beulich Cc: Binutils , GDB Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-03/txt/msg00062.txt.bz2 On Fri, Mar 13, 2015 at 9:19 AM, Jan Beulich wrote: >>>> On 13.03.15 at 17:13, wrote: >> On Fri, Mar 13, 2015 at 9:05 AM, Jan Beulich wrote: >>>>>> On 13.03.15 at 16:31, 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.