GDB (xrefs)

Classes | Macros | Functions
/tmp/gdb-8.1/gdb/location.c File Reference
`#include "defs.h"`
`#include "gdb_assert.h"`
`#include "location.h"`
`#include "symtab.h"`
`#include "language.h"`
`#include "linespec.h"`
`#include "cli/cli-utils.h"`
`#include "probe.h"`
`#include "cp-support.h"`
`#include <ctype.h>`
`#include <string.h>`

Go to the source code of this file.

## Classes
struct | event_location

## Macros
#define | EL_TYPE(P) (P)->type
#define | EL_PROBE(P) ((P)->u.addr_string)
#define | EL_LINESPEC(P) (&(P)->u.linespec_location)
#define | EL_ADDRESS(P) (P)->u.address
#define | EL_EXPLICIT(P) (&((P)->u.explicit_loc))
#define | EL_STRING(P) ((P)->as_string)

## Functions
enum event_location_type | event_location_type (const struct event_location *location)
void | initialize_explicit_location (struct explicit_location *explicit_loc)
event_location_up | new_linespec_location (const char **linespec, symbol_name_match_type match_type)
const linespec_location * | get_linespec_location (const struct event_location *location)
event_location_up | new_address_location (CORE_ADDR addr, const char *addr_string, int addr_string_len)
CORE_ADDR | get_address_location (const struct event_location *location)
const char * | get_address_string_location (const struct event_location *location)
event_location_up | new_probe_location (const char *probe)
const char * | get_probe_location (const struct event_location *location)
event_location_up | new_explicit_location (const struct explicit_location *explicit_loc)
struct explicit_location * | get_explicit_location (struct event_location *location)
const struct explicit_location * | get_explicit_location_const (const struct event_location *location)
static char * | explicit_to_string_internal (int as_linespec, const struct explicit_location *explicit_loc)
char * | explicit_location_to_string (const struct explicit_location *explicit_loc)
char * | explicit_location_to_linespec (const struct explicit_location *explicit_loc)
event_location_up | copy_event_location (const struct event_location *src)
const char * | event_location_to_string (struct event_location *location)
static const char * | find_end_quote (const char *s, char end_quote_char)
static gdb::unique_xmalloc_ptr< char > | explicit_location_lex_one (const char **inp, const struct language_defn *language, explicit_completion_info *completion_info)
static bool | is_cp_operator (const char *start, const char *comma)
static const char * | skip_op_false_positives (const char *start, const char *found)
static const char * | first_of (const char *first, const char *new_tok)
static gdb::unique_xmalloc_ptr< char > | explicit_location_lex_one_function (const char **inp, const struct language_defn *language, explicit_completion_info *completion_info)
event_location_up | string_to_explicit_location (const char **argp, const struct language_defn *language, explicit_completion_info *completion_info)
event_location_up | string_to_event_location_basic (const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
event_location_up | string_to_event_location (const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
int | event_location_empty_p (const struct event_location *location)
void | set_event_location_string (struct event_location *location, const char *string)

## Macro Definition Documentation

## ◆ EL_ADDRESS

#define EL_ADDRESS | ( |  | P | ) | (P)->u.address

Definition at line 54 of file location.c.

Referenced by copy_event_location(), event_location_to_string(), get_address_location(), and new_address_location().

## ◆ EL_EXPLICIT

#define EL_EXPLICIT | ( |  | P | ) | (&((P)->u.explicit_loc))

Definition at line 58 of file location.c.

Referenced by copy_event_location(), event_location_empty_p(), event_location_to_string(), get_explicit_location(), get_explicit_location_const(), new_explicit_location(), event_location_deleter::operator()(), string_to_event_location(), and string_to_explicit_location().

## ◆ EL_LINESPEC

#define EL_LINESPEC | ( |  | P | ) | (&(P)->u.linespec_location)

Definition at line 50 of file location.c.

Referenced by copy_event_location(), event_location_to_string(), get_linespec_location(), new_linespec_location(), and event_location_deleter::operator()().

## ◆ EL_PROBE

#define EL_PROBE | ( |  | P | ) | ((P)->u.addr_string)

Definition at line 46 of file location.c.

Referenced by copy_event_location(), event_location_empty_p(), event_location_to_string(), get_probe_location(), new_probe_location(), and event_location_deleter::operator()().

## ◆ EL_STRING

#define EL_STRING | ( |  | P | ) | ((P)->as_string)

Definition at line 64 of file location.c.

Referenced by copy_event_location(), event_location_to_string(), get_address_string_location(), new_address_location(), event_location_deleter::operator()(), and set_event_location_string().

## ◆ EL_TYPE

#define EL_TYPE | ( |  | P | ) | (P)->type

Definition at line 40 of file location.c.

Referenced by copy_event_location(), event_location_empty_p(), event_location_to_string(), event_location_type(), get_address_location(), get_address_string_location(), get_explicit_location(), get_explicit_location_const(), get_linespec_location(), get_probe_location(), new_address_location(), new_explicit_location(), new_linespec_location(), new_probe_location(), and event_location_deleter::operator()().

## Function Documentation

## ◆ copy_event_location()

event_location_up copy_event_location | ( | const struct event_location * | src | ) |

Definition at line 307 of file location.c.

References ADDRESS_LOCATION, EL_ADDRESS, EL_EXPLICIT, EL_LINESPEC, EL_PROBE, EL_STRING, EL_TYPE, EXPLICIT_LOCATION, gdb_assert_not_reached, LINESPEC_LOCATION, PROBE_LOCATION, and XCNEW.

Referenced by create_breakpoint(), create_breakpoints_sal(), event_location_to_sals(), new_explicit_location(), and strace_marker_create_breakpoints_sal().

## ◆ event_location_empty_p()

int event_location_empty_p | ( | const struct event_location * | location | ) |

Definition at line 951 of file location.c.

References ADDRESS_LOCATION, EL_EXPLICIT, EL_PROBE, EL_TYPE, EXPLICIT_LOCATION, gdb_assert_not_reached, LINE_OFFSET_UNKNOWN, LINESPEC_LOCATION, PROBE_LOCATION, and line_offset::sign.

Referenced by breakpoint_event_location_empty_p(), and string_to_event_location().

## ◆ event_location_to_string()

const char* event_location_to_string | ( | struct event_location * | location | ) |

Definition at line 397 of file location.c.

References ADDRESS_LOCATION, core_addr_to_string(), EL_ADDRESS, EL_EXPLICIT, EL_LINESPEC, EL_PROBE, EL_STRING, EL_TYPE, EXPLICIT_LOCATION, explicit_location_to_string(), FULL, gdb_assert_not_reached, LINESPEC_LOCATION, linespec_location::match_type, PROBE_LOCATION, linespec_location::spec_string, and xstrprintf().

Referenced by bkpt_print_recreate(), bkpt_probe_create_sals_from_location(), bppy_get_location(), bpscm_print_breakpoint_smob(), dprintf_print_recreate(), elf_gnu_ifunc_resolver_return_stop(), gdbscm_breakpoint_location(), init_breakpoint_sal(), print_breakpoint_location(), print_one_breakpoint_location(), print_recreate_ranged_breakpoint(), remote_download_tracepoint(), say_where(), strace_marker_create_sals_from_location(), and tracepoint_print_recreate().

## ◆ event_location_type()

enum event_location_type event_location_type | ( | const struct event_location * | location | ) |

Definition at line 70 of file location.c.

References EL_TYPE.

## ◆ explicit_location_lex_one()

static gdb::unique_xmalloc_ptr<char> explicit_location_lex_one | ( | const char ** | inp,
|  | const struct language_defn * | language,
|  | explicit_completion_info * | completion_info
| ) |  |
| static

Definition at line 475 of file location.c.

References _, CP_OPERATOR_LEN, CP_OPERATOR_STR, error(), find_end_quote(), get_gdb_linespec_parser_quote_characters(), language_cplus, linespec_lexer_lex_keyword(), explicit_completion_info::quoted_arg_end, explicit_completion_info::quoted_arg_start, savestring(), and startswith().

Referenced by string_to_explicit_location().

## ◆ explicit_location_lex_one_function()

static gdb::unique_xmalloc_ptr<char> explicit_location_lex_one_function | ( | const char ** | inp,
|  | const struct language_defn * | language,
|  | explicit_completion_info * | completion_info
| ) |  |
| static

Definition at line 626 of file location.c.

References _, error(), find_toplevel_char(), first_of(), get_gdb_linespec_parser_quote_characters(), is_ada_operator(), language_ada, linespec_lexer_lex_keyword(), explicit_completion_info::quoted_arg_end, explicit_completion_info::quoted_arg_start, savestring(), and skip_op_false_positives().

Referenced by string_to_explicit_location().

## ◆ explicit_location_to_linespec()

char* explicit_location_to_linespec | ( | const struct explicit_location * | explicit_loc | ) |

Definition at line 299 of file location.c.

References explicit_to_string_internal().

Referenced by canonicalize_linespec().

## ◆ explicit_location_to_string()

char* explicit_location_to_string | ( | const struct explicit_location * | explicit_loc | ) |

Definition at line 291 of file location.c.

References explicit_to_string_internal().

Referenced by event_location_to_string().

## ◆ explicit_to_string_internal()

static char* explicit_to_string_internal | ( | int | as_linespec,
|  | const struct explicit_location * | explicit_loc
| ) |  |
| static

Definition at line 235 of file location.c.

References string_file::c_str(), FULL, explicit_location::func_name_match_type, explicit_location::function_name, explicit_location::label_name, explicit_location::line_offset, LINE_OFFSET_NONE, LINE_OFFSET_PLUS, LINE_OFFSET_UNKNOWN, line_offset::offset, ui_file::printf(), ui_file::putc(), ui_file::puts(), line_offset::sign, and explicit_location::source_filename.

Referenced by explicit_location_to_linespec(), and explicit_location_to_string().

## ◆ find_end_quote()

static const char* find_end_quote | ( | const char * | s,
|  | char | end_quote_char
| ) |  |
| static

Definition at line 445 of file location.c.

References scan().

Referenced by explicit_location_lex_one().

## ◆ first_of()

static const char* first_of | ( | const char * | first,
|  | const char * | new_tok
| ) |  |
| static

Definition at line 610 of file location.c.

Referenced by explicit_location_lex_one_function().

## ◆ get_address_location()

CORE_ADDR get_address_location | ( | const struct event_location * | location | ) |

Definition at line 137 of file location.c.

References ADDRESS_LOCATION, EL_ADDRESS, EL_TYPE, and gdb_assert.

Referenced by event_location_to_sals().

## ◆ get_address_string_location()

const char* get_address_string_location | ( | const struct event_location * | location | ) |

Definition at line 146 of file location.c.

References ADDRESS_LOCATION, EL_STRING, EL_TYPE, and gdb_assert.

Referenced by event_location_to_sals().

## ◆ get_explicit_location()

struct explicit_location* get_explicit_location | ( | struct event_location * | location | ) |

Definition at line 213 of file location.c.

References EL_EXPLICIT, EL_TYPE, EXPLICIT_LOCATION, and gdb_assert.

Referenced by canonicalize_linespec(), collect_explicit_location_matches(), and location_completer().

## ◆ get_explicit_location_const()

const struct explicit_location* get_explicit_location_const | ( | const struct event_location * | location | ) |

Definition at line 222 of file location.c.

References EL_EXPLICIT, EL_TYPE, EXPLICIT_LOCATION, and gdb_assert.

Referenced by event_location_to_sals().

## ◆ get_linespec_location()

const linespec_location* get_linespec_location | ( | const struct event_location * | location | ) |

Definition at line 112 of file location.c.

References EL_LINESPEC, EL_TYPE, gdb_assert, and LINESPEC_LOCATION.

Referenced by event_location_to_sals(), parse_breakpoint_sals(), strace_marker_create_sals_from_location(), and strace_marker_decode_location().

## ◆ get_probe_location()

const char* get_probe_location | ( | const struct event_location * | location | ) |

Definition at line 169 of file location.c.

References EL_PROBE, EL_TYPE, gdb_assert, and PROBE_LOCATION.

Referenced by parse_probes().

## ◆ initialize_explicit_location()

void initialize_explicit_location | ( | struct explicit_location * | explicit_loc | ) |

Definition at line 78 of file location.c.

References explicit_location::func_name_match_type, explicit_location::line_offset, LINE_OFFSET_UNKNOWN, memset(), line_offset::sign, and WILD.

Referenced by bppy_init(), create_exception_master_breakpoint(), create_longjmp_master_breakpoint(), create_overlay_event_breakpoint(), create_std_terminate_master_breakpoint(), mi_cmd_break_insert_1(), new_explicit_location(), re_set_exception_catchpoint(), and update_static_tracepoint().

## ◆ is_cp_operator()

static bool is_cp_operator | ( | const char * | start,
|  | const char * | comma
| ) |  |
| static

Definition at line 553 of file location.c.

References CP_OPERATOR_LEN, and CP_OPERATOR_STR.

Referenced by skip_op_false_positives().

## ◆ new_address_location()

event_location_up new_address_location | ( | CORE_ADDR | addr,
|  | const char * | addr_string,
|  | int | addr_string_len
| ) |  |

Definition at line 121 of file location.c.

References event_location::addr_string, ADDRESS_LOCATION, EL_ADDRESS, EL_STRING, EL_TYPE, and XCNEW.

Referenced by bpfinishpy_init(), create_thread_event_breakpoint(), init_breakpoint_sal(), spu_catch_start(), and string_to_event_location_basic().

## ◆ new_explicit_location()

event_location_up new_explicit_location | ( | const struct explicit_location * | explicit_loc | ) |

Definition at line 178 of file location.c.

References copy_event_location(), EL_EXPLICIT, EL_TYPE, event_location::explicit_loc, EXPLICIT_LOCATION, explicit_location::func_name_match_type, explicit_location::function_name, initialize_explicit_location(), explicit_location::label_name, explicit_location::line_offset, LINE_OFFSET_UNKNOWN, memset(), line_offset::sign, and explicit_location::source_filename.

Referenced by bppy_init(), canonicalize_linespec(), create_exception_master_breakpoint(), create_longjmp_master_breakpoint(), create_overlay_event_breakpoint(), create_std_terminate_master_breakpoint(), mi_cmd_break_insert_1(), re_set_exception_catchpoint(), string_to_explicit_location(), and update_static_tracepoint().

## ◆ new_linespec_location()

event_location_up new_linespec_location | ( | const char ** | linespec,
|  | symbol_name_match_type | match_type
| ) |  |

Definition at line 88 of file location.c.

References EL_LINESPEC, EL_TYPE, linespec_lex_to_end(), LINESPEC_LOCATION, remove_trailing_whitespace(), savestring(), and XCNEW.

Referenced by agent_command_1(), decode_objc(), strace_command(), strace_marker_create_sals_from_location(), and string_to_event_location_basic().

## ◆ new_probe_location()

event_location_up new_probe_location | ( | const char * | probe | ) |

Definition at line 155 of file location.c.

References EL_PROBE, EL_TYPE, PROBE_LOCATION, and XCNEW.

Referenced by create_exception_master_breakpoint(), create_longjmp_master_breakpoint(), parse_probes(), re_set_exception_catchpoint(), and string_to_event_location_basic().

## ◆ set_event_location_string()

void set_event_location_string | ( | struct event_location * | location,
|  | const char * | string
| ) |  |

Definition at line 981 of file location.c.

References EL_STRING, and xfree().

Referenced by canonicalize_linespec().

## ◆ skip_op_false_positives()

static const char* skip_op_false_positives | ( | const char * | start,
|  | const char * | found
| ) |  |
| static

Definition at line 591 of file location.c.

References find_toplevel_char(), and is_cp_operator().

Referenced by explicit_location_lex_one_function().

## ◆ string_to_event_location()

event_location_up string_to_event_location | ( | const char ** | stringp,
|  | const struct language_defn * | language,
|  | symbol_name_match_type | match_type
| ) |  |

Definition at line 917 of file location.c.

References EL_EXPLICIT, event_location_empty_p(), string_to_event_location_basic(), and string_to_explicit_location().

Referenced by bppy_init(), break_command_1(), break_range_command(), create_tracepoint_from_upload(), decode_line_with_current_source(), decode_line_with_last_displayed(), dprintf_command(), edit_command(), ftrace_command(), info_scope_command(), init_ada_exception_breakpoint(), list_command(), strace_command(), trace_command(), and until_break_command().

## ◆ string_to_event_location_basic()

event_location_up string_to_event_location_basic | ( | const char ** | stringp,
|  | const struct language_defn * | language,
|  | symbol_name_match_type | match_type
| ) |  |

Definition at line 877 of file location.c.

References linespec_expression_to_pc(), new_address_location(), new_linespec_location(), new_probe_location(), and probe_linespec_to_static_ops().

Referenced by gdbpy_decode_line(), gdbscm_register_breakpoint_x(), mi_cmd_break_insert_1(), and string_to_event_location().

## ◆ string_to_explicit_location()

event_location_up string_to_explicit_location | ( | const char ** | argp,
|  | const struct language_defn * | language,
|  | explicit_completion_info * | completion_info
| ) |  |

Definition at line 719 of file location.c.

References _, EL_EXPLICIT, error(), explicit_location_lex_one(), explicit_location_lex_one_function(), FULL, explicit_completion_info::last_option, LINE_OFFSET_UNKNOWN, linespec_lexer_lex_keyword(), linespec_parse_line_offset(), new_explicit_location(), explicit_completion_info::quoted_arg_end, explicit_completion_info::quoted_arg_start, explicit_completion_info::saw_explicit_location_option, and skip_spaces().

Referenced by location_completer(), and string_to_event_location().