From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9931 invoked by alias); 14 Nov 2012 19:37:16 -0000 Received: (qmail 9920 invoked by uid 22791); 14 Nov 2012 19:37:15 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-lb0-f201.google.com (HELO mail-lb0-f201.google.com) (209.85.217.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Nov 2012 19:37:10 +0000 Received: by mail-lb0-f201.google.com with SMTP id m4so62926lbo.0 for ; Wed, 14 Nov 2012 11:37:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:mime-version:content-type:content-transfer-encoding:message-id :date:to:cc:subject:in-reply-to:references:x-mailer :x-gm-message-state; bh=weUEt/1KooBWzUPl3OFn7MjGNy44gTNTmqYWD81woOU=; b=pYgns6f07U7ZS2k0awNpkHPZ53mtmzp9X8asM+uEPMAf1RyqAVfTlTHjJ5qo9Kn/9q jPIw8C7SqxpQQyRItm9wXxa+1a6WscG18dFVSHi45oUX2H0HAeyWpyj/L8aG+48Ub9Ga gEGYUkLx1HRKAEhg+r6t0TCQVbLEQcI93n+t/AsMpsHCQ+eLNMVAdEWqre00ifKfFQfy PdBbKEJ9dHOQzmkmfVaVMgCG+qifoDlOitItgK3ITVJsvcVSlUZfwqi2Ii6QMIY25awQ MRVs1TkFJ33Il64mwID88YE51cQtS+4nsPpM+jLQk3WbZ7YDL+kF+tWCY81SLPlH56MJ Qb3w== Received: by 10.14.204.3 with SMTP id g3mr28099058eeo.7.1352921828072; Wed, 14 Nov 2012 11:37:08 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id z47si3324974eel.0.2012.11.14.11.37.08 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 14 Nov 2012 11:37:08 -0800 (PST) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.17.128.107]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 73EAE20004E; Wed, 14 Nov 2012 11:37:06 -0800 (PST) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20643.62177.106208.211209@ruffy2.mtv.corp.google.com> Date: Wed, 14 Nov 2012 19:37:00 -0000 To: Tom Tromey Cc: Pedro Alves , gdb-patches@sourceware.org Subject: Re: RFA: handle "MiniDebuginfo" section In-Reply-To: <87390c40ys.fsf@fleche.redhat.com> References: <87wqxuel5k.fsf@fleche.redhat.com> <87zk2mbym3.fsf@fleche.redhat.com> <877gpp8i67.fsf@fleche.redhat.com> <50A29B8B.7050606@redhat.com> <87r4nx5ih1.fsf@fleche.redhat.com> <87390c40ys.fsf@fleche.redhat.com> X-Gm-Message-State: ALoCoQmWshte58zp4EWdP6V+ZN3WA/NeItBbW4Hv2oU6UI9xfIBrJvINEj+6o/4Vxl2wb63Ll8nY6dZG92FFr7c9t+aCCPNeO8WQWm5ZvjxaWzEZcfh7Szd6x0uO8Az6tshVcKe9dLuYehCYq8EfYEmJiyCL8qjEBGYad0+HObRLawzyK2QVvdncT29xjjCvbP93wQZM6WQQyna27YKsDNxabi8yIa9W/w== X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00384.txt.bz2 Tom Tromey writes: > Tom> Here's the revised. > > I caught one little problem -- I had used gdb_test_multiple in an > earlier revision and forgot to change it back. This lead to a test > failure. Sigh. > > This version also changes some "verbose -log" calls back to "verbose", > to avoid cluttering up the .log file unnecessarily. > > Finally, I was curious about the test coverage; this pointed out that > the _close function was not being tested, so I added a test for that. > There are still a few spots in the new file that aren't covered, but > mostly errors, and I'm not as interested in testing all those. > > Tom > > 2012-11-14 Alexander Larsson > Jan Kratochvil > Tom Tromey > > * NEWS: Mention mini debuginfo feature. > * minidebug.c: New file. > * configure.ac: Check for lzma. > * configure, config.in: Rebuild. > * Makefile.in (LIBLZMA): New variable. > (CLIBS): Include LIBLZMA. > (SFILES): Mention minidebug.c. > (COMMON_OBS): Mention minidebug.o. > * symfile.c (read_symbols): New function. > (syms_from_objfile, reread_symbols): Call it. > * symfile.h (find_separate_debug_file_in_section): Declare. > > 2012-11-14 Tom Tromey > > * gdb.texinfo (MiniDebugInfo): New node. > (GDB Files): Update. > > 2012-11-14 Jan Kratochvil > Tom Tromey > > * gdb.base/gnu-debugdata.exp: New file. > * gdb.base/gnu-debugdata.c: New file. > * lib/gdb.exp (gdb_file_cmd): Handle LZMA warning. > (gdb_unload): Return 0 on success. Hi. A couple of comments. 1) Being more of a minimalist when it comes to adding new stuff, and applying "It's easier to relax restrictions than impose them after the fact." it would be easy enough to restrict the section to being an (lzma-compressed) ELF file (and equally easy to relax the restriction if someone ever presented a compelling reason to support it). Sure, we *can* support COFF, etc. but that doesn't, to me, mean we *should*. Does Redhat have a *formal* spec of .gnu_debugdata that says COFF, etc. is supported. [If that's the case then my point is moot, but I couldn't find any such formal spec.] 2) Can you add something like the following to the docs? This section is an LZMA compressed ELF file containing the standard ELF symbol and DWARF sections. It needn't, but may, contain full debug info. The intent is that it contains the desired subset of debug info that makes things like backtracing work without making the file too large. The point being the current docs say what .gnu_debugdata *does*, but it doesn't formally and completely say what it *is*. "LZMA-compressed object" leaves me guessing too much at the details. By the way, strip -g should remove .gnu_debugdata. I only skimmed subject lines of recent messages to binutils@ to see if a patch has been submitted, and I just checked cvs head. > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 86cfe8e..224bdbf 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -15865,6 +15865,7 @@ program. To debug a core dump of a previous run, you must also tell > @menu > * Files:: Commands to specify files > * Separate Debug Files:: Debugging information in separate files > +* MiniDebugInfo:: Debugging information in a special section > * Index Files:: Index files speed up GDB > * Symbol Errors:: Errors reading symbol files > * Data Files:: GDB data files > @@ -16790,6 +16791,55 @@ gnu_debuglink_crc32 (unsigned long crc, > @noindent > This computation does not apply to the ``build ID'' method. > > +@node MiniDebugInfo > +@section Debugging information in a special section > +@cindex separate debug sections > +@cindex @samp{.gnu_debugdata} section > + > +Some systems ship pre-built executables and libraries that have a > +special @samp{.gnu_debugdata} section. This feature is called > +@dfn{MiniDebugInfo}. This section holds an LZMA-compressed object and > +is used to supply extra symbols for backtraces. > + > +The intent of this section is to provide extra minimal debugging > +information for use in simple backtraces. It is not intended to be a > +replacement for full separate debugging information (@pxref{Separate > +Debug Files}). The example below shows the intended use; however, > +@value{GDBN} does not currently put restrictions on what sort of > +debugging information might be included in the section. > + > +@value{GDBN} has support for this extension. If the section exists, > +then it is used provided that no other source of debugging information > +can be found, and that @value{GDBN} was configured with LZMA support. > + > +This section can be easily created using @command{objcopy} and other > +standard utilities: > + > +@smallexample > +# Extract the dynamic symbols from the main binary, there is no need > +# to also have these in the normal symbol table > +nm -D @var{binary} --format=posix --defined-only \ > + | awk '@{ print $1 @}' | sort > dynsyms > + > +# Extract all the text (i.e. function) symbols from the debuginfo . > +nm @var{binary} --format=posix --defined-only \ > + | awk '@{ if ($2 == "T" || $2 == "t") print $1 @}' \ > + | sort > funcsyms > + > +# Keep all the function symbols not already in the dynamic symbol > +# table. > +comm -13 dynsyms funcsyms > keep_symbols > + > +# Copy the full debuginfo, keeping only a minimal set of symbols and > +# removing some unnecessary sections. > +objcopy -S --remove-section .gdb_index --remove-section .comment \ > + --keep-symbols=keep_symbols @var{binary} mini_debuginfo > + > +# Inject the compressed data into the .gnu_debugdata section of the > +# original binary. > +xz mini_debuginfo > +objcopy --add-section .gnu_debugdata=mini_debuginfo.xz @var{binary} > +@end smallexample