This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: extending Gdb to display app specific data


bstell@netscape.com (Brian Stell) writes:

> So how do we do this without requiring the end
> user to know the exact data type of a variable
> in any routine they pass thru and without requiring
> the end user memorize the routine names?

Um, use a single routine name, overloaded for the data types you want
to print?
You did say you were using C++, right?

> 
> Michael Meissner wrote:
> 
> > On Fri, Nov 10, 2000 at 04:08:57PM -0800, Brian Stell wrote:
> > > We all agree that gdb by itself cannot display every data
> > > type that will come along.
> > >
> > > What I'm looking for is a way for an expert user to tell
> > > gdb how to display a given type. This way within a
> > > community of developers the expert users can setup
> > > display routines for the complex data types in that
> > > environment and everyone else can view the data
> > > in gdb.
> > >
> > > For example, in the Mozilla development world there are a
> > > large number of developers and a variety of string formats
> > > (PRUnichar=UTF16, nsString=C++ object, etc.) and more
> > > are expected in the future (e.g.: a compressed format).
> > >
> > > It is easy to say RTFM but it would be more effective
> > > to say "copy this file to your home dir".
> >
> > Do like GCC does and include functions in your code that take your type as an
> > argument, and print the type in question to stdout (or stderr).  For example
> > within gcc, there is debug_rtx, which takes a rtx pointer, and prints out the
> > value in tree format, and similarly debug_tree which does it for tree nodes.
> > To further enhance the debugging experience, the .gdbinit command includes
> > several shortcuts (like pr/pt) that pass the last value to the above
> > functions.
> >
> > --
> > Michael Meissner, Red Hat, Inc.
> > PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
> > Work:     meissner@redhat.com           phone: +1 978-486-9304
> > Non-work: meissner@spectacle-pond.org   fax:   +1 978-692-4482


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]