This page was produced by an automated import process, and may have formatting errors; feel free to fix. [Operating-System-ABI-Variant-Handling ]

Operating System ABI Variant Handling

GDB provides a mechanism for handling variations in OS ABIs. An OS ABI variant may have influence over any number of variables in the target architecture definition. There are two major components in the OS ABI mechanism: sniffers and handlers.

A sniffer examines a file matching a BFD architecture/flavour pair (the architecture may be wildcarded) in an attempt to determine the OS ABI of that file. Sniffers with a wildcarded architecture are considered to be generic, while sniffers for a specific architecture are considered to be specific. A match from a specific sniffer overrides a match from a generic sniffer. Multiple sniffers for an architecture/flavour may exist, in order to differentiate between two different operating systems which use the same basic file format. The OS ABI framework provides a generic sniffer for ELF-format files which examines the EI_OSABI field of the ELF header, as well as note sections known to be used by several operating systems.

A handler is used to fine-tune the gdbarch structure for the selected OS ABI. There may be only one handler for a given OS ABI for each BFD architecture.

The following OS ABI variants are defined in defs.h:

Used for struct gdbarch_info if ABI is still uninitialized.

The ABI of the inferior is unknown. The default gdbarch settings for the architecture will be used.

UNIX System V Release 4.

GNU using the Hurd kernel.

Sun Solaris.

OSF/1, including Digital UNIX and Compaq Tru64 UNIX.

GNU using the Linux kernel.

FreeBSD using the a.out executable format.

FreeBSD using the ELF executable format.

NetBSD using the a.out executable format.

NetBSD using the ELF executable format.

OpenBSD using the ELF executable format.

Windows CE.



HP/UX using the ELF executable format.

HP/UX using the SOM executable format.

QNX Neutrino.



Here are the functions that make up the OS ABI framework:

Function: ''const char *'' gdbarch_osabi_name ''(enum gdb_osabi ''osabi'')''

Return the name of the OS ABI corresponding to osabi.

Function: ''void'' gdbarch_register_osabi ''(enum bfd_architecture ''arch'', unsigned long ''machine'', enum gdb_osabi ''osabi'', void (*''init_osabi'')(struct gdbarch_info ''info'', struct gdbarch *''gdbarch''))''

Register the OS ABI handler specified by init_osabi for the architecture, machine type and OS ABI specified by arch, machine and osabi. In most cases, a value of zero for the machine type, which implies the architecture’s default machine type, will suffice.

Function: ''void'' gdbarch_register_osabi_sniffer ''(enum bfd_architecture ''arch'', enum bfd_flavour ''flavour'', enum gdb_osabi (*''sniffer'')(bfd *''abfd''))''

Register the OS ABI file sniffer specified by sniffer for the BFD architecture/flavour pair specified by arch and flavour. If arch is bfd_arch_unknown, the sniffer is considered to be generic, and is allowed to examine flavour-flavoured files for any architecture.

Function: ''enum gdb_osabi'' gdbarch_lookup_osabi ''(bfd *''abfd'')''

Examine the file described by abfd to determine its OS ABI. The value GDB_OSABI_UNKNOWN is returned if the OS ABI cannot be determined.

Function: ''void'' gdbarch_init_osabi ''(struct gdbarch info ''info'', struct gdbarch *''gdbarch'', enum gdb_osabi ''osabi'')''

Invoke the OS ABI handler corresponding to osabi to fine-tune the gdbarch structure specified by gdbarch. If a handler corresponding to osabi has not been registered for gdbarch’s architecture, a warning will be issued and the debugging session will continue with the defaults already established for gdbarch.

Function: ''void'' generic_elf_osabi_sniff_abi_tag_sections ''(bfd *''abfd'', asection *''sect'', void *''obj'')''

Helper routine for ELF file sniffers. Examine the file described by abfd and look at ABI tag note sections to determine the OS ABI from the note. This function should be called via bfd_map_over_sections.

None: Internals OS-ABI-Variant-Handling (last edited 2013-09-02 23:16:15 by YaoQi)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.