GDB (xrefs)
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().

◆ 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 
)

◆ skip_spaces() [1/2]

char* skip_spaces ( char *  chp)

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

Referenced by aarch64_stap_parse_special_token(), ada_get_next_arg(), add_solib_catchpoint(), agent_command_1(), arm_stap_parse_special_token(), bppy_init(), break_range_command(), catch_ada_assert_command_split(), catch_ada_exception_command_split(), catch_exception_command_1(), catch_exec_command_1(), catch_fork_command_1(), catch_signal_command(), catch_signal_split_args(), catch_syscall_command_1(), catch_syscall_split_args(), check_raw_argument(), cmd_record_call_history(), cmd_record_insn_history(), collect_explicit_location_matches(), compile_code_command(), compile_file_command(), complete_line_internal_1(), condition_completer(), cp_search_name_hash(), decode_agent_options(), decode_static_tracepoint_spec(), decode_vmflags(), demangle_command(), disassemble_command(), disassembler_options_completer(), encode_actions_1(), ep_parse_optional_if_clause(), expand_preserving_ws(), extract_arg(), extract_exception_regexp(), find_condition_and_thread(), gdbscm_register_breakpoint_x(), get_call_history_modifiers(), get_context_size(), get_insn_history_modifiers(), get_insn_number(), number_or_range_parser::get_number(), get_number_trailer(), get_selected_pc_producer_options(), get_selections(), tid_range_parser::get_tid_or_range(), get_uint(), go32_pde(), go32_pte(), go32_pte_for_address(), go32_sgdt(), go32_sidt(), go32_sldt(), guile_command(), guile_repl_command(), info_auto_load_libthread_db(), info_macro_command(), info_threads_command(), init_breakpoint_sal(), init_history(), is_closing_quote_enclosed(), is_unlimited_literal(), lex_number(), line_first_arg(), linespec_lexer_lex_keyword(), linespec_lexer_lex_one(), linespec_lexer_lex_string(), linespec_parse_basic(), linux_fill_prpsinfo(), linux_info_proc(), maint_agent_printf_command(), maint_btrace_packet_history_cmd(), maintenance_translate_address(), mi_parse(), mi_parse_argv(), msymbol_hash_iw(), stap_probe::parse_arguments(), parse_cmd_to_aexpr(), parse_find_args(), parse_frame_specification(), parse_linespec(), parse_method(), parse_probes(), parse_proc_status_state(), parse_selector(), process_next_line(), python_command(), python_interactive_command(), rbreak_command(), read_mapping(), registers_info(), restore_command(), save_gdb_index_command(), scan_expression(), scan_filename(), serial_open(), set_completion_after_number(), set_ext_lang_command(), source_command(), stap_parse_argument(), stap_parse_argument_1(), stap_parse_argument_conditionally(), stap_parse_single_operand(), string_to_explicit_location(), strncmp_iw_with_mode(), tfind_outside_command(), tfind_range_command(), thread_apply_all_command(), thread_name_command(), trace_dump_actions(), trace_pass_command(), trace_variable_command(), ui_printf(), update_dprintf_command_list(), validate_actionline(), watch_command_1(), watch_maybe_just_location(), and whatis_exp().

◆ 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)

◆ 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().

Referenced by remote_set_syscall_catchpoint(), and selftests::string_appendf_tests().

◆ string_printf()

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

◆ string_vappendf()

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

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

Referenced by selftests::ATTRIBUTE_PRINTF(), and string_appendf().

◆ string_vprintf()

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

◆ stringify_argv()

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

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

References string.

◆ strtoulst()

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

◆ xcalloc()

PTR xcalloc ( size_t  number,
size_t  size 
)

◆ xmalloc()

PTR xmalloc ( size_t  size)

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

References malloc_failure(), and size.

Referenced by savestring().

◆ xmalloc_failed()

void xmalloc_failed ( size_t  size)

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

References malloc_failure(), and size.

◆ xrealloc()

PTR xrealloc ( PTR  ptr,
size_t  size 
)

◆ xsnprintf()

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

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

References gdb_assert, and size.

Referenced by _initialize_check_for_gdb_ini(), ada_decode(), ada_enum_name(), ada_to_fixed_type_1(), add_pe_forwarded_sym(), append_ocl_sos(), append_resumption(), arm_dwarf_reg_to_regnum(), arm_neon_quad_read(), arm_neon_quad_write(), arm_pseudo_read(), arm_pseudo_write(), arm_push_dummy_call(), arm_return_value(), bsd_kvm_pid_to_str(), bsd_uthread_pid_to_str(), btrace_sync_conf(), cmd_record_save(), condition_completer(), convert_ast_to_expression(), convert_between_encodings(), convert_char_literal(), core_pid_to_str(), core_xfer_partial(), cp_lookup_nested_symbol(), create_tracepoint_from_upload(), d_lookup_nested_symbol(), decimal2str(), define_command(), do_compile_dwarf_expr_to_c(), cli_ui_out::do_field_int(), mi_ui_out::do_field_int(), do_set_command(), document_command(), execute_control_command_1(), extended_remote_attach(), extended_remote_create_inferior(), extended_remote_disable_randomization(), extended_remote_restart(), extended_remote_set_inferior_cwd(), fbsd_core_pid_to_str(), fbsd_pid_to_exec_file(), fetch_ppc_register(), fetch_register(), file_file_name(), find_old_style_renaming_symbol(), floatformat_mantissa(), gdb_connect_sync_socket(), gdb_display_match_list(), gdb_mangle_name(), gnu_pid_to_str(), hex_string(), host_address_to_string_1(), info_auto_load_libthread_db(), info_spu_dma_command(), info_spu_event_command(), info_spu_mailbox_command(), info_spu_proxydma_command(), info_spu_signal_command(), init_source_path(), linux_fill_prpsinfo(), linux_find_memory_regions_full(), linux_info_proc(), linux_ns_filename(), linux_proc_attach_tgid_threads(), linux_proc_pending_signals(), linux_proc_pid_get_state(), linux_proc_pid_to_exec_file(), linux_proc_task_list_dir_exists(), linux_proc_tid_get_name(), linux_proc_xfer_partial(), linux_proc_xfer_spu(), linux_spu_make_corefile_notes(), linux_vsyscall_range_raw(), linux_xfer_osdata_fds(), linux_xfer_osdata_threads(), m68hc11_initialize_register_info(), make_hex_string(), make_types(), mi_argv_to_format(), nbsd_pid_to_exec_file(), normal_pid_to_str(), nto_find_and_open_solib(), nto_init_solib_absolute_prefix(), octal2str(), op_name_standard(), output_thread_groups(), phex(), phex_nz(), ppu2spu_sniffer(), print_source_lines_base(), print_thread_id(), print_wchar(), proc_string(), pstring_list(), remote_add_target_side_condition(), remote_check_symbols(), remote_detach_pid(), remote_disable_btrace(), remote_disable_tracepoint(), remote_download_trace_state_variable(), remote_download_tracepoint(), remote_enable_btrace(), remote_enable_tracepoint(), remote_get_min_fast_tracepoint_insn_len(), remote_get_noisy_reply(), remote_get_trace_state_variable_value(), remote_get_tracepoint_status(), remote_hostio_set_filesystem(), remote_insert_breakpoint(), remote_insert_hw_breakpoint(), remote_insert_watchpoint(), remote_interrupt_ns(), remote_pid_to_exec_file(), remote_pid_to_str(), remote_query_attached(), remote_remove_breakpoint(), remote_remove_hw_breakpoint(), remote_remove_watchpoint(), remote_resume_with_vcont(), remote_set_circular_trace_buffer(), remote_set_disconnected_tracing(), remote_set_permissions(), remote_set_trace_buffer_size(), remote_set_trace_notes(), remote_static_tracepoint_marker_at(), remote_stop_ns(), remote_thread_events(), remote_threads_extra_info(), remote_trace_find(), remote_trace_set_readonly_regions(), remote_use_agent(), remote_verify_memory(), remote_vkill(), rust_underscore_fields(), safe_strerror(), send_environment_packet(), send_g_packet(), set_thread(), set_variant_num_fprs(), set_variant_num_gprs(), sol2_core_pid_to_str(), solaris_pid_to_str(), solist_update_incremental(), spu_current_sos(), spu_enumerate_spu_ids(), spu_fetch_inferior_registers(), spu_fetch_registers(), spu_proc_xfer_spu(), spu_pseudo_register_read(), spu_pseudo_register_read_spu(), spu_pseudo_register_write(), spu_pseudo_register_write_spu(), spu_store_inferior_registers(), spu_store_registers(), spu_symbol_file_add_from_memory(), spu_xfer_partial(), store_register(), store_register_using_P(), svr4_create_solib_event_breakpoints(), td_err_string(), td_state_string(), trace_status_mi(), tui_make_status_line(), vcont_builder_restart(), windows_create_inferior(), windows_pid_to_exec_file(), and write_ptid().

◆ xstrprintf()

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

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

References xstrvprintf().

Referenced by _initialize_auto_load(), ada_exception_catchpoint_cond_string(), add_angle_brackets(), add_auto_load_dir(), add_auto_load_safe_path(), add_deprecated_target_alias(), add_internal_problem_command(), add_packet_config_cmd(), add_pe_exported_sym(), add_pe_forwarded_sym(), add_sal_to_sals(), add_setshow_cmd_full(), add_vsyscall_page(), aix_thread_pid_to_str(), all_tracepoint_actions_and_cleanup(), bppy_init(), build_error_marker_type(), c_watch_location_expression(), canonical_to_fullform(), captured_main_1(), command_from_pid(), commandline_from_pid(), create_type_unit_group(), decode_line_2(), default_gcc_target_options(), edit_command(), env_execute_cli_command(), event_location_to_string(), fixup_definition(), gcore_command(), gdbscm_gsmob_kind(), gdbscm_initialize_ports(), gdbscm_make_arg_error(), gdbscm_make_type_error(), gdbscm_parse_command_name(), gdbscm_set_breakpoint_stop_x(), get_function_name(), get_init_files(), i386_fast_tracepoint_valid_at(), init_cli_cmds(), is_package_name(), jit_reader_load_command(), linux_ptrace_attach_fail_reason_string(), linux_xfer_osdata_fds(), linux_xfer_osdata_threads(), new_variant(), ppscm_make_pp_type_error_exception(), print_converted_chars_to_obstack(), print_mention_exception(), print_one_breakpoint_location(), print_one_catch_solib(), print_one_catch_syscall(), print_one_exception(), procfs_xfer_auxv(), rust_watch_location_expression(), salpy_str(), set_cp_abi_as_auto_default(), solib_aix_bfd_open(), update_dprintf_command_list(), watch_command_1(), xtensa_init_reggroups(), and xtensa_register_type().

◆ xstrvprintf()

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

◆ xzalloc()

void* xzalloc ( size_t  size)