Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

170 linhas
8.3KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Startup (Debugging with GDB)</title>
  17. <meta name="description" content="Startup (Debugging with GDB)">
  18. <meta name="keywords" content="Startup (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Invoking-GDB.html#Invoking-GDB" rel="up" title="Invoking GDB">
  26. <link href="Quitting-GDB.html#Quitting-GDB" rel="next" title="Quitting GDB">
  27. <link href="Mode-Options.html#Mode-Options" rel="prev" title="Mode Options">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Startup"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="Mode-Options.html#Mode-Options" accesskey="p" rel="prev">Mode Options</a>, Up: <a href="Invoking-GDB.html#Invoking-GDB" accesskey="u" rel="up">Invoking GDB</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="What-GDB-Does-During-Startup"></a>
  64. <h4 class="subsection">2.1.3 What <small>GDB</small> Does During Startup</h4>
  65. <a name="index-GDB-startup"></a>
  66. <p>Here&rsquo;s the description of what <small>GDB</small> does during session startup:
  67. </p>
  68. <ol>
  69. <li> Sets up the command interpreter as specified by the command line
  70. (see <a href="Mode-Options.html#Mode-Options">interpreter</a>).
  71. </li><li> <a name="index-init-file"></a>
  72. Reads the system-wide <em>init file</em> (if <samp>--with-system-gdbinit</samp> was
  73. used when building <small>GDB</small>; see <a href="System_002dwide-configuration.html#System_002dwide-configuration">System-wide configuration and settings</a>) and the files in the system-wide
  74. gdbinit directory (if <samp>--with-system-gdbinit-dir</samp> was used) and executes
  75. all the commands in those files. The files need to be named with a <samp>.gdb</samp>
  76. extension to be interpreted as <small>GDB</small> commands, or they can be written
  77. in a supported scripting language with an appropriate file extension.
  78. <a name="Home-Directory-Init-File"></a></li><li> Reads the init file (if any) in your home directory<a name="DOCF1" href="#FOOT1"><sup>1</sup></a> and executes all the commands in
  79. that file.
  80. <a name="Option-_002dinit_002deval_002dcommand"></a></li><li> Executes commands and command files specified by the &lsquo;<samp>-iex</samp>&rsquo; and
  81. &lsquo;<samp>-ix</samp>&rsquo; options in their specified order. Usually you should use the
  82. &lsquo;<samp>-ex</samp>&rsquo; and &lsquo;<samp>-x</samp>&rsquo; options instead, but this way you can apply
  83. settings before <small>GDB</small> init files get executed and before inferior
  84. gets loaded.
  85. </li><li> Processes command line options and operands.
  86. <a name="Init-File-in-the-Current-Directory-during-Startup"></a></li><li> Reads and executes the commands from init file (if any) in the current
  87. working directory as long as &lsquo;<samp>set auto-load local-gdbinit</samp>&rsquo; is set to
  88. &lsquo;<samp>on</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>).
  89. This is only done if the current directory is
  90. different from your home directory. Thus, you can have more than one
  91. init file, one generic in your home directory, and another, specific
  92. to the program you are debugging, in the directory where you invoke
  93. <small>GDB</small>.
  94. </li><li> If the command line specified a program to debug, or a process to
  95. attach to, or a core file, <small>GDB</small> loads any auto-loaded
  96. scripts provided for the program or for its loaded shared libraries.
  97. See <a href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>.
  98. <p>If you wish to disable the auto-loading during startup,
  99. you must do something like the following:
  100. </p>
  101. <div class="smallexample">
  102. <pre class="smallexample">$ gdb -iex &quot;set auto-load python-scripts off&quot; myprogram
  103. </pre></div>
  104. <p>Option &lsquo;<samp>-ex</samp>&rsquo; does not work because the auto-loading is then turned
  105. off too late.
  106. </p>
  107. </li><li> Executes commands and command files specified by the &lsquo;<samp>-ex</samp>&rsquo; and
  108. &lsquo;<samp>-x</samp>&rsquo; options in their specified order. See <a href="Command-Files.html#Command-Files">Command Files</a>, for
  109. more details about <small>GDB</small> command files.
  110. </li><li> Reads the command history recorded in the <em>history file</em>.
  111. See <a href="Command-History.html#Command-History">Command History</a>, for more details about the command history and the
  112. files where <small>GDB</small> records it.
  113. </li></ol>
  114. <p>Init files use the same syntax as <em>command files</em> (see <a href="Command-Files.html#Command-Files">Command Files</a>) and are processed by <small>GDB</small> in the same way. The init
  115. file in your home directory can set options (such as &lsquo;<samp>set
  116. complaints</samp>&rsquo;) that affect subsequent processing of command line options
  117. and operands. Init files are not executed if you use the &lsquo;<samp>-nx</samp>&rsquo;
  118. option (see <a href="Mode-Options.html#Mode-Options">Choosing Modes</a>).
  119. </p>
  120. <p>To display the list of init files loaded by gdb at startup, you
  121. can use <kbd>gdb --help</kbd>.
  122. </p>
  123. <a name="index-init-file-name"></a>
  124. <a name="index-_002egdbinit"></a>
  125. <a name="index-gdb_002eini"></a>
  126. <p>The <small>GDB</small> init files are normally called <samp>.gdbinit</samp>.
  127. The DJGPP port of <small>GDB</small> uses the name <samp>gdb.ini</samp>, due to
  128. the limitations of file names imposed by DOS filesystems. The Windows
  129. port of <small>GDB</small> uses the standard name, but if it finds a
  130. <samp>gdb.ini</samp> file in your home directory, it warns you about that
  131. and suggests to rename the file to the standard name.
  132. </p>
  133. <div class="footnote">
  134. <hr>
  135. <h4 class="footnotes-heading">Footnotes</h4>
  136. <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
  137. <p>On
  138. DOS/Windows systems, the home directory is the one pointed to by the
  139. <code>HOME</code> environment variable.</p>
  140. </div>
  141. <hr>
  142. <div class="header">
  143. <p>
  144. Previous: <a href="Mode-Options.html#Mode-Options" accesskey="p" rel="prev">Mode Options</a>, Up: <a href="Invoking-GDB.html#Invoking-GDB" accesskey="u" rel="up">Invoking GDB</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  145. </div>
  146. </body>
  147. </html>