🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Igor Metz Wed, 09 Aug 1989 15:24
missing documentation
#231
Author: Igor Metz
Date: Wed, 09 Aug 1989 15:24
128 lines
3861 bytes
The GDB Manual for version 3.2 doesn't mention
	set prettyprint
and
	set unionprint

A patch is included below.

Igor Metz                    X400: metz@iam.unibe.ch
Institut fuer Informatik     ARPA: metz%iam.unibe.ch@relay.cs.net
und angewandte Mathematik    UUCP: ..!uunet!mcvax!iam.unibe.ch!metz
Universitaet Bern
Switzerland		     Phone: (+41) 31 65 49 90

*** gdb.texinfo.old	Wed Aug  9 15:11:42 1989
--- gdb.texinfo	Wed Aug  9 16:35:34 1989
***************
*** 2669,2675 ****
  you can use the @samp{print} command with just a format and no
  expression.  For example, @samp{p/x} reprints the last value in hex.
  
! @node Memory, Auto Display, Formats, Data
  @subsection Examining Memory
  
  @cindex examining memory
--- 2669,2676 ----
  you can use the @samp{print} command with just a format and no
  expression.  For example, @samp{p/x} reprints the last value in hex.
  
! 
! @node Memory, Structures, Formats, Data
  @subsection Examining Memory
  
  @cindex examining memory
***************
*** 2817,2822 ****
--- 2818,2909 ----
  single argument to this command is a pc value; the function surrounding
  this value will be dumped.  Two arguments specify a range of address
  (first inclusive, second exclusive) to be dumped.
+ 
+ @node Structures, Auto Display, Memory, Data
+ @subsection Examining Structures
+ 
+ @cindex examining structures
+ @kindex x
+ @noindent
+ When a user examines a C structure or C++ class with the @samp{print} command,
+ GDB normally prints the value in a compact format. A more pleasant format can 
+ be enabled with the @samp{set prettyprint} command:
+ 
+ @table @code
+ @kindex set prettyprint
+ @item set prettyprint off
+ Turns off prettyprinting of structures and classes.
+ 
+ @item set prettyprint on
+ Turns on prettyprinting of structures and classes.
+ @end table
+ 
+ When the user examines structures containing unions, the values of
+ unionmembers are normally not not printed. The display of unionmembers can be
+ controlled by the command @samp{set unionprint}:
+ 
+ @table @code
+ @kindex set unionprint
+ @item set unionprint off
+ Turns off printing of unions interior to structures.
+ 
+ @item set unionprint on
+ Turns on printing of unions interior to structures.
+ @end table
+ 
+ Consider the following C structure:
+ 
+ @example
+ struct @{
+   char *name;
+   int  flags;
+   union @{
+     int   ival;
+     float fval;
+     char  *pval;
+   @} uval;
+ @} symtab[5];
+ @end example
+ 
+ With @samp{set prettyprint off} and @samp{set unionprint off}, if you type 
+ @samp{print symtab[0]}, you'll get
+ 
+ @example
+ $1 = @{name = 0x0, flags = 0, uval = @{...@}@}
+ @end example
+ 
+ With @samp{set prettyprint off} and @samp{set unionprint on}, if you type 
+ @samp{print symtab[0]}, you'll get
+ 
+ @example
+ $1 = @{name = 0x0, flags = 0, uval = @{ival = 0, fval = 0, pval = 0x0@}@}
+ @end example
+ 
+ With @samp{set prettyprint on} and @samp{set unionprint off}, if you type 
+ @samp{print symtab[0]}, you'll get
+ 
+ @example
+ $1 = @{
+   name = 0x0,
+   flags = 0,
+   uval = @{...@}
+ @}
+ @end example
+ 
+ With @samp{set prettyprint on} and @samp{set unionprint on}, if you type 
+ @samp{print symtab[0]}, you'll get
+ 
+ @example
+ $1 = @{
+   name = 0x0,
+   flags = 0,
+   uval = @{
+     ival = 0,
+     fval = 0,
+     pval = 0x0
+   @}
+ @}
+ @end example
  
  @node Auto Display, Value History, Memory, Data
  @section Automatic Display
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads