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
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

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




32.6.4 GUD Customization

On startup, GUD runs one of the following hooks: gdb-mode-hook, if you are using GDB; dbx-mode-hook, if you are using DBX; sdb-mode-hook, if you are using SDB; xdb-mode-hook, if you are using XDB; perldb-mode-hook, for Perl debugging mode; pdb-mode-hook, for PDB; jdb-mode-hook, for JDB. You can use these hooks to define custom key bindings for the debugger interaction buffer. See Hooks.

Here is a convenient way to define a command that sends a particular command string to the debugger, and set up a key binding for it in the debugger interaction buffer:

     (gud-def function cmdstring binding docstring)

This defines a command named function which sends cmdstring to the debugger process, and gives it the documentation string docstring. You can then use the command function in any buffer. If binding is non-nil, gud-def also binds the command to C-c binding in the GUD buffer's mode and to C-x C-a binding generally.

The command string cmdstring may contain certain ‘%’-sequences that stand for data to be filled in at the time function is called:

The name of the current source file. If the current buffer is the GUD buffer, then the “current source file” is the file that the program stopped in.
The number of the current source line. If the current buffer is the GUD buffer, then the “current source line” is the line that the program stopped in.
The text of the C lvalue or function-call expression at or adjacent to point.
The text of the hexadecimal address at or adjacent to point.
The numeric argument of the called function, as a decimal number. If the command is used without a numeric argument, ‘%p’ stands for the empty string.

If you don't use ‘%p’ in the command string, the command you define ignores any numeric argument.

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