124 lines
6.5 KiB
HTML
124 lines
6.5 KiB
HTML
|
<html lang="en">
|
||
|
<head>
|
||
|
<title>ABI - Debugging with GDB</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html">
|
||
|
<meta name="description" content="Debugging with GDB">
|
||
|
<meta name="generator" content="makeinfo 4.13">
|
||
|
<link title="Top" rel="start" href="index.html#Top">
|
||
|
<link rel="up" href="Controlling-GDB.html#Controlling-GDB" title="Controlling GDB">
|
||
|
<link rel="prev" href="Numbers.html#Numbers" title="Numbers">
|
||
|
<link rel="next" href="Auto_002dloading.html#Auto_002dloading" title="Auto-loading">
|
||
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
||
|
<!--
|
||
|
Copyright (C) 1988-2019 Free Software Foundation, Inc.
|
||
|
|
||
|
Permission is granted to copy, distribute and/or modify this document
|
||
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
||
|
any later version published by the Free Software Foundation; with the
|
||
|
Invariant Sections being ``Free Software'' and ``Free Software Needs
|
||
|
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
|
||
|
and with the Back-Cover Texts as in (a) below.
|
||
|
|
||
|
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
|
||
|
this GNU Manual. Buying copies from GNU Press supports the FSF in
|
||
|
developing GNU and promoting software freedom.''
|
||
|
-->
|
||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||
|
<style type="text/css"><!--
|
||
|
pre.display { font-family:inherit }
|
||
|
pre.format { font-family:inherit }
|
||
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
||
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
||
|
pre.smallexample { font-size:smaller }
|
||
|
pre.smalllisp { font-size:smaller }
|
||
|
span.sc { font-variant:small-caps }
|
||
|
span.roman { font-family:serif; font-weight:normal; }
|
||
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="node">
|
||
|
<a name="ABI"></a>
|
||
|
<p>
|
||
|
Next: <a rel="next" accesskey="n" href="Auto_002dloading.html#Auto_002dloading">Auto-loading</a>,
|
||
|
Previous: <a rel="previous" accesskey="p" href="Numbers.html#Numbers">Numbers</a>,
|
||
|
Up: <a rel="up" accesskey="u" href="Controlling-GDB.html#Controlling-GDB">Controlling GDB</a>
|
||
|
<hr>
|
||
|
</div>
|
||
|
|
||
|
<h3 class="section">22.7 Configuring the Current ABI</h3>
|
||
|
|
||
|
<p><span class="sc">gdb</span> can determine the <dfn>ABI</dfn> (Application Binary Interface) of your
|
||
|
application automatically. However, sometimes you need to override its
|
||
|
conclusions. Use these commands to manage <span class="sc">gdb</span>'s view of the
|
||
|
current ABI.
|
||
|
|
||
|
<p><a name="index-OS-ABI-1702"></a><a name="index-set-osabi-1703"></a><a name="index-show-osabi-1704"></a><a name="index-Newlib-OS-ABI-and-its-influence-on-the-longjmp-handling-1705"></a>
|
||
|
One <span class="sc">gdb</span> configuration can debug binaries for multiple operating
|
||
|
system targets, either via remote debugging or native emulation.
|
||
|
<span class="sc">gdb</span> will autodetect the <dfn>OS ABI</dfn> (Operating System ABI) in use,
|
||
|
but you can override its conclusion using the <code>set osabi</code> command.
|
||
|
One example where this is useful is in debugging of binaries which use
|
||
|
an alternate C library (e.g. <span class="sc">uClibc</span> for <span class="sc">gnu</span>/Linux) which does
|
||
|
not have the same identifying marks that the standard C library for your
|
||
|
platform provides.
|
||
|
|
||
|
<p>When <span class="sc">gdb</span> is debugging the AArch64 architecture, it provides a
|
||
|
“Newlib” OS ABI. This is useful for handling <code>setjmp</code> and
|
||
|
<code>longjmp</code> when debugging binaries that use the <span class="sc">newlib</span> C library.
|
||
|
The “Newlib” OS ABI can be selected by <code>set osabi Newlib</code>.
|
||
|
|
||
|
<dl>
|
||
|
<dt><code>show osabi</code><dd>Show the OS ABI currently in use.
|
||
|
|
||
|
<br><dt><code>set osabi</code><dd>With no argument, show the list of registered available OS ABI's.
|
||
|
|
||
|
<br><dt><code>set osabi </code><var>abi</var><dd>Set the current OS ABI to <var>abi</var>.
|
||
|
</dl>
|
||
|
|
||
|
<p><a name="index-float-promotion-1706"></a>
|
||
|
Generally, the way that an argument of type <code>float</code> is passed to a
|
||
|
function depends on whether the function is prototyped. For a prototyped
|
||
|
(i.e. ANSI/ISO style) function, <code>float</code> arguments are passed unchanged,
|
||
|
according to the architecture's convention for <code>float</code>. For unprototyped
|
||
|
(i.e. K&R style) functions, <code>float</code> arguments are first promoted to type
|
||
|
<code>double</code> and then passed.
|
||
|
|
||
|
<p>Unfortunately, some forms of debug information do not reliably indicate whether
|
||
|
a function is prototyped. If <span class="sc">gdb</span> calls a function that is not marked
|
||
|
as prototyped, it consults <kbd>set coerce-float-to-double</kbd>.
|
||
|
|
||
|
|
||
|
<a name="index-set-coerce_002dfloat_002dto_002ddouble-1707"></a>
|
||
|
<dl><dt><code>set coerce-float-to-double</code><dt><code>set coerce-float-to-double on</code><dd>Arguments of type <code>float</code> will be promoted to <code>double</code> when passed
|
||
|
to an unprototyped function. This is the default setting.
|
||
|
|
||
|
<br><dt><code>set coerce-float-to-double off</code><dd>Arguments of type <code>float</code> will be passed directly to unprototyped
|
||
|
functions.
|
||
|
|
||
|
<p><a name="index-show-coerce_002dfloat_002dto_002ddouble-1708"></a><br><dt><code>show coerce-float-to-double</code><dd>Show the current setting of promoting <code>float</code> to <code>double</code>.
|
||
|
</dl>
|
||
|
|
||
|
<p><a name="index-set-cp_002dabi-1709"></a><a name="index-show-cp_002dabi-1710"></a><span class="sc">gdb</span> needs to know the ABI used for your program's C<tt>++</tt>
|
||
|
objects. The correct C<tt>++</tt> ABI depends on which C<tt>++</tt> compiler was
|
||
|
used to build your application. <span class="sc">gdb</span> only fully supports
|
||
|
programs with a single C<tt>++</tt> ABI; if your program contains code using
|
||
|
multiple C<tt>++</tt> ABI's or if <span class="sc">gdb</span> can not identify your
|
||
|
program's ABI correctly, you can tell <span class="sc">gdb</span> which ABI to use.
|
||
|
Currently supported ABI's include “gnu-v2”, for <code>g++</code> versions
|
||
|
before 3.0, “gnu-v3”, for <code>g++</code> versions 3.0 and later, and
|
||
|
“hpaCC” for the HP ANSI C<tt>++</tt> compiler. Other C<tt>++</tt> compilers may
|
||
|
use the “gnu-v2” or “gnu-v3” ABI's as well. The default setting is
|
||
|
“auto”.
|
||
|
|
||
|
<dl>
|
||
|
<dt><code>show cp-abi</code><dd>Show the C<tt>++</tt> ABI currently in use.
|
||
|
|
||
|
<br><dt><code>set cp-abi</code><dd>With no argument, show the list of supported C<tt>++</tt> ABI's.
|
||
|
|
||
|
<br><dt><code>set cp-abi </code><var>abi</var><dt><code>set cp-abi auto</code><dd>Set the current C<tt>++</tt> ABI to <var>abi</var>, or return to automatic detection.
|
||
|
</dl>
|
||
|
|
||
|
</body></html>
|
||
|
|