From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Meissner To: Brian Stell Cc: gdb@sources.redhat.com Subject: Re: extending Gdb to display app specific data Date: Fri, 10 Nov 2000 16:14:00 -0000 Message-id: <20001110191444.26019@cse.cygnus.com> References: <3A0B4885.B2384AE7@netscape.com> <200011101039.FAA29785@indy.delorie.com> <3A0C2791.A33BE9AC@ix.netcom.com> <200011102009.PAA00126@indy.delorie.com> <3A0C8E19.A8A6D355@netscape.com> X-SW-Source: 2000-11/msg00081.html 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 >From bstell@netscape.com Fri Nov 10 16:30:00 2000 From: bstell@netscape.com (Brian Stell) To: egcs@cygnus.com Cc: gdb@sources.redhat.com Subject: Re: extending Gdb to display app specific data Date: Fri, 10 Nov 2000 16:30:00 -0000 Message-id: <3A0C935B.AE3C0AF9@netscape.com> References: <3A0B4885.B2384AE7@netscape.com> <200011101039.FAA29785@indy.delorie.com> <3A0C2791.A33BE9AC@ix.netcom.com> <200011102009.PAA00126@indy.delorie.com> <3A0C8E19.A8A6D355@netscape.com> <20001110191444.26019@cse.cygnus.com> X-SW-Source: 2000-11/msg00082.html Content-length: 1741 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? 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