To edit the lines in a source file, use the `edit' command. The editing program of your choice is invoked with the current line set to the active line in the program. Alternatively, there are several ways to specify what part of the file you want to print if you want to see other parts of the program.
Here are the forms of the `edit' command most commonly used:
`edit' Edit the current source file at the active line number in the program.
`edit NUMBER' Edit the current source file with NUMBER as the active line number.
`edit FUNCTION' Edit the file containing FUNCTION at the beginning of its definition.
`edit FILENAME:NUMBER' Specifies line NUMBER in the source file FILENAME.
`edit FILENAME:FUNCTION' Specifies the line that begins the body of the function FUNCTION in the file FILENAME. You only need the file name with a function name to avoid ambiguity when there are identically named functions in different source files.
`edit *ADDRESS' Specifies the line containing the program address ADDRESS. ADDRESS may be any expression.
You can customize GDB to use any editor you want (1). By default, it is /bin/ex, but you can change this by setting the environment variable `EDITOR' before using GDB. For example, to configure GDB to use the `vi' editor, you could use these commands with the `sh' shell: EDITOR=/usr/bin/vi export EDITOR gdb ... or in the `csh' shell, setenv EDITOR /usr/bin/vi gdb ...
---------- Footnotes ----------
(1) The only restriction is that your editor (say `ex'), recognizes the following command-line syntax: ex +NUMBER file The optional numeric value +NUMBER designates the active line in the file.Created Mon Nov 8 17:42:36 2004 on tillpc with info_to_html version 0.9.6.