128 lines
7.1 KiB
HTML
128 lines
7.1 KiB
HTML
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>Startup - 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="Invoking-GDB.html#Invoking-GDB" title="Invoking GDB">
|
||
|
<link rel="prev" href="Mode-Options.html#Mode-Options" title="Mode Options">
|
||
|
<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="Startup"></a>
|
||
|
<p>
|
||
|
Previous: <a rel="previous" accesskey="p" href="Mode-Options.html#Mode-Options">Mode Options</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="Invoking-GDB.html#Invoking-GDB">Invoking GDB</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<h4 class="subsection">2.1.3 What <span class="sc">gdb</span> Does During Startup</h4>
|
||
|
|
||
|
<p><a name="index-g_t_0040value_007bGDBN_007d-startup-57"></a>
|
||
|
Here's the description of what <span class="sc">gdb</span> does during session startup:
|
||
|
|
||
|
<ol type=1 start=1>
|
||
|
<li>Sets up the command interpreter as specified by the command line
|
||
|
(see <a href="Mode-Options.html#Mode-Options">interpreter</a>).
|
||
|
|
||
|
<li><a name="index-init-file-58"></a>Reads the system-wide <dfn>init file</dfn> (if <samp><span class="option">--with-system-gdbinit</span></samp> was
|
||
|
used when building <span class="sc">gdb</span>; see <a href="System_002dwide-configuration.html#System_002dwide-configuration">System-wide configuration and settings</a>) and executes all the commands in
|
||
|
that file.
|
||
|
|
||
|
<p><a name="Home-Directory-Init-File"></a><li>Reads the init file (if any) in your home directory<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> and executes all the commands in
|
||
|
that file.
|
||
|
|
||
|
<p><a name="Option-_002dinit_002deval_002dcommand"></a><li>Executes commands and command files specified by the ‘<samp><span class="samp">-iex</span></samp>’ and
|
||
|
‘<samp><span class="samp">-ix</span></samp>’ options in their specified order. Usually you should use the
|
||
|
‘<samp><span class="samp">-ex</span></samp>’ and ‘<samp><span class="samp">-x</span></samp>’ options instead, but this way you can apply
|
||
|
settings before <span class="sc">gdb</span> init files get executed and before inferior
|
||
|
gets loaded.
|
||
|
|
||
|
<li>Processes command line options and operands.
|
||
|
|
||
|
<p><a name="Init-File-in-the-Current-Directory-during-Startup"></a><li>Reads and executes the commands from init file (if any) in the current
|
||
|
working directory as long as ‘<samp><span class="samp">set auto-load local-gdbinit</span></samp>’ is set to
|
||
|
‘<samp><span class="samp">on</span></samp>’ (see <a href="Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory">Init File in the Current Directory</a>).
|
||
|
This is only done if the current directory is
|
||
|
different from your home directory. Thus, you can have more than one
|
||
|
init file, one generic in your home directory, and another, specific
|
||
|
to the program you are debugging, in the directory where you invoke
|
||
|
<span class="sc">gdb</span>.
|
||
|
|
||
|
<li>If the command line specified a program to debug, or a process to
|
||
|
attach to, or a core file, <span class="sc">gdb</span> loads any auto-loaded
|
||
|
scripts provided for the program or for its loaded shared libraries.
|
||
|
See <a href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>.
|
||
|
|
||
|
<p>If you wish to disable the auto-loading during startup,
|
||
|
you must do something like the following:
|
||
|
|
||
|
<pre class="smallexample"> $ gdb -iex "set auto-load python-scripts off" myprogram
|
||
|
</pre>
|
||
|
<p>Option ‘<samp><span class="samp">-ex</span></samp>’ does not work because the auto-loading is then turned
|
||
|
off too late.
|
||
|
|
||
|
<li>Executes commands and command files specified by the ‘<samp><span class="samp">-ex</span></samp>’ and
|
||
|
‘<samp><span class="samp">-x</span></samp>’ options in their specified order. See <a href="Command-Files.html#Command-Files">Command Files</a>, for
|
||
|
more details about <span class="sc">gdb</span> command files.
|
||
|
|
||
|
<li>Reads the command history recorded in the <dfn>history file</dfn>.
|
||
|
See <a href="Command-History.html#Command-History">Command History</a>, for more details about the command history and the
|
||
|
files where <span class="sc">gdb</span> records it.
|
||
|
</ol>
|
||
|
|
||
|
<p>Init files use the same syntax as <dfn>command files</dfn> (see <a href="Command-Files.html#Command-Files">Command Files</a>) and are processed by <span class="sc">gdb</span> in the same way. The init
|
||
|
file in your home directory can set options (such as ‘<samp><span class="samp">set
|
||
|
complaints</span></samp>’) that affect subsequent processing of command line options
|
||
|
and operands. Init files are not executed if you use the ‘<samp><span class="samp">-nx</span></samp>’
|
||
|
option (see <a href="Mode-Options.html#Mode-Options">Choosing Modes</a>).
|
||
|
|
||
|
<p>To display the list of init files loaded by gdb at startup, you
|
||
|
can use <kbd>gdb --help</kbd>.
|
||
|
|
||
|
<p><a name="index-init-file-name-59"></a><a name="index-g_t_0040file_007b_002egdbinit_007d-60"></a><a name="index-g_t_0040file_007bgdb_002eini_007d-61"></a>The <span class="sc">gdb</span> init files are normally called <samp><span class="file">.gdbinit</span></samp>.
|
||
|
The DJGPP port of <span class="sc">gdb</span> uses the name <samp><span class="file">gdb.ini</span></samp>, due to
|
||
|
the limitations of file names imposed by DOS filesystems. The Windows
|
||
|
port of <span class="sc">gdb</span> uses the standard name, but if it finds a
|
||
|
<samp><span class="file">gdb.ini</span></samp> file in your home directory, it warns you about that
|
||
|
and suggests to rename the file to the standard name.
|
||
|
|
||
|
<div class="footnote">
|
||
|
<hr>
|
||
|
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> On
|
||
|
DOS/Windows systems, the home directory is the one pointed to by the
|
||
|
<code>HOME</code> environment variable.</p>
|
||
|
|
||
|
<hr></div>
|
||
|
|
||
|
</body></html>
|
||
|
|