toolchain/share/doc/gdb/Edit.html

104 lines
4.4 KiB
HTML
Raw Normal View History

2024-01-10 05:24:32 +00:00
<html lang="en">
<head>
<title>Edit - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Source.html#Source" title="Source">
<link rel="prev" href="Specify-Location.html#Specify-Location" title="Specify Location">
<link rel="next" href="Search.html#Search" title="Search">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Edit"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Search.html#Search">Search</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Specify-Location.html#Specify-Location">Specify Location</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Source.html#Source">Source</a>
<hr>
</div>
<h3 class="section">9.3 Editing Source Files</h3>
<p><a name="index-editing-source-files-567"></a>
<a name="index-edit-568"></a><a name="index-e-_0040r_007b_0028_0040code_007bedit_007d_0029_007d-569"></a>To edit the lines in a source file, use the <code>edit</code> 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:
<dl>
<dt><code>edit </code><var>location</var><dd>Edit the source file specified by <code>location</code>. Editing starts at
that <var>location</var>, e.g., at the specified source line of the
specified file. See <a href="Specify-Location.html#Specify-Location">Specify Location</a>, for all the possible forms
of the <var>location</var> argument; here are the forms of the <code>edit</code>
command most commonly used:
<dl>
<dt><code>edit </code><var>number</var><dd>Edit the current source file with <var>number</var> as the active line number.
<br><dt><code>edit </code><var>function</var><dd>Edit the file containing <var>function</var> at the beginning of its definition.
</dl>
</dl>
<h4 class="subsection">9.3.1 Choosing your Editor</h4>
<p>You can customize <span class="sc">gdb</span> to use any editor you want
<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a>.
By default, it is <samp><span class="file">/bin/ex</span></samp>, but you can change this
by setting the environment variable <code>EDITOR</code> before using
<span class="sc">gdb</span>. For example, to configure <span class="sc">gdb</span> to use the
<code>vi</code> editor, you could use these commands with the <code>sh</code> shell:
<pre class="smallexample"> EDITOR=/usr/bin/vi
export EDITOR
gdb ...
</pre>
<p>or in the <code>csh</code> shell,
<pre class="smallexample"> setenv EDITOR /usr/bin/vi
gdb ...
</pre>
<div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small>
The only restriction is that your editor (say <code>ex</code>), recognizes the
following command-line syntax:
<pre class="smallexample"> ex +<var>number</var> file
</pre>
<p>The optional numeric value +<var>number</var> specifies the number of the line in
the file where to start editing.</p>
<hr></div>
</body></html>