Doug Evans | 1 Aug 2008 02:28
Picon
Favicon

Re: Tasks

On Thu, Jul 31, 2008 at 12:57 PM, Thiago Jung Bauermann
<bauerman@...> wrote:
> On Tue, 2008-07-29 at 13:46 -0600, Tom Tromey wrote:
>> >>>>> "Mark" == Mark Wielaard <mark@...> writes:
>>
>> Mark> Maybe a nice "little" task to investigate is the catch syscall
>> Mark> support.  That might give someone a "simple" entry into the gdb
>> Mark> catch mechanism.  (little and simple in quotes, since I didn't
>> Mark> actually investigate myself much)
>>
>> I think this is a very interesting idea.
>>
>> Offhand I would say, those of us at Red Hat already have a full list
>> with stuff just directly related to C++.  Maybe somebody else could
>> implement this :-)
>
> I'm considering this. For a first step, we could catch the syscall but
> not interpret the arguments.
>
> There's the question of how GDB would know about the syscall arguments.
> Kernel debuginfo? That's the cleanest solution I think. But I don't know
> if such debuginfo exists today.

I can imagine there being multiple applications that would like this
info.  Can we start our own libstrace (or some such) and have gdb use
that?

Daniel Jacobowitz | 1 Aug 2008 03:38

Syscall tracing

On Thu, Jul 31, 2008 at 05:28:25PM -0700, Doug Evans wrote:
> I can imagine there being multiple applications that would like this
> info.  Can we start our own libstrace (or some such) and have gdb use
> that?

Once upon a time, there was going to be an strace2 and it was going to
work pretty much like this.  It never came to be, though :-(

In my opinion, the only important thing here is the data.  Strace has
a copy, but not in an extractable format; much of it is custom C.
What it needs is a more data-driven display format.  Then consumers
can do with it what they will.

Perhaps it could be done as C or at least C-like?  If GCC passed
special attributes into debug info, that'd be one way to produce
useful input to GDB describing the types.  Another way would be a
scripted parser for the necessary (very small) subset of C.

__bitwise_combinable enum open_flags_t {
  O_APPEND = 1,
  O_ASYNC = 2
};

int __fd_or_error open (const char *pathname __filename,
                        open_flags_t flags, mode_t mode);

--

-- 
Daniel Jacobowitz
CodeSourcery

(Continue reading)

Daniel Jacobowitz | 1 Aug 2008 03:50

Re: FYI GDB on-disk .debug cache (mmapcache) [Re: Tasks]

On Thu, Jul 31, 2008 at 09:22:18PM +0200, Jan Kratochvil wrote:
> > Jan> dwarf2_build_psymtabs_easy() should have been using the index
> > Jan> sections like `.debug_pubnames' but GDB has it #if 0-ed.  IIRC
> > Jan> GDB currently builds its psymtab entries even for `static'
> > Jan> variables across files while the C semantics says these are not
> > Jan> visible.  `.debug_pubnames' correctly does not contain the
> > Jan> `static' variables making dwarf2_build_psymtabs_easy() either
> > Jan> impossible or changing the current GDB behavior.
> > 
> > I'm reluctant to change gdb behavior for something like this; I assume
> > that users would complain.  I'm not absolutely opposed, though.
> 
> It is already related to resolve a name in multiple files, currently not being
> solved in HEAD.  What if it is also a local nested function?  Do we always
> want to silently hide the definitions outside of the local block?

In my experience, the most important case are static
variables/functions whose names are actually unique across the
program.  This happens a lot and it's convenient that GDB knows what
you're referring to right away.

> Just a question if psymtabs are enough?  IMO sooner or later symtabs get
> loaded but I have no benchmarks for it.  I would find best to run asynchronous
> --readnow during the startup (when we have the asynchronous GDB mode now).

There's a command, maint print statistics, which can show you how many
unexpanded psymtabs there are and how many were expanded into full
symtabs.  It should not be too hard to collect data if you can manage
some "typical" debugging sessions - for instance a couple of "bt full"
in firefox or OOo.
(Continue reading)

Roland McGrath | 1 Aug 2008 04:11
Picon
Favicon

DWARF compaction

> This is not really GCC (I think it can be done in the linker): word on
> the street is that for C++ programs, GCC generates a lot of duplicate
> debuginfo, especially for header files. DWARF has mechanisms to avoid
> such duplication. I'd like to investigate more about this and see what
> can be done...

This subject is well-understood among DWARF experts and the solutions long
planned.  Indeed the great bulk of the work here is on the producer side.
There are ways that involve new compiler and linker smarts cooperating
(this scheme is described in an appendix to the DWARF spec), as well as
ways done in a pure post-processing step without the compiler or linker
doing anything different (though post-processing integrated into linking is
also an offshoot of this option).

I think we at Red Hat will (finally) be ramping up on working on this soon.
Our first tack will be pure post-processing, which is what we need for
other reasons anyway.  We're planning to implement this in elfutils, not in
the BFD/binutils universe.  If you want to do DWARF-rewriting in BFD, knock
yourself out.  

The DWARF-appendix/Sun plan using compiler-generated section groups
and linker features might also not be that hard to get going, if you
wanted to take that tack.  That might exercise the linker in new ways
that need a little work, but most of the work is in the compiler.  (We
need the post-processing approach for other purposes anyway, so we're
not planning to work on this route.)

We don't really need to get into all the details of the producer-side
implementation plans here.  All those plans produce the same kind of
results in the final DWARF format, which is stuff already described
(Continue reading)

Daniel Jacobowitz | 1 Aug 2008 04:23

Re: DWARF compaction

On Thu, Jul 31, 2008 at 07:11:08PM -0700, Roland McGrath wrote:
> What GDB needs to do is cope with all the new wrinkles of the DWARF
> format that can be used in the most optimally compact encodings.
> These are mainly ref_addr, partial_unit, imported_unit, and not
> getting confused about semantics of inter-CU pointers in the DIEs.
> 
> You can sort of work on this in parallel, though it's a bit hard to
> finish any new support when you don't have anything that produces that
> format to test it with.

FYI, GDB should work with this already.  I've tested it both with a
GCC mode that uses it lightly for duplicate elimination, plus with
proprietary compilers like RealView.  Of course, every new producer
causes unique problems.  Of your list, imported units are the only
ones likely to be any trouble.

--

-- 
Daniel Jacobowitz
CodeSourcery

Roland McGrath | 1 Aug 2008 04:28
Picon
Favicon

Re: Syscall tracing

I consider this just a special case of pretty printing.  The registers at
syscall entry/exit are a record of a giant variant record type, with the
syscall number register as its top-level variant discriminator.

There are two pieces to helpful examination/display of the data.  The first
piece is the physical layout of data types in memory.  The second piece is
displaying that in a semantically helpful form.  (I promise I'll replace
"semantically helpful" with "pretty" from now on, like a normal person.)

To pretty-print an object of a type defined by some DSO, for the first
piece we use the DWARF type descriptions that encode the ABI's layout,
names, and types.  I'd always figured this is the right thing to do for the
syscall ABI too.  This enables not just pretty-printing, but using the
details in expression evaluation, GUI data inspectors, etc.

So that unifies the second piece with the general pretty-printing issue.
The kernel delivering its syscall ABI and how to make that pretty is just
like some user libraries delivering its DSO ABIs and how to make that data
pretty.

Thanks,
Roland

Cary Coutant | 1 Aug 2008 18:57
Picon
Favicon

Re: DWARF compaction

> This subject is well-understood among DWARF experts and the solutions long
> planned.  Indeed the great bulk of the work here is on the producer side.
> There are ways that involve new compiler and linker smarts cooperating
> (this scheme is described in an appendix to the DWARF spec), as well as
> ways done in a pure post-processing step without the compiler or linker
> doing anything different (though post-processing integrated into linking is
> also an offshoot of this option).

I've actually been working on this problem recently, and I submitted a
draft proposal last month to the DWARF workgroup to add features that
allow each type to be placed in its own comdat section, using an MD5
hash of the type info as a type signature. Apple apparently tried
something similar a couple of years ago, but it looks like they've
given up on it. I'm very nearly done with a gcc patch to try this out
and see how much space I can really save.

The solution described in the DWARF appendix is, I believe, already
implemented in gcc as -fdwarf2-eliminate-dups, but it doesn't appear
to have ever gained much traction, and gdb may not yet work well with
the result. When I was at HP, we considered implementing this scheme,
but found a couple of problems. In order for the per-header debug
information to truly be identical across compilations, the compiler is
obligated to output the debug info for all declarations in the header
file. Even though it may result in a significant space savings in the
final executable, it still results in a significant (and, in our
opinion, unacceptable) extra cost in the size of the relocatables. In
addition, #ifdefs within the header file often caused the information
to differ across compilations anyway, reducing the effectiveness of
the comdat elimination.

(Continue reading)

Tom Tromey | 5 Aug 2008 00:14
Picon
Favicon

Archer git repository

I've set up the Archer git repository.  It is available by cloning:

    git://sourceware.org/git/archer.git
    ssh://sourceware.org/git/archer.git

You can also see the repository using gitweb:

    http://sourceware.org/git/gitweb.cgi?p=archer.git

I made a new 'archer' branch which is where I think our "trunk" will
be.  After cloning you can switch to this branch:

    git checkout --track -b archer origin/archer

I think we should treat all the other existing branches as pristine.
Someone (me for starters) will fetch from gdb periodically and merge
gdb's master to archer's master.  We can also merge master->archer
whenever we feel the need.  The current archer branch was simply based
on the gdb master at the time I made the branch -- i.e., some random
snapshot.  (Also, we can merge over other gdb branches if we care.)

In case you want to fetch from gdb, here is what I did:

    git remote add gdb git://sourceware.org/git/gdb.git
    git fetch gdb

I think it would make sense to put all our branches, whatever they
are, under "archer".  Also, I encourage folks to make personal
branches under here, using your login in the branch name.  For
experimentation and hacking purposes, I think it makes a lot of sense
(Continue reading)

Tom Tromey | 5 Aug 2008 00:36
Picon
Favicon

Archer patch tester

In case you're interested, I've set up a patch tester for archer and
gdb.  It runs on the GCC Compile Farm:

    http://gcc.gnu.org/wiki/CompileFarm

The tester is open to anybody working on archer or gdb; if you want to
use it you will have to get a compile farm account.

The tester itself is a modified version of Sebastian Pop's GCC
tester.  I've attached this script in case anybody wants to run their
own patch tester somewhere.

The client side consists of two scripts -- mkdiff and submit-patch.

The first is a wrapper for "git diff" (more complicated than needed
since I based it on a similar script for GCC).  It makes a diff and
inserts some metadata; if you need special build flags you can provide
them at this point.

The second script copies a mkdiff-created patch to the compile farm.
After this step you will get a confirmation email; then once the
build/regression-test cycle is done you will get an email with the
results.

Uploads to the tester are done using ssh.  Please be careful about
what patches you upload; in particular, don't upload untrusted
patches.

Tom

(Continue reading)

Tom Tromey | 5 Aug 2008 01:00
Picon
Favicon

Re: Archer git repository

Tom> I've set up the Archer git repository.  It is available by cloning:
Tom>     git://sourceware.org/git/archer.git
Tom>     ssh://sourceware.org/git/archer.git

Just FYI -- something is wrong here since libgui is not building.
I'm not sure what happened but I will figure it out.
It seems to be something missing in the upstream git repository.

Tom


Gmane