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