Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Appendix C. Maintenance Commands

In addition to commands intended for gdb users, gdb includes a number of commands intended for gdb developers. These commands are provided here for reference.

maint info breakpoints

Using the same format as info breakpoints, display both the breakpoints you've set explicitly, and those gdb is using for internal purposes. Internal breakpoints are shown with negative breakpoint numbers. The type column identifies what kind of breakpoint is shown:

breakpoint

Normal, explicitly set breakpoint.

watchpoint

Normal, explicitly set watchpoint.

longjmp

Internal breakpoint, used to handle correctly stepping through longjmp calls.

longjmp resume

Internal breakpoint at the target of a longjmp.

until

Temporary internal breakpoint used by the gdb until command.

finish

Temporary internal breakpoint used by the gdb finish command.

shlib events

Shared library events.

maint internal-error, maint internal-warning

Cause gdb to call the internal function internal_error or internal_warning and hence behave as though an internal error or internal warning has been detected. In addition to reporting the internal problem, these functions give the user the opportunity to either quit gdb or create a core file of the current gdb session.

(gdb) maint internal-error testing, 1, 2
…/maint.c:121: internal-error: testing, 1, 2
A problem internal to GDB has been detected.  Further
debugging may prove unreliable.
Quit this debugging session? (y or n) n
Create a core file? (y or n) n
(gdb)

Takes an optional parameter that is used as the text of the error or warning message.

maint print dummy-frames

Prints the contents of gdb's internal dummy-frame stack.

(gdb) b add
…
(gdb) print add(2,3)
Breakpoint 2, add (a=2, b=3) at …
58	  return (a + b);
The program being debugged stopped while in a function called from GDB.
…
(gdb) maint print dummy-frames
0x1a57c80: pc=0x01014068 fp=0x0200bddc sp=0x0200bdd6
 top=0x0200bdd4 id={stack=0x200bddc,code=0x101405c}
 call_lo=0x01014000 call_hi=0x01014001
(gdb)

Takes an optional file parameter.

maint print registers, maint print raw-registers, maint print cooked-registers, maint print register-groups

Print gdb's internal register data structures.

The command maint print raw-registers includes the contents of the raw register cache; the command maint print cooked-registers includes the (cooked) value of all registers; and the command maint print register-groups includes the groups that each register is a member of. .

Takes an optional file parameter.

maint print reggroups

Print gdb's internal register group data structures.

Takes an optional file parameter.

(gdb) maint print reggroups
 Group      Type
 general    user
 float      user
 all        user
 vector     user
 system     user
 save       internal
 restore    internal

maint set profile, maint show profile

Control profiling of gdb.

Profiling will be disabled until you use the maint set profile command to enable it. When you enable profiling, the system will begin collecting timing and execution count data; when you disable profiling or exit gdb, the results will be written to a log file. Remember that if you use profiling, gdb will overwrite the profiling log file (often called gmon.out). If you have a record of important profiling data in a gmon.out file, be sure to move it to a safe location.

Configuring with -enable-profiling arranges for gdb to be compiled with the -pg compiler option.

 
 
  Published under the terms of the GNU General Public License Design by Interspire