ABI.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: ABI</title>
  16. <meta name="description" content="Debugging with GDB: ABI">
  17. <meta name="keywords" content="Debugging with GDB: ABI">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="previous" title="Numbers">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="ABI"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Auto_002dloading.html#Auto_002dloading" accesskey="n" rel="next">Auto-loading</a>, Previous: <a href="Numbers.html#Numbers" accesskey="p" rel="previous">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>
  62. </div>
  63. <hr>
  64. <a name="Configuring-the-Current-ABI"></a>
  65. <h3 class="section">22.7 Configuring the Current ABI</h3>
  66. <p><small>GDB</small> can determine the <em>ABI</em> (Application Binary Interface) of your
  67. application automatically. However, sometimes you need to override its
  68. conclusions. Use these commands to manage <small>GDB</small>&rsquo;s view of the
  69. current ABI.
  70. </p>
  71. <a name="index-OS-ABI"></a>
  72. <a name="index-set-osabi"></a>
  73. <a name="index-show-osabi"></a>
  74. <a name="index-Newlib-OS-ABI-and-its-influence-on-the-longjmp-handling"></a>
  75. <p>One <small>GDB</small> configuration can debug binaries for multiple operating
  76. system targets, either via remote debugging or native emulation.
  77. <small>GDB</small> will autodetect the <em>OS ABI</em> (Operating System ABI) in use,
  78. but you can override its conclusion using the <code>set osabi</code> command.
  79. One example where this is useful is in debugging of binaries which use
  80. an alternate C library (e.g. <small>UCLIBC</small> for <small>GNU</small>/Linux) which does
  81. not have the same identifying marks that the standard C library for your
  82. platform provides.
  83. </p>
  84. <p>When <small>GDB</small> is debugging the AArch64 architecture, it provides a
  85. &ldquo;Newlib&rdquo; OS ABI. This is useful for handling <code>setjmp</code> and
  86. <code>longjmp</code> when debugging binaries that use the <small>NEWLIB</small> C library.
  87. The &ldquo;Newlib&rdquo; OS ABI can be selected by <code>set osabi Newlib</code>.
  88. </p>
  89. <dl compact="compact">
  90. <dt><code>show osabi</code></dt>
  91. <dd><p>Show the OS ABI currently in use.
  92. </p>
  93. </dd>
  94. <dt><code>set osabi</code></dt>
  95. <dd><p>With no argument, show the list of registered available OS ABI&rsquo;s.
  96. </p>
  97. </dd>
  98. <dt><code>set osabi <var>abi</var></code></dt>
  99. <dd><p>Set the current OS ABI to <var>abi</var>.
  100. </p></dd>
  101. </dl>
  102. <a name="index-float-promotion"></a>
  103. <p>Generally, the way that an argument of type <code>float</code> is passed to a
  104. function depends on whether the function is prototyped. For a prototyped
  105. (i.e. ANSI/ISO style) function, <code>float</code> arguments are passed unchanged,
  106. according to the architecture&rsquo;s convention for <code>float</code>. For unprototyped
  107. (i.e. K&amp;R style) functions, <code>float</code> arguments are first promoted to type
  108. <code>double</code> and then passed.
  109. </p>
  110. <p>Unfortunately, some forms of debug information do not reliably indicate whether
  111. a function is prototyped. If <small>GDB</small> calls a function that is not marked
  112. as prototyped, it consults <kbd>set coerce-float-to-double</kbd>.
  113. </p>
  114. <dl compact="compact">
  115. <dd><a name="index-set-coerce_002dfloat_002dto_002ddouble"></a>
  116. </dd>
  117. <dt><code>set coerce-float-to-double</code></dt>
  118. <dt><code>set coerce-float-to-double on</code></dt>
  119. <dd><p>Arguments of type <code>float</code> will be promoted to <code>double</code> when passed
  120. to an unprototyped function. This is the default setting.
  121. </p>
  122. </dd>
  123. <dt><code>set coerce-float-to-double off</code></dt>
  124. <dd><p>Arguments of type <code>float</code> will be passed directly to unprototyped
  125. functions.
  126. </p>
  127. <a name="index-show-coerce_002dfloat_002dto_002ddouble"></a>
  128. </dd>
  129. <dt><code>show coerce-float-to-double</code></dt>
  130. <dd><p>Show the current setting of promoting <code>float</code> to <code>double</code>.
  131. </p></dd>
  132. </dl>
  133. <a name="index-set-cp_002dabi"></a>
  134. <a name="index-show-cp_002dabi"></a>
  135. <p><small>GDB</small> needs to know the ABI used for your program&rsquo;s C<tt>++</tt>
  136. objects. The correct C<tt>++</tt> ABI depends on which C<tt>++</tt> compiler was
  137. used to build your application. <small>GDB</small> only fully supports
  138. programs with a single C<tt>++</tt> ABI; if your program contains code using
  139. multiple C<tt>++</tt> ABI&rsquo;s or if <small>GDB</small> can not identify your
  140. program&rsquo;s ABI correctly, you can tell <small>GDB</small> which ABI to use.
  141. Currently supported ABI&rsquo;s include &ldquo;gnu-v2&rdquo;, for <code>g++</code> versions
  142. before 3.0, &ldquo;gnu-v3&rdquo;, for <code>g++</code> versions 3.0 and later, and
  143. &ldquo;hpaCC&rdquo; for the HP ANSI C<tt>++</tt> compiler. Other C<tt>++</tt> compilers may
  144. use the &ldquo;gnu-v2&rdquo; or &ldquo;gnu-v3&rdquo; ABI&rsquo;s as well. The default setting is
  145. &ldquo;auto&rdquo;.
  146. </p>
  147. <dl compact="compact">
  148. <dt><code>show cp-abi</code></dt>
  149. <dd><p>Show the C<tt>++</tt> ABI currently in use.
  150. </p>
  151. </dd>
  152. <dt><code>set cp-abi</code></dt>
  153. <dd><p>With no argument, show the list of supported C<tt>++</tt> ABI&rsquo;s.
  154. </p>
  155. </dd>
  156. <dt><code>set cp-abi <var>abi</var></code></dt>
  157. <dt><code>set cp-abi auto</code></dt>
  158. <dd><p>Set the current C<tt>++</tt> ABI to <var>abi</var>, or return to automatic detection.
  159. </p></dd>
  160. </dl>
  161. <hr>
  162. <div class="header">
  163. <p>
  164. Next: <a href="Auto_002dloading.html#Auto_002dloading" accesskey="n" rel="next">Auto-loading</a>, Previous: <a href="Numbers.html#Numbers" accesskey="p" rel="previous">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>
  165. </div>
  166. </body>
  167. </html>