Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

182 lines
8.1KB

  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>ABI (Debugging with GDB)</title>
  17. <meta name="description" content="ABI (Debugging with GDB)">
  18. <meta name="keywords" content="ABI (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="Controlling-GDB.html#Controlling-GDB" rel="up" title="Controlling GDB">
  26. <link href="Auto_002dloading.html#Auto_002dloading" rel="next" title="Auto-loading">
  27. <link href="Numbers.html#Numbers" rel="prev" title="Numbers">
  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="ABI"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Auto_002dloading.html#Auto_002dloading" accesskey="n" rel="next">Auto-loading</a>, Previous: <a href="Numbers.html#Numbers" accesskey="p" rel="prev">Numbers</a>, Up: <a href="Controlling-GDB.html#Controlling-GDB" accesskey="u" rel="up">Controlling 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="Configuring-the-Current-ABI"></a>
  64. <h3 class="section">22.7 Configuring the Current ABI</h3>
  65. <p><small>GDB</small> can determine the <em>ABI</em> (Application Binary Interface) of your
  66. application automatically. However, sometimes you need to override its
  67. conclusions. Use these commands to manage <small>GDB</small>&rsquo;s view of the
  68. current ABI.
  69. </p>
  70. <a name="index-OS-ABI"></a>
  71. <a name="index-set-osabi"></a>
  72. <a name="index-show-osabi"></a>
  73. <a name="index-Newlib-OS-ABI-and-its-influence-on-the-longjmp-handling"></a>
  74. <p>One <small>GDB</small> configuration can debug binaries for multiple operating
  75. system targets, either via remote debugging or native emulation.
  76. <small>GDB</small> will autodetect the <em>OS ABI</em> (Operating System ABI) in use,
  77. but you can override its conclusion using the <code>set osabi</code> command.
  78. One example where this is useful is in debugging of binaries which use
  79. an alternate C library (e.g. <small>UCLIBC</small> for <small>GNU</small>/Linux) which does
  80. not have the same identifying marks that the standard C library for your
  81. platform provides.
  82. </p>
  83. <p>When <small>GDB</small> is debugging the AArch64 architecture, it provides a
  84. &ldquo;Newlib&rdquo; OS ABI. This is useful for handling <code>setjmp</code> and
  85. <code>longjmp</code> when debugging binaries that use the <small>NEWLIB</small> C library.
  86. The &ldquo;Newlib&rdquo; OS ABI can be selected by <code>set osabi Newlib</code>.
  87. </p>
  88. <dl compact="compact">
  89. <dt><code>show osabi</code></dt>
  90. <dd><p>Show the OS ABI currently in use.
  91. </p>
  92. </dd>
  93. <dt><code>set osabi</code></dt>
  94. <dd><p>With no argument, show the list of registered available OS ABI&rsquo;s.
  95. </p>
  96. </dd>
  97. <dt><code>set osabi <var>abi</var></code></dt>
  98. <dd><p>Set the current OS ABI to <var>abi</var>.
  99. </p></dd>
  100. </dl>
  101. <a name="index-float-promotion"></a>
  102. <p>Generally, the way that an argument of type <code>float</code> is passed to a
  103. function depends on whether the function is prototyped. For a prototyped
  104. (i.e. ANSI/ISO style) function, <code>float</code> arguments are passed unchanged,
  105. according to the architecture&rsquo;s convention for <code>float</code>. For unprototyped
  106. (i.e. K&amp;R style) functions, <code>float</code> arguments are first promoted to type
  107. <code>double</code> and then passed.
  108. </p>
  109. <p>Unfortunately, some forms of debug information do not reliably indicate whether
  110. a function is prototyped. If <small>GDB</small> calls a function that is not marked
  111. as prototyped, it consults <kbd>set coerce-float-to-double</kbd>.
  112. </p>
  113. <dl compact="compact">
  114. <dd><a name="index-set-coerce_002dfloat_002dto_002ddouble"></a>
  115. </dd>
  116. <dt><code>set coerce-float-to-double</code></dt>
  117. <dt><code>set coerce-float-to-double on</code></dt>
  118. <dd><p>Arguments of type <code>float</code> will be promoted to <code>double</code> when passed
  119. to an unprototyped function. This is the default setting.
  120. </p>
  121. </dd>
  122. <dt><code>set coerce-float-to-double off</code></dt>
  123. <dd><p>Arguments of type <code>float</code> will be passed directly to unprototyped
  124. functions.
  125. </p>
  126. <a name="index-show-coerce_002dfloat_002dto_002ddouble"></a>
  127. </dd>
  128. <dt><code>show coerce-float-to-double</code></dt>
  129. <dd><p>Show the current setting of promoting <code>float</code> to <code>double</code>.
  130. </p></dd>
  131. </dl>
  132. <a name="index-set-cp_002dabi"></a>
  133. <a name="index-show-cp_002dabi"></a>
  134. <p><small>GDB</small> needs to know the ABI used for your program&rsquo;s C<tt>++</tt>
  135. objects. The correct C<tt>++</tt> ABI depends on which C<tt>++</tt> compiler was
  136. used to build your application. <small>GDB</small> only fully supports
  137. programs with a single C<tt>++</tt> ABI; if your program contains code using
  138. multiple C<tt>++</tt> ABI&rsquo;s or if <small>GDB</small> can not identify your
  139. program&rsquo;s ABI correctly, you can tell <small>GDB</small> which ABI to use.
  140. Currently supported ABI&rsquo;s include &ldquo;gnu-v2&rdquo;, for <code>g++</code> versions
  141. before 3.0, &ldquo;gnu-v3&rdquo;, for <code>g++</code> versions 3.0 and later, and
  142. &ldquo;hpaCC&rdquo; for the HP ANSI C<tt>++</tt> compiler. Other C<tt>++</tt> compilers may
  143. use the &ldquo;gnu-v2&rdquo; or &ldquo;gnu-v3&rdquo; ABI&rsquo;s as well. The default setting is
  144. &ldquo;auto&rdquo;.
  145. </p>
  146. <dl compact="compact">
  147. <dt><code>show cp-abi</code></dt>
  148. <dd><p>Show the C<tt>++</tt> ABI currently in use.
  149. </p>
  150. </dd>
  151. <dt><code>set cp-abi</code></dt>
  152. <dd><p>With no argument, show the list of supported C<tt>++</tt> ABI&rsquo;s.
  153. </p>
  154. </dd>
  155. <dt><code>set cp-abi <var>abi</var></code></dt>
  156. <dt><code>set cp-abi auto</code></dt>
  157. <dd><p>Set the current C<tt>++</tt> ABI to <var>abi</var>, or return to automatic detection.
  158. </p></dd>
  159. </dl>
  160. <hr>
  161. <div class="header">
  162. <p>
  163. Next: <a href="Auto_002dloading.html#Auto_002dloading" accesskey="n" rel="next">Auto-loading</a>, Previous: <a href="Numbers.html#Numbers" accesskey="p" rel="prev">Numbers</a>, Up: <a href="Controlling-GDB.html#Controlling-GDB" accesskey="u" rel="up">Controlling 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>
  164. </div>
  165. </body>
  166. </html>