Next: Auto-loading, Previous: Numbers, Up: Controlling GDB [Contents][Index]

### 22.6 Configuring the Current ABI

GDB can determine the ABI (Application Binary Interface) of your application automatically. However, sometimes you need to override its conclusions. Use these commands to manage GDB’s view of the current ABI.

One GDB configuration can debug binaries for multiple operating system targets, either via remote debugging or native emulation. GDB will autodetect the OS ABI (Operating System ABI) in use, but you can override its conclusion using the `set osabi` command. One example where this is useful is in debugging of binaries which use an alternate C library (e.g. UCLIBC for GNU/Linux) which does not have the same identifying marks that the standard C library for your platform provides.

When GDB is debugging the AArch64 architecture, it provides a “Newlib” OS ABI. This is useful for handling `setjmp` and `longjmp` when debugging binaries that use the NEWLIB C library. The “Newlib” OS ABI can be selected by `set osabi Newlib`.

`show osabi`

  Show the OS ABI currently in use.

`set osabi`

  With no argument, show the list of registered available OS ABI’s.

`set osabi abi`

  Set the current OS ABI to abi.

Generally, the way that an argument of type `float` is passed to a function depends on whether the function is prototyped. For a prototyped (i.e. ANSI/ISO style) function, `float` arguments are passed unchanged, according to the architecture’s convention for `float`. For unprototyped (i.e. K&R style) functions, `float` arguments are first promoted to type `double` and then passed.

Unfortunately, some forms of debug information do not reliably indicate whether a function is prototyped. If GDB calls a function that is not marked as prototyped, it consults `set coerce-float-to-double`.

`set coerce-float-to-double`
`set coerce-float-to-double on`

  Arguments of type `float` will be promoted to `double` when passed to an unprototyped function. This is the default setting.

`set coerce-float-to-double off`

  Arguments of type `float` will be passed directly to unprototyped functions.

`show coerce-float-to-double`

  Show the current setting of promoting `float` to `double`.

GDB needs to know the ABI used for your program’s C`++` objects. The correct C`++` ABI depends on which C`++` compiler was used to build your application. GDB only fully supports programs with a single C`++` ABI; if your program contains code using multiple C`++` ABI’s or if GDB can not identify your program’s ABI correctly, you can tell GDB which ABI to use. Currently supported ABI’s include “gnu-v2”, for `g++` versions before 3.0, “gnu-v3”, for `g++` versions 3.0 and later, and “hpaCC” for the HP ANSI C`++` compiler. Other C`++` compilers may use the “gnu-v2” or “gnu-v3” ABI’s as well. The default setting is “auto”.

`show cp-abi`

  Show the C`++` ABI currently in use.

`set cp-abi`

  With no argument, show the list of supported C`++` ABI’s.

`set cp-abi abi`
`set cp-abi auto`

  Set the current C`++` ABI to abi, or return to automatic detection.

Next: Auto-loading, Previous: Numbers, Up: Controlling GDB [Contents][Index]