GDB (API)
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions | Variables
defs.h File Reference
#include "gdbsupport/common-defs.h"
#include <config.h>
#include "bfd.h"
#include <sys/types.h>
#include <climits>
#include <unistd.h>
#include <fcntl.h>
#include "gdb_wchar.h"
#include "ui-file.h"
#include "gdbsupport/host-defs.h"
#include "gdbsupport/enum-flags.h"
#include "gdbsupport/array-view.h"
#include "hashtab.h"
#include "fopen-bin.h"
#include "utils.h"

Go to the source code of this file.

Macros

#define GCC_GENERATED_STDINT_H   1
 
#define SEEK_SET   0
 
#define SEEK_CUR   1
 
#define O_BINARY   0
 
#define QUIT   maybe_quit ()
 
#define LANGUAGE_BITS   5
 
#define LANGUAGE_BYTES   ((LANGUAGE_BITS + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
 
#define ISATTY(FP)   (isatty (fileno (FP)))
 
#define GDB_MI_MSG_WIDTH   80
 

Typedefs

template<typename T >
using RequireLongest
 
typedef void quit_handler_ftype(void)
 
typedef void initialize_file_ftype(void)
 
typedef int(* find_memory_region_ftype) (CORE_ADDR addr, unsigned long size, int read, int write, int exec, int modified, bool memory_tagged, void *data)
 

Enumerations

enum  compile_i_scope_types {
  COMPILE_I_INVALID_SCOPE , COMPILE_I_SIMPLE_SCOPE , COMPILE_I_RAW_SCOPE , COMPILE_I_PRINT_ADDRESS_SCOPE ,
  COMPILE_I_PRINT_VALUE_SCOPE
}
 
enum  language {
  language_unknown , language_c , language_objc , language_rust ,
  language_cplus , language_d , language_go , language_fortran ,
  language_m2 , language_asm , language_pascal , language_opencl ,
  language_minimal , language_ada , nr_languages
}
 
enum  precision_type { single_precision , double_precision , unspecified_precision }
 
enum  auto_boolean { AUTO_BOOLEAN_TRUE , AUTO_BOOLEAN_FALSE , AUTO_BOOLEAN_AUTO }
 
enum  return_value_convention { RETURN_VALUE_REGISTER_CONVENTION , RETURN_VALUE_STRUCT_CONVENTION , RETURN_VALUE_ABI_RETURNS_ADDRESS , RETURN_VALUE_ABI_PRESERVES_ADDRESS }
 
enum  lval_type {
  not_lval , lval_memory , lval_register , lval_internalvar ,
  lval_xcallable , lval_internalvar_component , lval_computed
}
 
enum  info_proc_what {
  IP_MINIMAL , IP_MAPPINGS , IP_STATUS , IP_STAT ,
  IP_CMDLINE , IP_EXE , IP_CWD , IP_FILES ,
  IP_ALL
}
 
enum  symbol_needs_kind { SYMBOL_NEEDS_NONE , SYMBOL_NEEDS_REGISTERS , SYMBOL_NEEDS_FRAME }
 
enum  block_enum { GLOBAL_BLOCK = 0 , STATIC_BLOCK = 1 , FIRST_LOCAL_BLOCK = 2 }
 
enum  user_selected_what_flag { USER_SELECTED_INFERIOR = 1 << 1 , USER_SELECTED_THREAD = 1 << 2 , USER_SELECTED_FRAME = 1 << 3 }
 

Functions

int check_quit_flag (void)
 
void set_quit_flag (void)
 
void default_quit_handler (void)
 
void set_force_quit_flag ()
 
void quit (void)
 
void maybe_quit (void)
 
void quit_serial_event_set (void)
 
void quit_serial_event_clear (void)
 
 gdb_static_assert (nr_languages<=(1<< LANGUAGE_BITS))
 
std::string relocate_gdb_directory (const char *initial, bool relocatable)
 
EXTERN_C charre_comp (const char *)
 
void symbol_file_command (const char *, int)
 
chargdb_readline_wrapper (const char *)
 
const charcommand_line_input (std::string &cmd_line_buffer, const char *, const char *)
 
void print_prompt (void)
 
void set_next_address (struct gdbarch *, CORE_ADDR)
 
int print_address_symbolic (struct gdbarch *, CORE_ADDR, struct ui_file *, int, const char *)
 
void print_address (struct gdbarch *, CORE_ADDR, struct ui_file *)
 
const charpc_prefix (CORE_ADDR)
 
int longest_to_int (LONGEST)
 
template<typename T , typename = RequireLongest<T>>
extract_integer (gdb::array_view< const gdb_byte >, enum bfd_endian byte_order)
 
int extract_long_unsigned_integer (const gdb_byte *, int, enum bfd_endian, LONGEST *)
 
CORE_ADDR extract_typed_address (const gdb_byte *buf, struct type *type)
 
template<typename T , typename = RequireLongest<T>>
void store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order, T val)
 
void store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
 
void copy_integer_to_size (gdb_byte *dest, int dest_size, const gdb_byte *source, int source_size, bool is_signed, enum bfd_endian byte_order)
 
void initialize_progspace (void)
 
void initialize_inferiors (void)
 
 DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what)
 

Variables

std::string gdb_sysroot
 
std::string gdb_datadir
 
std::string python_libdir
 
std::string debug_file_directory
 
quit_handler_ftypequit_handler
 
volatile bool sync_quit_force_run
 
int annotation_level
 
bool info_verbose
 
unsigned input_radix
 
unsigned output_radix
 
void(* deprecated_pre_add_symbol_hook )(const char *)
 
void(* deprecated_post_add_symbol_hook )(void)
 
void(* selected_frame_level_changed_hook )(int)
 
int(* deprecated_ui_loop_hook )(int signo)
 
void(* deprecated_show_load_progress )(const char *section, unsigned long section_sent, unsigned long section_size, unsigned long total_sent, unsigned long total_size)
 
void(* deprecated_print_frame_info_listing_hook )(struct symtab *s, int line, int stopline, int noerror)
 
int(* deprecated_query_hook )(const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1
 
int void(* deprecated_warning_hook )(const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1
 
int void void(* deprecated_readline_begin_hook )(const char *,...) ATTRIBUTE_FPTR_PRINTF_1
 
char *(* deprecated_readline_hook )(const char *)
 
void(* deprecated_readline_end_hook )(void)
 
void(* deprecated_context_hook )(int)
 
ptid_t(* deprecated_target_wait_hook )(ptid_t ptid, struct target_waitstatus *status, int options)
 
void(* deprecated_attach_hook )(void)
 
void(* deprecated_detach_hook )(void)
 
void(* deprecated_call_command_hook )(struct cmd_list_element *c, const char *cmd, int from_tty)
 
int(* deprecated_ui_load_progress_hook )(const char *section, unsigned long num)
 

Macro Definition Documentation

◆ GCC_GENERATED_STDINT_H

#define GCC_GENERATED_STDINT_H   1

Definition at line 52 of file defs.h.

◆ GDB_MI_MSG_WIDTH

#define GDB_MI_MSG_WIDTH   80

A width that can achieve a better legibility for GDB MI mode.

Definition at line 574 of file defs.h.

◆ ISATTY

#define ISATTY ( FP)    (isatty (fileno (FP)))

Definition at line 570 of file defs.h.

◆ LANGUAGE_BITS

#define LANGUAGE_BITS   5

Definition at line 231 of file defs.h.

◆ LANGUAGE_BYTES

#define LANGUAGE_BYTES   ((LANGUAGE_BITS + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)

Definition at line 235 of file defs.h.

◆ O_BINARY

#define O_BINARY   0

Definition at line 114 of file defs.h.

◆ QUIT

#define QUIT   maybe_quit ()

Definition at line 187 of file defs.h.

◆ SEEK_CUR

#define SEEK_CUR   1

Definition at line 104 of file defs.h.

◆ SEEK_SET

#define SEEK_SET   0

Definition at line 101 of file defs.h.

Typedef Documentation

◆ find_memory_region_ftype

Process memory area starting at ADDR with length SIZE. Area is readable iff READ is non-zero, writable if WRITE is non-zero, executable if EXEC is non-zero. Area is possibly changed against its original file based copy if MODIFIED is non-zero.

MEMORY_TAGGED is true if the memory region contains memory tags, false otherwise.

DATA is passed without changes from a caller.

Definition at line 350 of file defs.h.

◆ initialize_file_ftype

typedef void initialize_file_ftype(void)

Definition at line 314 of file defs.h.

◆ quit_handler_ftype

typedef void quit_handler_ftype(void)

Definition at line 160 of file defs.h.

◆ RequireLongest

Initial value:
gdb::Requires<gdb::Or<std::is_same<T, LONGEST>,
std::is_same<T, ULONGEST>>>

Definition at line 95 of file defs.h.

Enumeration Type Documentation

◆ auto_boolean

A generic, not quite boolean, enumeration. This is used for set/show commands in which the options are on/off/automatic.

Enumerator
AUTO_BOOLEAN_TRUE 
AUTO_BOOLEAN_FALSE 
AUTO_BOOLEAN_AUTO 

Definition at line 246 of file defs.h.

◆ block_enum

Special block numbers

Enumerator
GLOBAL_BLOCK 
STATIC_BLOCK 
FIRST_LOCAL_BLOCK 

Definition at line 583 of file defs.h.

◆ compile_i_scope_types

Enumerator
COMPILE_I_INVALID_SCOPE 
COMPILE_I_SIMPLE_SCOPE 
COMPILE_I_RAW_SCOPE 
COMPILE_I_PRINT_ADDRESS_SCOPE 
COMPILE_I_PRINT_VALUE_SCOPE 

Definition at line 69 of file defs.h.

◆ info_proc_what

Parameters of the "info proc" command.

Enumerator
IP_MINIMAL 

Display the default cmdline, cwd and exe outputs.

IP_MAPPINGS 

Display ‘info proc mappings’.

IP_STATUS 

Display ‘info proc status’.

IP_STAT 

Display ‘info proc stat’.

IP_CMDLINE 

Display ‘info proc cmdline’.

IP_EXE 

Display ‘info proc exe’.

IP_CWD 

Display ‘info proc cwd’.

IP_FILES 

Display ‘info proc files’.

IP_ALL 

Display all of the above.

Definition at line 379 of file defs.h.

◆ language

Languages represented in the symbol table and elsewhere. This should probably be in language.h, but since enum's can't be forward declared to satisfy opaque references before their actual definition, needs to be here.

The constants here are in priority order. In particular, demangling is attempted according to this order.

Note that there's ambiguity between the mangling schemes of some of these languages, so some symbols could be successfully demangled by several languages. For that reason, the constants here are sorted in the order we'll attempt demangling them. For example: Rust uses a C++-compatible mangling, so must come before C++; Ada must come last (see ada_sniff_from_mangled_name).

Enumerator
language_unknown 
language_c 
language_objc 
language_rust 
language_cplus 
language_d 
language_go 
language_fortran 
language_m2 
language_asm 
language_pascal 
language_opencl 
language_minimal 
language_ada 
nr_languages 

Definition at line 210 of file defs.h.

◆ lval_type

Possible lvalue types. Like enum language, this should be in value.h, but needs to be here for the same reason.

Enumerator
not_lval 

Not an lval.

lval_memory 

In memory.

lval_register 

In a register. Registers are relative to a frame.

lval_internalvar 

In a gdb internal variable.

lval_xcallable 

Value encapsulates a callable defined in an extension language.

lval_internalvar_component 

Part of a gdb internal variable (structure field).

lval_computed 

Value's bits are fetched and stored using functions provided by its creator.

Definition at line 358 of file defs.h.

◆ precision_type

Enumerator
single_precision 
double_precision 
unspecified_precision 

Definition at line 237 of file defs.h.

◆ return_value_convention

Potential ways that a function can return a value of a given type.

Enumerator
RETURN_VALUE_REGISTER_CONVENTION 

Where the return value has been squeezed into one or more registers.

RETURN_VALUE_STRUCT_CONVENTION 

Commonly known as the "struct return convention". The caller passes an additional hidden first parameter to the caller. That parameter contains the address at which the value being returned should be stored. While typically, and historically, used for large structs, this is convention is applied to values of many different types.

RETURN_VALUE_ABI_RETURNS_ADDRESS 

Like the "struct return convention" above, but where the ABI guarantees that the called function stores the address at which the value being returned is stored in a well-defined location, such as a register or memory slot in the stack frame. Don't use this if the ABI doesn't explicitly guarantees this.

RETURN_VALUE_ABI_PRESERVES_ADDRESS 

Like the "struct return convention" above, but where the ABI guarantees that the address at which the value being returned is stored will be available in a well-defined location, such as a register or memory slot in the stack frame. Don't use this if the ABI doesn't explicitly guarantees this.

Definition at line 256 of file defs.h.

◆ symbol_needs_kind

Enumerator
SYMBOL_NEEDS_NONE 
SYMBOL_NEEDS_REGISTERS 
SYMBOL_NEEDS_FRAME 

Definition at line 447 of file defs.h.

◆ user_selected_what_flag

Enumerator
USER_SELECTED_INFERIOR 
USER_SELECTED_THREAD 
USER_SELECTED_FRAME 

Definition at line 592 of file defs.h.

Function Documentation

◆ check_quit_flag()

int check_quit_flag ( void )
extern

Evaluate to non-zero if the quit flag is set, zero otherwise. This will clear the quit flag as a side effect.

◆ command_line_input()

const char * command_line_input ( std::string & cmd_line_buffer,
const char * ,
const char *  )
extern

◆ copy_integer_to_size()

void copy_integer_to_size ( gdb_byte * dest,
int dest_size,
const gdb_byte * source,
int source_size,
bool is_signed,
enum bfd_endian byte_order )
extern

◆ DEF_ENUM_FLAGS_TYPE()

DEF_ENUM_FLAGS_TYPE ( enum user_selected_what_flag,
user_selected_what  )

◆ default_quit_handler()

void default_quit_handler ( void )
extern

◆ extract_integer()

template<typename T , typename = RequireLongest<T>>
T extract_integer ( gdb::array_view< const gdb_byte > ,
enum bfd_endian byte_order )

◆ extract_long_unsigned_integer()

int extract_long_unsigned_integer ( const gdb_byte * ,
int ,
enum bfd_endian,
LONGEST *  )
extern

◆ extract_typed_address()

CORE_ADDR extract_typed_address ( const gdb_byte * buf,
struct type * type )
extern

◆ gdb_readline_wrapper()

char * gdb_readline_wrapper ( const char * )
extern

◆ gdb_static_assert()

gdb_static_assert ( nr_languages<= 1<< LANGUAGE_BITS)

◆ initialize_inferiors()

void initialize_inferiors ( void )
extern

◆ initialize_progspace()

void initialize_progspace ( void )
extern

◆ longest_to_int()

int longest_to_int ( LONGEST )
extern

Optional native machine support. Non-native (and possibly pure multi-arch) targets do not need a "nm.h" file. This will be a symlink to one of the nm-*.h files, built by the ‘configure’ script.
Convert a LONGEST to an int. This is used in contexts (e.g. number of arguments to a function, number in a value history, register number, etc.) where the value must not be larger than can fit in an int.

◆ maybe_quit()

void maybe_quit ( void )
extern

◆ pc_prefix()

const char * pc_prefix ( CORE_ADDR )
extern

◆ print_address()

void print_address ( struct gdbarch * ,
CORE_ADDR ,
struct ui_file *  )
extern

◆ print_address_symbolic()

int print_address_symbolic ( struct gdbarch * ,
CORE_ADDR ,
struct ui_file * ,
int ,
const char *  )
extern

◆ print_prompt()

void print_prompt ( void )
extern

◆ quit()

void quit ( void )
extern

◆ quit_serial_event_clear()

void quit_serial_event_clear ( void )
extern

◆ quit_serial_event_set()

void quit_serial_event_set ( void )
extern

◆ re_comp()

EXTERN_C char * re_comp ( const char * )

◆ relocate_gdb_directory()

std::string relocate_gdb_directory ( const char * initial,
bool relocatable )
extern

◆ set_force_quit_flag()

void set_force_quit_flag ( )
extern

◆ set_next_address()

void set_next_address ( struct gdbarch * ,
CORE_ADDR  )
extern

◆ set_quit_flag()

void set_quit_flag ( void )
extern

Set the quit flag.

◆ store_integer()

template<typename T , typename = RequireLongest<T>>
void store_integer ( gdb_byte * addr,
int len,
enum bfd_endian byte_order,
T val )
extern

◆ store_typed_address()

void store_typed_address ( gdb_byte * buf,
struct type * type,
CORE_ADDR addr )
extern

◆ symbol_file_command()

void symbol_file_command ( const char * ,
int  )
extern

Variable Documentation

◆ annotation_level

int annotation_level
extern

◆ debug_file_directory

std::string debug_file_directory
extern

Search path for separate debug files.

◆ deprecated_attach_hook

void(* deprecated_attach_hook) (void) ( void )
extern

◆ deprecated_call_command_hook

void(* deprecated_call_command_hook) (struct cmd_list_element *c, const char *cmd, int from_tty) ( struct cmd_list_element * c,
const char * cmd,
int from_tty )
extern

◆ deprecated_context_hook

void(* deprecated_context_hook) (int) ( int )
extern

◆ deprecated_detach_hook

void(* deprecated_detach_hook) (void) ( void )
extern

◆ deprecated_post_add_symbol_hook

void(* deprecated_post_add_symbol_hook) (void) ( void )
extern

◆ deprecated_pre_add_symbol_hook

void(* deprecated_pre_add_symbol_hook) (const char *) ( const char * )
extern

◆ deprecated_print_frame_info_listing_hook

void(* deprecated_print_frame_info_listing_hook) (struct symtab *s, int line, int stopline, int noerror) ( struct symtab * s,
int line,
int stopline,
int noerror )
extern

◆ deprecated_query_hook

int(* deprecated_query_hook) (const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1 ( const char * ,
va_list  )
extern

◆ deprecated_readline_begin_hook

int void void(* deprecated_readline_begin_hook) (const char *,...) ATTRIBUTE_FPTR_PRINTF_1 ( const char * ,
... )
extern

◆ deprecated_readline_end_hook

void(* deprecated_readline_end_hook) (void) ( void )
extern

◆ deprecated_readline_hook

char *(* deprecated_readline_hook) (const char *) ( const char * )
extern

◆ deprecated_show_load_progress

void(* deprecated_show_load_progress) (const char *section, unsigned long section_sent, unsigned long section_size, unsigned long total_sent, unsigned long total_size) ( const char * section,
unsigned long section_sent,
unsigned long section_size,
unsigned long total_sent,
unsigned long total_size )
extern

◆ deprecated_target_wait_hook

ptid_t(* deprecated_target_wait_hook) (ptid_t ptid, struct target_waitstatus *status, int options) ( ptid_t ptid,
struct target_waitstatus * status,
int options )
extern

◆ deprecated_ui_load_progress_hook

int(* deprecated_ui_load_progress_hook) (const char *section, unsigned long num) ( const char * section,
unsigned long num )
extern

◆ deprecated_ui_loop_hook

int(* deprecated_ui_loop_hook) (int signo) ( int signo)
extern

◆ deprecated_warning_hook

int void(* deprecated_warning_hook) (const char *, va_list) ATTRIBUTE_FPTR_PRINTF(1 ( const char * ,
va_list  )
extern

◆ gdb_datadir

std::string gdb_datadir
extern

GDB datadir, used to store data files.

◆ gdb_sysroot

std::string gdb_sysroot
extern

System root path, used to find libraries etc.

◆ info_verbose

bool info_verbose
extern

◆ input_radix

unsigned input_radix
extern

Default radixes for input and output. Only some values supported.

◆ output_radix

unsigned output_radix
extern

◆ python_libdir

std::string python_libdir
extern

If not empty, the possibly relocated path to python's "lib" directory specified with –with-python.

◆ quit_handler

quit_handler_ftype* quit_handler
extern

◆ selected_frame_level_changed_hook

void(* selected_frame_level_changed_hook) (int) ( int )
extern

◆ sync_quit_force_run

volatile bool sync_quit_force_run
extern