GDBserver

Macros | Functions
common-utils.c File Reference
`#include "common-defs.h"`
`#include "common-utils.h"`
`#include "host-defs.h"`
`#include <ctype.h>`

Go to the source code of this file.

## Macros
#define | HIGH_BYTE_POSN ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT)

## Functions
PTR | xmalloc (size_t size)
PTR | xrealloc (PTR ptr, size_t size)
PTR | xcalloc (size_t number, size_t size)
void * | xzalloc (size_t size)
void | xmalloc_failed (size_t size)
char * | xstrprintf (const char *format,...)
char * | xstrvprintf (const char *format, va_list ap)
int | xsnprintf (char *str, size_t size, const char *format,...)
std::string | string_printf (const char *fmt,...)
std::string | string_vprintf (const char *fmt, va_list args)
void | string_appendf (std::string &str, const char *fmt,...)
void | string_vappendf (std::string &str, const char *fmt, va_list args)
char * | savestring (const char *ptr, size_t len)
static int | is_digit_in_base (unsigned char digit, int base)
static int | digit_to_int (unsigned char c)
ULONGEST | strtoulst (const char *num, const char **trailer, int base)
char * | skip_spaces (char *chp)
const char * | skip_spaces (const char *chp)
const char * | skip_to_space (const char *chp)
char * | skip_to_space (char *chp)
void | free_vector_argv (std::vector< char *> &v)
std::string | stringify_argv (const std::vector< char *> &args)

## Macro Definition Documentation

## ◆ HIGH_BYTE_POSN

#define HIGH_BYTE_POSN ((sizeof (ULONGEST) - 1) * HOST_CHAR_BIT)

Definition at line 238 of file common-utils.c.

Referenced by strtoulst().

## Function Documentation

## ◆ digit_to_int()

static int digit_to_int | ( | unsigned char | c | ) |
| static

Definition at line 255 of file common-utils.c.

Referenced by strtoulst().

## ◆ free_vector_argv()

void free_vector_argv | ( | std::vector< char *> & | v | ) |

Definition at line 381 of file common-utils.c.

References xfree().

Referenced by handle_v_run().

## ◆ is_digit_in_base()

static int is_digit_in_base | ( | unsigned char | digit,
|  | int | base
| ) |  |
| static

Definition at line 244 of file common-utils.c.

Referenced by strtoulst().

## ◆ savestring()

char* savestring | ( | const char * | ptr,
|  | size_t | len
| ) |  |

Definition at line 226 of file common-utils.c.

References xmalloc().

Referenced by add_tracepoint_action().

## ◆ skip_spaces() [1/2]

char* skip_spaces | ( | char * | chp | ) |

Definition at line 337 of file common-utils.c.

Referenced by parse_proc_status_state().

## ◆ skip_spaces() [2/2]

const char* skip_spaces | ( | const char * | chp | ) |

Definition at line 349 of file common-utils.c.

## ◆ skip_to_space() [1/2]

const char* skip_to_space | ( | const char * | chp | ) |

Definition at line 361 of file common-utils.c.

Referenced by skip_to_space().

## ◆ skip_to_space() [2/2]

char* skip_to_space | ( | char * | chp | ) |

Definition at line 373 of file common-utils.c.

References skip_to_space().

## ◆ string_appendf()

void string_appendf | ( | std::string & | str,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 195 of file common-utils.c.

References string_vappendf().

## ◆ string_printf()

std::string string_printf | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 150 of file common-utils.c.

References string, and vsnprintf().

Referenced by handle_qxfer_libraries().

## ◆ string_vappendf()

void string_vappendf | ( | std::string & | str,
|  | const char * | fmt,
|  | va_list | args
| ) |  |

Definition at line 208 of file common-utils.c.

References vsnprintf().

Referenced by string_appendf().

## ◆ string_vprintf()

std::string string_vprintf | ( | const char * | fmt,
|  | va_list | args
| ) |  |

Definition at line 173 of file common-utils.c.

References string, and vsnprintf().

## ◆ stringify_argv()

std::string stringify_argv | ( | const std::vector< char *> & | args | ) |

Definition at line 392 of file common-utils.c.

References string.

Referenced by linux_create_inferior(), lynx_create_inferior(), nto_create_inferior(), spu_create_inferior(), and win32_create_inferior().

## ◆ strtoulst()

ULONGEST strtoulst | ( | const char * | num,
|  | const char ** | trailer,
|  | int | base
| ) |  |

Definition at line 266 of file common-utils.c.

References digit_to_int(), errno, HIGH_BYTE_POSN, and is_digit_in_base().

## ◆ xcalloc()

PTR xcalloc | ( | size_t | number,
|  | size_t | size
| ) |  |

Definition at line 72 of file common-utils.c.

References malloc_failure().

Referenced by clone_agent_expr(), init_register_cache(), linux_xfer_osdata_processes(), set_fast_tracepoint_jump(), and xzalloc().

## ◆ xmalloc()

PTR xmalloc | ( | size_t | size | ) |

Definition at line 35 of file common-utils.c.

References malloc_failure().

Referenced by agent_mem_read_string(), append_insns(), arm_read_description(), btrace_data_append(), captured_main(), cmd_qtdpsrc(), cmd_qtdv(), cmd_qtnotes(), commandline_from_pid(), decode_M_packet(), decode_X_packet(), delim_string_to_char_ptr_vec_append(), format_pieces::format_pieces(), gdb_parse_agent_expr(), gdb_unparse_agent_expr(), handle_pread(), handle_v_run(), init_register_cache(), initialize_tracepoint(), linux_fork_to_function(), linux_qxfer_libraries_svr4(), look_up_one_symbol(), lynx_fetch_registers(), lynx_store_registers(), monitor_output(), putpkt_binary_1(), relocate_instruction(), require_data(), savestring(), try_thread_db_load_from_dir(), and write_inferior_memory().

## ◆ xmalloc_failed()

void xmalloc_failed | ( | size_t | size | ) |

Definition at line 98 of file common-utils.c.

References malloc_failure().

## ◆ xrealloc()

PTR xrealloc | ( | PTR | ptr,
|  | size_t | size
| ) |  |

Definition at line 52 of file common-utils.c.

References malloc_failure().

Referenced by buffer_grow(), commandline_from_pid(), init_trace_buffer(), linux_common_core_of_thread(), linux_qxfer_libraries_svr4(), and vec_o_reserve().

## ◆ xsnprintf()

int xsnprintf | ( | char * | str,
|  | size_t | size,
|  | const char * | format,
|  |  | ...
| ) |  |

Definition at line 134 of file common-utils.c.

References gdb_assert, and vsnprintf().

Referenced by decimal2str(), do_attach(), gdb_connect_sync_socket(), get_phdr_phnum_from_proc_auxv(), hex_string(), host_address_to_string_1(), linux_ns_filename(), linux_proc_attach_tgid_threads(), linux_proc_pid_get_state(), linux_proc_pid_to_exec_file(), linux_proc_task_list_dir_exists(), linux_proc_tid_get_name(), linux_qxfer_libraries_svr4(), linux_read_auxv(), linux_xfer_osdata_fds(), linux_xfer_osdata_threads(), notif_push(), octal2str(), phex(), phex_nz(), safe_strerror(), target_pid_to_str(), and thread_db_err_str().

## ◆ xstrprintf()

char* xstrprintf | ( | const char * | format,
|  |  | ...
| ) |  |

Definition at line 107 of file common-utils.c.

References xstrvprintf().

Referenced by command_from_pid(), commandline_from_pid(), linux_ptrace_attach_fail_reason_string(), linux_xfer_osdata_fds(), linux_xfer_osdata_threads(), and parse_debug_format_options().

## ◆ xstrvprintf()

char* xstrvprintf | ( | const char * | format,
|  | va_list | ap
| ) |  |

Definition at line 119 of file common-utils.c.

References _, internal_error(), and vasprintf().

Referenced by ATTRIBUTE_PRINTF(), and xstrprintf().

## ◆ xzalloc()

void* xzalloc | ( | size_t | size | ) |

Definition at line 92 of file common-utils.c.

References xcalloc().