public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Collecting description of types from symbol table
@ 2012-03-02  2:57 Vimal
  2012-03-05 16:36 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Vimal @ 2012-03-02  2:57 UTC (permalink / raw)
  To: gdb

I would like to dump the collect the output of the "ptype" command for
all possible types that gdb is aware of.

For example, the following output is very useful when debugging the
kernel, and I would like to collect the output of all such types in
the kernel for reference.   Could someone tell me rough ideas of how
this is stored in the executable, and how to dump this?

(gdb) ptype raw_spinlock_t
type = struct raw_spinlock {
    arch_spinlock_t raw_lock;
    unsigned int magic;
    unsigned int owner_cpu;
    void *owner;
    struct lockdep_map dep_map;
}

Thanks,
-- 
Vimal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Collecting description of types from symbol table
  2012-03-02  2:57 Collecting description of types from symbol table Vimal
@ 2012-03-05 16:36 ` Tom Tromey
  2012-03-06 23:16   ` Vimal
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2012-03-05 16:36 UTC (permalink / raw)
  To: Vimal; +Cc: gdb

>>>>> "Vimal" == Vimal  <j.vimal@gmail.com> writes:

Vimal> I would like to dump the collect the output of the "ptype" command for
Vimal> all possible types that gdb is aware of.

Vimal> For example, the following output is very useful when debugging the
Vimal> kernel, and I would like to collect the output of all such types in
Vimal> the kernel for reference.   Could someone tell me rough ideas of how
Vimal> this is stored in the executable, and how to dump this?

Usually it is stored in DWARF format.
See http://dwarfstd.org/

Iterating over all the types, in gdb, is not trivial.
It could be done but you will have to write some C code to do it.

The 7 dwarves project would be an ok place to start for this though.
pahole nearly does it already.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Collecting description of types from symbol table
  2012-03-05 16:36 ` Tom Tromey
@ 2012-03-06 23:16   ` Vimal
  2012-03-07  3:15     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Vimal @ 2012-03-06 23:16 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb

Hi Tom,

On 5 March 2012 08:36, Tom Tromey <tromey@redhat.com> wrote:
>
> Usually it is stored in DWARF format.
> See http://dwarfstd.org/
>
> Iterating over all the types, in gdb, is not trivial.
> It could be done but you will have to write some C code to do it.

DWARF standard pointed me to dwarfdump, which seems to dump the type
information stored in an object file.

> The 7 dwarves project would be an ok place to start for this though.
> pahole nearly does it already.

pahole is interesting, but it looks like its repository on kernel.org
is down.  I'll contact the author.

Thanks!
-- 
Vimal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Collecting description of types from symbol table
  2012-03-06 23:16   ` Vimal
@ 2012-03-07  3:15     ` Tom Tromey
  2012-03-08 16:51       ` Vimal
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2012-03-07  3:15 UTC (permalink / raw)
  To: Vimal; +Cc: gdb

>>>>> "Vimal" == Vimal  <j.vimal@gmail.com> writes:

Vimal> DWARF standard pointed me to dwarfdump, which seems to dump the type
Vimal> information stored in an object file.

You probably already have readelf, eu-readelf, and/or objdump installed
on your system, all of which can dump DWARF.  They don't emit it in C
style though.

Vimal> pahole is interesting, but it looks like its repository on kernel.org
Vimal> is down.  I'll contact the author.

Most distros package it.

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Collecting description of types from symbol table
  2012-03-07  3:15     ` Tom Tromey
@ 2012-03-08 16:51       ` Vimal
  0 siblings, 0 replies; 5+ messages in thread
From: Vimal @ 2012-03-08 16:51 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb

On 6 March 2012 19:14, Tom Tromey <tromey@redhat.com> wrote:
> Vimal> pahole is interesting, but it looks like its repository on kernel.org
> Vimal> is down.  I'll contact the author.
>
> Most distros package it.

Thanks, I found it in dwarves package on Debian.

-- 
Vimal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-08 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-02  2:57 Collecting description of types from symbol table Vimal
2012-03-05 16:36 ` Tom Tromey
2012-03-06 23:16   ` Vimal
2012-03-07  3:15     ` Tom Tromey
2012-03-08 16:51       ` Vimal

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).