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, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 131998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 14Free Software Foundation, Inc. 15 16Permission is granted to copy, distribute and/or modify this document 17under the terms of the GNU Free Documentation License, Version 1.3 or 18any later version published by the Free Software Foundation; with the 19Invariant Sections being ``Free Software'' and ``Free Software Needs 20Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 21and with the Back-Cover Texts as in (a) below. 22 23(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 24this GNU Manual. Buying copies from GNU Press supports the FSF in 25developing GNU and promoting software freedom.''--> 26<meta http-equiv="Content-Style-Type" content="text/css"> 27<style type="text/css"><!-- 28 pre.display { font-family:inherit } 29 pre.format { font-family:inherit } 30 pre.smalldisplay { font-family:inherit; font-size:smaller } 31 pre.smallformat { font-family:inherit; font-size:smaller } 32 pre.smallexample { font-size:smaller } 33 pre.smalllisp { font-size:smaller } 34 span.sc { font-variant:small-caps } 35 span.roman { font-family:serif; font-weight:normal; } 36 span.sansserif { font-family:sans-serif; font-weight:normal; } 37--></style> 38<link rel="stylesheet" type="text/css" href="../cs.css"> 39</head> 40<body> 41<div class="node"> 42<a name="Startup"></a> 43<p> 44Previous: <a rel="previous" accesskey="p" href="Mode-Options.html#Mode-Options">Mode Options</a>, 45Up: <a rel="up" accesskey="u" href="Invoking-GDB.html#Invoking-GDB">Invoking GDB</a> 46<hr> 47</div> 48 49<h4 class="subsection">2.1.3 What <span class="sc">gdb</span> Does During Startup</h4> 50 51<p><a name="index-g_t_0040value_007bGDBN_007d-startup-49"></a> 52Here's the description of what <span class="sc">gdb</span> does during session startup: 53 54 <ol type=1 start=1> 55<li>Sets up the command interpreter as specified by the command line 56(see <a href="Mode-Options.html#Mode-Options">interpreter</a>). 57 58 <li><a name="index-init-file-50"></a>Reads the system-wide <dfn>init file</dfn> (if <samp><span class="option">--with-system-gdbinit</span></samp> was 59used 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 60that file. 61 62 <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 63that file. 64 65 <li>Processes command line options and operands. 66 67 <li>Reads and executes the commands from init file (if any) in the current 68working directory. This is only done if the current directory is 69different from your home directory. Thus, you can have more than one 70init file, one generic in your home directory, and another, specific 71to the program you are debugging, in the directory where you invoke 72<span class="sc">gdb</span>. 73 74 <li>Reads command files specified by the ‘<samp><span class="samp">-x</span></samp>’ option. See <a href="Command-Files.html#Command-Files">Command Files</a>, for more details about <span class="sc">gdb</span> command files. 75 76 <li>Reads the command history recorded in the <dfn>history file</dfn>. 77See <a href="Command-History.html#Command-History">Command History</a>, for more details about the command history and the 78files where <span class="sc">gdb</span> records it. 79 </ol> 80 81 <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 82file in your home directory can set options (such as ‘<samp><span class="samp">set 83complaints</span></samp>’) that affect subsequent processing of command line options 84and operands. Init files are not executed if you use the ‘<samp><span class="samp">-nx</span></samp>’ 85option (see <a href="Mode-Options.html#Mode-Options">Choosing Modes</a>). 86 87 <p>To display the list of init files loaded by gdb at startup, you 88can use <kbd>gdb --help</kbd>. 89 90 <p><a name="index-init-file-name-51"></a><a name="index-g_t_0040file_007b_002egdbinit_007d-52"></a><a name="index-g_t_0040file_007bgdb_002eini_007d-53"></a>The <span class="sc">gdb</span> init files are normally called <samp><span class="file">.gdbinit</span></samp>. 91The DJGPP port of <span class="sc">gdb</span> uses the name <samp><span class="file">gdb.ini</span></samp>, due to 92the limitations of file names imposed by DOS filesystems. The Windows 93ports of <span class="sc">gdb</span> use the standard name, but if they find a 94<samp><span class="file">gdb.ini</span></samp> file, they warn you about that and suggest to rename 95the file to the standard name. 96 97 <div class="footnote"> 98<hr> 99<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> On 100DOS/Windows systems, the home directory is the one pointed to by the 101<code>HOME</code> environment variable.</p> 102 103 <hr></div> 104 105 </body></html> 106 107