• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gdb/
1<html lang="en">
2<head>
3<title>Startup - Debugging with GDB</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Debugging with GDB">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Invoking-GDB.html#Invoking-GDB" title="Invoking GDB">
9<link rel="prev" href="Mode-Options.html#Mode-Options" title="Mode Options">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1988-2013 Free Software Foundation, Inc.
13
14Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3 or
16any later version published by the Free Software Foundation; with the
17Invariant Sections being ``Free Software'' and ``Free Software Needs
18Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
19and with the Back-Cover Texts as in (a) below.
20
21(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
22this GNU Manual.  Buying copies from GNU Press supports the FSF in
23developing GNU and promoting software freedom.''
24-->
25<meta http-equiv="Content-Style-Type" content="text/css">
26<style type="text/css"><!--
27  pre.display { font-family:inherit }
28  pre.format  { font-family:inherit }
29  pre.smalldisplay { font-family:inherit; font-size:smaller }
30  pre.smallformat  { font-family:inherit; font-size:smaller }
31  pre.smallexample { font-size:smaller }
32  pre.smalllisp    { font-size:smaller }
33  span.sc    { font-variant:small-caps }
34  span.roman { font-family:serif; font-weight:normal; } 
35  span.sansserif { font-family:sans-serif; font-weight:normal; } 
36--></style>
37<link rel="stylesheet" type="text/css" href="../cs.css">
38</head>
39<body>
40<div class="node">
41<a name="Startup"></a>
42<p>
43Previous:&nbsp;<a rel="previous" accesskey="p" href="Mode-Options.html#Mode-Options">Mode Options</a>,
44Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GDB.html#Invoking-GDB">Invoking GDB</a>
45<hr>
46</div>
47
48<h4 class="subsection">2.1.3 What <span class="sc">gdb</span> Does During Startup</h4>
49
50<p><a name="index-g_t_0040value_007bGDBN_007d-startup-55"></a>
51Here's the description of what <span class="sc">gdb</span> does during session startup:
52
53     <ol type=1 start=1>
54<li>Sets up the command interpreter as specified by the command line
55(see <a href="Mode-Options.html#Mode-Options">interpreter</a>).
56
57     <li><a name="index-init-file-56"></a>Reads the system-wide <dfn>init file</dfn> (if <samp><span class="option">--with-system-gdbinit</span></samp> was
58used 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
59that file.
60
61     <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
62that file.
63
64     <p><a name="Option-_002dinit_002deval_002dcommand"></a><li>Executes commands and command files specified by the &lsquo;<samp><span class="samp">-iex</span></samp>&rsquo; and
65&lsquo;<samp><span class="samp">-ix</span></samp>&rsquo; options in their specified order.  Usually you should use the
66&lsquo;<samp><span class="samp">-ex</span></samp>&rsquo; and &lsquo;<samp><span class="samp">-x</span></samp>&rsquo; options instead, but this way you can apply
67settings before <span class="sc">gdb</span> init files get executed and before inferior
68gets loaded.
69
70     <li>Processes command line options and operands.
71
72     <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
73working directory as long as &lsquo;<samp><span class="samp">set auto-load local-gdbinit</span></samp>&rsquo; is set to
74&lsquo;<samp><span class="samp">on</span></samp>&rsquo; (see <a href="Init-File-in-the-Current-Directory.html#Init-File-in-the-Current-Directory">Init File in the Current Directory</a>). 
75This is only done if the current directory is
76different from your home directory.  Thus, you can have more than one
77init file, one generic in your home directory, and another, specific
78to the program you are debugging, in the directory where you invoke
79<span class="sc">gdb</span>.
80
81     <li>If the command line specified a program to debug, or a process to
82attach to, or a core file, <span class="sc">gdb</span> loads any auto-loaded
83scripts provided for the program or for its loaded shared libraries. 
84See <a href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>.
85
86     <p>If you wish to disable the auto-loading during startup,
87you must do something like the following:
88
89     <pre class="smallexample">          $ gdb -iex "set auto-load python-scripts off" myprogram
90</pre>
91     <p>Option &lsquo;<samp><span class="samp">-ex</span></samp>&rsquo; does not work because the auto-loading is then turned
92off too late.
93
94     <li>Executes commands and command files specified by the &lsquo;<samp><span class="samp">-ex</span></samp>&rsquo; and
95&lsquo;<samp><span class="samp">-x</span></samp>&rsquo; options in their specified order.  See <a href="Command-Files.html#Command-Files">Command Files</a>, for
96more details about <span class="sc">gdb</span> command files.
97
98     <li>Reads the command history recorded in the <dfn>history file</dfn>. 
99See <a href="Command-History.html#Command-History">Command History</a>, for more details about the command history and the
100files where <span class="sc">gdb</span> records it.
101        </ol>
102
103   <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
104file in your home directory can set options (such as &lsquo;<samp><span class="samp">set
105complaints</span></samp>&rsquo;) that affect subsequent processing of command line options
106and operands.  Init files are not executed if you use the &lsquo;<samp><span class="samp">-nx</span></samp>&rsquo;
107option (see <a href="Mode-Options.html#Mode-Options">Choosing Modes</a>).
108
109   <p>To display the list of init files loaded by gdb at startup, you
110can use <kbd>gdb --help</kbd>.
111
112   <p><a name="index-init-file-name-57"></a><a name="index-g_t_0040file_007b_002egdbinit_007d-58"></a><a name="index-g_t_0040file_007bgdb_002eini_007d-59"></a>The <span class="sc">gdb</span> init files are normally called <samp><span class="file">.gdbinit</span></samp>. 
113The DJGPP port of <span class="sc">gdb</span> uses the name <samp><span class="file">gdb.ini</span></samp>, due to
114the limitations of file names imposed by DOS filesystems.  The Windows
115port of <span class="sc">gdb</span> uses the standard name, but if it finds a
116<samp><span class="file">gdb.ini</span></samp> file in your home directory, it warns you about that
117and suggests to rename the file to the standard name.
118
119   <div class="footnote">
120<hr>
121<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> On
122DOS/Windows systems, the home directory is the one pointed to by the
123<code>HOME</code> environment variable.</p>
124
125   <hr></div>
126
127   </body></html>
128
129