40 #define EL_TYPE(P) (P)->type 46 #define EL_PROBE(P) ((P)->u.addr_string) 50 #define EL_LINESPEC(P) (&(P)->u.linespec_location) 54 #define EL_ADDRESS(P) (P)->u.address 58 #define EL_EXPLICIT(P) (&((P)->u.explicit_loc)) 64 #define EL_STRING(P) ((P)->as_string) 239 char space = as_linespec ?
':' :
' ';
245 buf.
puts (
"-source ");
255 buf.
puts (
"-qualified ");
257 buf.
puts (
"-function ");
267 buf.
puts (
"-label ");
285 return xstrdup (buf.
c_str ());
362 if (location != NULL)
410 = concat (
"-qualified ", ls->
spec_string, (
char *) NULL);
450 char nested_quote_char =
'\0';
454 if (nested_quote_char !=
'\0')
456 if (*
scan == nested_quote_char)
457 nested_quote_char =
'\0';
458 else if (
scan[0] ==
'\\' && *(
scan + 1) !=
'\0')
461 else if (*
scan == end_quote_char && nested_quote_char ==
'\0')
463 else if (*
scan ==
'"' || *
scan ==
'\'')
464 nested_quote_char = *
scan;
479 const char *start = *inp;
487 if (completion_info != NULL)
494 if (completion_info == NULL)
495 error (
_(
"Unmatched quote, %s."), start);
497 end = start + strlen (start);
503 if (completion_info != NULL)
512 if (*start ==
'-' || *start ==
'+')
514 while (*inp[0] !=
'\0' && *inp[0] !=
',' && !isspace (*inp[0]))
520 while (isdigit (*inp[0]))
522 if (*inp[0] ==
'\0' || isspace (*inp[0]) || *inp[0] ==
',')
531 && !(isspace ((*inp)[0])
542 if (*inp - start > 0)
558 const char *p = comma;
560 while (p > start && isspace (p[-1]))
567 || !(isalnum (p[-1]) || p[-1] ==
'_')))
595 if (found[0] ==
'-' && found[1] ==
'-')
614 else if (new_tok != NULL && new_tok < first)
630 const char *start = *inp;
638 char quote_char = *start;
645 if (completion_info != NULL)
652 if (completion_info == NULL)
653 error (
_(
"Unmatched quote, %s."), start);
655 end = start + strlen (start);
657 char *saved =
savestring (start + 1, *inp - start - 1);
661 if (completion_info != NULL)
664 char *saved =
savestring (start + 1, *inp - start - 2);
687 const char *end =
first_of (hyphen, comma);
690 const char *s = start;
702 end = start + strlen (start);
705 while (end > start && end[-1] ==
' ')
710 if (*inp - start > 0)
731 || !isalpha ((*argp)[1])
732 || ((*argp)[0] ==
'-' && (*argp)[1] ==
'p'))
739 while ((*argp)[0] !=
'\0' && (*argp)[0] !=
',')
746 if (completion_info != NULL)
760 if (completion_info != NULL)
768 len = strlen (opt.get ());
779 bool have_oarg =
false;
782 bool need_oarg =
false;
788 if (completion_info != NULL)
795 oarg = std::move (arg);
796 have_oarg = oarg != NULL;
800 if (strncmp (opt.get (),
"-source", len) == 0)
804 EL_EXPLICIT (location)->source_filename = oarg.release ();
806 else if (strncmp (opt.get (),
"-function", len) == 0)
810 EL_EXPLICIT (location)->function_name = oarg.release ();
812 else if (strncmp (opt.get (),
"-qualified", len) == 0)
817 else if (strncmp (opt.get (),
"-line", len) == 0)
828 else if (strncmp (opt.get (),
"-label", len) == 0)
831 EL_EXPLICIT (location)->label_name = oarg.release ();
835 else if (opt.get ()[0] ==
'-' && !isdigit (opt.get ()[1]))
837 if (completion_info == NULL)
838 error (
_(
"invalid explicit location argument, \"%s\""), opt.get ());
855 if (need_oarg && !have_oarg && completion_info == NULL)
856 error (
_(
"missing argument for \"%s\""), opt.get ());
861 if (
EL_EXPLICIT (location)->source_filename != NULL
865 && completion_info == NULL)
867 error (
_(
"Source filename requires function, label, or " 889 *stringp += strlen (*stringp);
894 if (*stringp != NULL && **stringp ==
'*')
896 const char *arg, *orig;
899 orig = arg = *stringp;
902 *stringp += arg - orig;
921 const char *arg, *orig;
924 orig = arg = *stringp;
926 if (location != NULL)
930 *stringp += arg - orig;
940 match_type =
EL_EXPLICIT (location)->func_name_match_type;
964 || (
EL_EXPLICIT (location)->source_filename == NULL
985 EL_STRING (location) =
string == NULL ? NULL : xstrdup (
string);
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)
int is_ada_operator(const char *string)
const struct static_probe_ops * probe_linespec_to_static_ops(const char **linespecp)
const char * get_probe_location(const struct event_location *location)
static void scan(struct macro_buffer *dest, struct macro_buffer *src, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton)
event_location_up new_linespec_location(const char **linespec, symbol_name_match_type match_type)
void * memset(T *s, int c, size_t n)=delete
static const char * first_of(const char *first, const char *new_tok)
event_location_up copy_event_location(const struct event_location *src)
const char * get_address_string_location(const struct event_location *location)
struct line_offset line_offset
char * skip_spaces(char *chp)
CORE_ADDR get_address_location(const struct event_location *location)
symbol_name_match_type match_type
event_location_up string_to_event_location_basic(const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
static char * explicit_to_string_internal(int as_linespec, const struct explicit_location *explicit_loc)
void initialize_explicit_location(struct explicit_location *explicit_loc)
enum offset_relative_sign sign
const struct explicit_location * get_explicit_location_const(const struct event_location *location)
const char * remove_trailing_whitespace(const char *start, const char *s)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
static const char * find_end_quote(const char *s, char end_quote_char)
const linespec_location * get_linespec_location(const struct event_location *location)
#define gdb_assert_not_reached(message)
const char * quoted_arg_start
void operator()(event_location *location) const
static int startswith(const char *string, const char *pattern)
const char * linespec_lexer_lex_keyword(const char *p)
event_location_up new_explicit_location(const struct explicit_location *explicit_loc)
std::unique_ptr< event_location, event_location_deleter > event_location_up
const char * get_gdb_linespec_parser_quote_characters(void)
const char * event_location_to_string(struct event_location *location)
enum event_location_type event_location_type(const struct event_location *location)
char * xstrprintf(const char *format,...)
CORE_ADDR linespec_expression_to_pc(const char **exp_ptr)
virtual void puts(const char *str)
event_location_up new_address_location(CORE_ADDR addr, const char *addr_string, int addr_string_len)
enum event_location_type type
event_location_up new_probe_location(const char *probe)
void printf(const char *,...) ATTRIBUTE_PRINTF(2
symbol_name_match_type func_name_match_type
struct explicit_location explicit_loc
void linespec_lex_to_end(const char **stringp)
struct line_offset linespec_parse_line_offset(const char *string)
char * explicit_location_to_linespec(const struct explicit_location *explicit_loc)
const char * c_str() const
const char * quoted_arg_end
int event_location_empty_p(const struct event_location *location)
static gdb::unique_xmalloc_ptr< char > explicit_location_lex_one_function(const char **inp, const struct language_defn *language, explicit_completion_info *completion_info)
void set_event_location_string(struct event_location *location, const char *string)
char * savestring(const char *ptr, size_t len)
const char * find_toplevel_char(const char *s, char c)
const char * core_addr_to_string(const CORE_ADDR addr)
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(const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
void error(const char *fmt,...)
static const char * skip_op_false_positives(const char *start, const char *found)
union event_location::@82 u
bool saw_explicit_location_option
struct explicit_location * get_explicit_location(struct event_location *location)
char * explicit_location_to_string(const struct explicit_location *explicit_loc)