1 /* Data structures and API for event locations in GDB.
2 Copyright (C) 2013-2022 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "gdbsupport/gdb_assert.h"
25 #include "cli/cli-utils.h"
27 #include "cp-support.h"
32 static std::string explicit_location_to_string
33 (const struct explicit_location
*explicit_loc
);
35 /* The base class for all an event locations used to set a stop event
40 virtual ~event_location () = default;
42 /* Clone this object. */
43 virtual event_location_up
clone () const = 0;
45 /* Return true if this location is empty, false otherwise. */
46 virtual bool empty_p () const = 0;
48 /* Return a string representation of this location. */
49 const char *to_string () const
51 if (as_string
.empty ())
52 as_string
= compute_string ();
53 if (as_string
.empty ())
55 return as_string
.c_str ();
58 DISABLE_COPY_AND_ASSIGN (event_location
);
60 /* The type of this breakpoint specification. */
61 enum event_location_type type
;
63 /* Cached string representation of this location. This is used,
64 e.g., to save stop event locations to file. */
65 mutable std::string as_string
;
69 explicit event_location (enum event_location_type t
)
74 event_location (enum event_location_type t
, std::string
&&str
)
76 as_string (std::move (str
))
80 explicit event_location (const event_location
*to_clone
)
81 : type (to_clone
->type
),
82 as_string (to_clone
->as_string
)
86 /* Compute the string representation of this object. This is called
87 by to_string when needed. */
88 virtual std::string
compute_string () const = 0;
92 struct event_location_probe
: public event_location
94 explicit event_location_probe (std::string
&&probe
)
95 : event_location (PROBE_LOCATION
, std::move (probe
))
99 event_location_up
clone () const override
101 return event_location_up (new event_location_probe (this));
104 bool empty_p () const override
111 explicit event_location_probe (const event_location_probe
*to_clone
)
112 : event_location (to_clone
)
116 std::string
compute_string () const override
118 return std::move (as_string
);
122 /* A "normal" linespec. */
123 struct event_location_linespec
: public event_location
125 event_location_linespec (const char **linespec
,
126 symbol_name_match_type match_type
)
127 : event_location (LINESPEC_LOCATION
)
129 linespec_location
.match_type
= match_type
;
130 if (*linespec
!= NULL
)
133 const char *orig
= *linespec
;
135 linespec_lex_to_end (linespec
);
136 p
= remove_trailing_whitespace (orig
, *linespec
);
138 linespec_location
.spec_string
= savestring (orig
, p
- orig
);
142 ~event_location_linespec ()
144 xfree (linespec_location
.spec_string
);
147 event_location_up
clone () const override
149 return event_location_up (new event_location_linespec (this));
152 bool empty_p () const override
157 struct linespec_location linespec_location
{};
161 explicit event_location_linespec (const event_location_linespec
*to_clone
)
162 : event_location (to_clone
),
163 linespec_location (to_clone
->linespec_location
)
165 if (linespec_location
.spec_string
!= nullptr)
166 linespec_location
.spec_string
= xstrdup (linespec_location
.spec_string
);
169 std::string
compute_string () const override
171 if (linespec_location
.spec_string
!= nullptr)
173 const struct linespec_location
*ls
= &linespec_location
;
174 if (ls
->match_type
== symbol_name_match_type::FULL
)
175 return std::string ("-qualified ") + ls
->spec_string
;
177 return ls
->spec_string
;
183 /* An address in the inferior. */
184 struct event_location_address
: public event_location
186 event_location_address (CORE_ADDR addr
, const char *addr_string
,
188 : event_location (ADDRESS_LOCATION
),
191 if (addr_string
!= nullptr)
192 as_string
= std::string (addr_string
, addr_string_len
);
195 event_location_up
clone () const override
197 return event_location_up (new event_location_address (this));
200 bool empty_p () const override
209 event_location_address (const event_location_address
*to_clone
)
210 : event_location (to_clone
),
211 address (to_clone
->address
)
215 std::string
compute_string () const override
217 const char *addr_string
= core_addr_to_string (address
);
218 return std::string ("*") + addr_string
;
222 /* An explicit location. */
223 struct event_location_explicit
: public event_location
225 explicit event_location_explicit (const struct explicit_location
*loc
)
226 : event_location (EXPLICIT_LOCATION
)
231 ~event_location_explicit ()
233 xfree (explicit_loc
.source_filename
);
234 xfree (explicit_loc
.function_name
);
235 xfree (explicit_loc
.label_name
);
238 event_location_up
clone () const override
240 return event_location_up (new event_location_explicit (this));
243 bool empty_p () const override
245 return (explicit_loc
.source_filename
== nullptr
246 && explicit_loc
.function_name
== nullptr
247 && explicit_loc
.label_name
== nullptr
248 && explicit_loc
.line_offset
.sign
== LINE_OFFSET_UNKNOWN
);
251 struct explicit_location explicit_loc
;
255 explicit event_location_explicit (const event_location_explicit
*to_clone
)
256 : event_location (to_clone
)
258 copy_loc (&to_clone
->explicit_loc
);
261 std::string
compute_string () const override
263 return explicit_location_to_string (&explicit_loc
);
268 void copy_loc (const struct explicit_location
*loc
)
270 initialize_explicit_location (&explicit_loc
);
273 explicit_loc
.func_name_match_type
= loc
->func_name_match_type
;
274 if (loc
->source_filename
!= nullptr)
275 explicit_loc
.source_filename
= xstrdup (loc
->source_filename
);
276 if (loc
->function_name
!= nullptr)
277 explicit_loc
.function_name
= xstrdup (loc
->function_name
);
278 if (loc
->label_name
!= nullptr)
279 explicit_loc
.label_name
= xstrdup (loc
->label_name
);
280 explicit_loc
.line_offset
= loc
->line_offset
;
285 /* See description in location.h. */
287 enum event_location_type
288 event_location_type (const struct event_location
*location
)
290 return location
->type
;
293 /* See description in location.h. */
296 initialize_explicit_location (struct explicit_location
*explicit_loc
)
298 memset (explicit_loc
, 0, sizeof (struct explicit_location
));
299 explicit_loc
->line_offset
.sign
= LINE_OFFSET_UNKNOWN
;
300 explicit_loc
->func_name_match_type
= symbol_name_match_type::WILD
;
303 /* See description in location.h. */
306 new_linespec_location (const char **linespec
,
307 symbol_name_match_type match_type
)
309 return event_location_up (new event_location_linespec (linespec
,
313 /* See description in location.h. */
315 const linespec_location
*
316 get_linespec_location (const struct event_location
*location
)
318 gdb_assert (location
->type
== LINESPEC_LOCATION
);
319 return &((event_location_linespec
*) location
)->linespec_location
;
322 /* See description in location.h. */
325 new_address_location (CORE_ADDR addr
, const char *addr_string
,
328 return event_location_up (new event_location_address (addr
, addr_string
,
332 /* See description in location.h. */
335 get_address_location (const struct event_location
*location
)
337 gdb_assert (location
->type
== ADDRESS_LOCATION
);
338 return ((event_location_address
*) location
)->address
;
341 /* See description in location.h. */
344 get_address_string_location (const struct event_location
*location
)
346 gdb_assert (location
->type
== ADDRESS_LOCATION
);
347 return location
->to_string ();
350 /* See description in location.h. */
353 new_probe_location (std::string
&&probe
)
355 return event_location_up (new event_location_probe (std::move (probe
)));
358 /* See description in location.h. */
361 get_probe_location (const struct event_location
*location
)
363 gdb_assert (location
->type
== PROBE_LOCATION
);
364 return location
->to_string ();
367 /* See description in location.h. */
370 new_explicit_location (const struct explicit_location
*explicit_loc
)
372 return event_location_up (new event_location_explicit (explicit_loc
));
375 /* See description in location.h. */
377 struct explicit_location
*
378 get_explicit_location (struct event_location
*location
)
380 gdb_assert (location
->type
== EXPLICIT_LOCATION
);
381 return &((event_location_explicit
*) location
)->explicit_loc
;
384 /* See description in location.h. */
386 const struct explicit_location
*
387 get_explicit_location_const (const struct event_location
*location
)
389 gdb_assert (location
->type
== EXPLICIT_LOCATION
);
390 return &((event_location_explicit
*) location
)->explicit_loc
;
393 /* This convenience function returns a malloc'd string which
394 represents the location in EXPLICIT_LOC.
396 AS_LINESPEC is true if this string should be a linespec.
397 Otherwise it will be output in explicit form. */
400 explicit_to_string_internal (bool as_linespec
,
401 const struct explicit_location
*explicit_loc
)
403 bool need_space
= false;
404 char space
= as_linespec
? ':' : ' ';
407 if (explicit_loc
->source_filename
!= NULL
)
410 buf
.puts ("-source ");
411 buf
.puts (explicit_loc
->source_filename
);
415 if (explicit_loc
->function_name
!= NULL
)
419 if (explicit_loc
->func_name_match_type
== symbol_name_match_type::FULL
)
420 buf
.puts ("-qualified ");
422 buf
.puts ("-function ");
423 buf
.puts (explicit_loc
->function_name
);
427 if (explicit_loc
->label_name
!= NULL
)
432 buf
.puts ("-label ");
433 buf
.puts (explicit_loc
->label_name
);
437 if (explicit_loc
->line_offset
.sign
!= LINE_OFFSET_UNKNOWN
)
444 (explicit_loc
->line_offset
.sign
== LINE_OFFSET_NONE
? ""
445 : (explicit_loc
->line_offset
.sign
446 == LINE_OFFSET_PLUS
? "+" : "-")),
447 explicit_loc
->line_offset
.offset
);
450 return std::move (buf
.string ());
453 /* See description in location.h. */
456 explicit_location_to_string (const struct explicit_location
*explicit_loc
)
458 return explicit_to_string_internal (false, explicit_loc
);
461 /* See description in location.h. */
464 explicit_location_to_linespec (const struct explicit_location
*explicit_loc
)
466 return explicit_to_string_internal (true, explicit_loc
);
469 /* See description in location.h. */
472 copy_event_location (const struct event_location
*src
)
474 return src
->clone ();
478 event_location_deleter::operator() (event_location
*location
) const
483 /* See description in location.h. */
486 event_location_to_string (struct event_location
*location
)
488 return location
->to_string ();
491 /* Find an instance of the quote character C in the string S that is
492 outside of all single- and double-quoted strings (i.e., any quoting
496 find_end_quote (const char *s
, char end_quote_char
)
498 /* zero if we're not in quotes;
499 '"' if we're in a double-quoted string;
500 '\'' if we're in a single-quoted string. */
501 char nested_quote_char
= '\0';
503 for (const char *scan
= s
; *scan
!= '\0'; scan
++)
505 if (nested_quote_char
!= '\0')
507 if (*scan
== nested_quote_char
)
508 nested_quote_char
= '\0';
509 else if (scan
[0] == '\\' && *(scan
+ 1) != '\0')
512 else if (*scan
== end_quote_char
&& nested_quote_char
== '\0')
514 else if (*scan
== '"' || *scan
== '\'')
515 nested_quote_char
= *scan
;
521 /* A lexer for explicit locations. This function will advance INP
522 past any strings that it lexes. Returns a malloc'd copy of the
523 lexed string or NULL if no lexing was done. */
525 static gdb::unique_xmalloc_ptr
<char>
526 explicit_location_lex_one (const char **inp
,
527 const struct language_defn
*language
,
528 explicit_completion_info
*completion_info
)
530 const char *start
= *inp
;
535 /* If quoted, skip to the ending quote. */
536 if (strchr (get_gdb_linespec_parser_quote_characters (), *start
))
538 if (completion_info
!= NULL
)
539 completion_info
->quoted_arg_start
= start
;
541 const char *end
= find_end_quote (start
+ 1, *start
);
545 if (completion_info
== NULL
)
546 error (_("Unmatched quote, %s."), start
);
548 end
= start
+ strlen (start
);
550 return gdb::unique_xmalloc_ptr
<char> (savestring (start
+ 1,
554 if (completion_info
!= NULL
)
555 completion_info
->quoted_arg_end
= end
;
557 return gdb::unique_xmalloc_ptr
<char> (savestring (start
+ 1,
561 /* If the input starts with '-' or '+', the string ends with the next
562 whitespace or comma. */
563 if (*start
== '-' || *start
== '+')
565 while (*inp
[0] != '\0' && *inp
[0] != ',' && !isspace (*inp
[0]))
570 /* Handle numbers first, stopping at the next whitespace or ','. */
571 while (isdigit (*inp
[0]))
573 if (*inp
[0] == '\0' || isspace (*inp
[0]) || *inp
[0] == ',')
574 return gdb::unique_xmalloc_ptr
<char> (savestring (start
,
577 /* Otherwise stop at the next occurrence of whitespace, '\0',
582 && !(isspace ((*inp
)[0])
583 || linespec_lexer_lex_keyword (&(*inp
)[1])))
585 /* Special case: C++ operator,. */
586 if (language
->la_language
== language_cplus
587 && startswith (*inp
, CP_OPERATOR_STR
))
588 (*inp
) += CP_OPERATOR_LEN
;
593 if (*inp
- start
> 0)
594 return gdb::unique_xmalloc_ptr
<char> (savestring (start
, *inp
- start
));
599 /* Return true if COMMA points past "operator". START is the start of
600 the line that COMMAND points to, hence when reading backwards, we
601 must not read any character before START. */
604 is_cp_operator (const char *start
, const char *comma
)
607 && (comma
- start
) >= CP_OPERATOR_LEN
)
609 const char *p
= comma
;
611 while (p
> start
&& isspace (p
[-1]))
613 if (p
- start
>= CP_OPERATOR_LEN
)
615 p
-= CP_OPERATOR_LEN
;
616 if (strncmp (p
, CP_OPERATOR_STR
, CP_OPERATOR_LEN
) == 0
618 || !(isalnum (p
[-1]) || p
[-1] == '_')))
627 /* When scanning the input string looking for the next explicit
628 location option/delimiter, we jump to the next option by looking
629 for ",", and "-". Such a character can also appear in C++ symbols
630 like "operator," and "operator-". So when we find such a
631 character, we call this function to check if we found such a
632 symbol, meaning we had a false positive for an option string. In
633 that case, we keep looking for the next delimiter, until we find
634 one that is not a false positive, or we reach end of string. FOUND
635 is the character that scanning found (either '-' or ','), and START
636 is the start of the line that FOUND points to, hence when reading
637 backwards, we must not read any character before START. Returns a
638 pointer to the next non-false-positive delimiter character, or NULL
639 if none was found. */
642 skip_op_false_positives (const char *start
, const char *found
)
644 while (found
!= NULL
&& is_cp_operator (start
, found
))
646 if (found
[0] == '-' && found
[1] == '-')
650 found
= find_toplevel_char (start
, *found
);
656 /* Assuming both FIRST and NEW_TOK point into the same string, return
657 the pointer that is closer to the start of the string. If FIRST is
658 NULL, returns NEW_TOK. If NEW_TOK is NULL, returns FIRST. */
661 first_of (const char *first
, const char *new_tok
)
665 else if (new_tok
!= NULL
&& new_tok
< first
)
671 /* A lexer for functions in explicit locations. This function will
672 advance INP past a function until the next option, or until end of
673 string. Returns a malloc'd copy of the lexed string or NULL if no
676 static gdb::unique_xmalloc_ptr
<char>
677 explicit_location_lex_one_function (const char **inp
,
678 const struct language_defn
*language
,
679 explicit_completion_info
*completion_info
)
681 const char *start
= *inp
;
686 /* If quoted, skip to the ending quote. */
687 if (strchr (get_gdb_linespec_parser_quote_characters (), *start
))
689 char quote_char
= *start
;
691 /* If the input is not an Ada operator, skip to the matching
692 closing quote and return the string. */
693 if (!(language
->la_language
== language_ada
694 && quote_char
== '\"' && is_ada_operator (start
)))
696 if (completion_info
!= NULL
)
697 completion_info
->quoted_arg_start
= start
;
699 const char *end
= find_toplevel_char (start
+ 1, quote_char
);
703 if (completion_info
== NULL
)
704 error (_("Unmatched quote, %s."), start
);
706 end
= start
+ strlen (start
);
708 char *saved
= savestring (start
+ 1, *inp
- start
- 1);
709 return gdb::unique_xmalloc_ptr
<char> (saved
);
712 if (completion_info
!= NULL
)
713 completion_info
->quoted_arg_end
= end
;
715 char *saved
= savestring (start
+ 1, *inp
- start
- 2);
716 return gdb::unique_xmalloc_ptr
<char> (saved
);
720 const char *comma
= find_toplevel_char (start
, ',');
722 /* If we have "-function -myfunction", or perhaps better example,
723 "-function -[BasicClass doIt]" (objc selector), treat
724 "-myfunction" as the function name. I.e., skip the first char if
725 it is an hyphen. Don't skip the first char always, because we
726 may have C++ "operator<", and find_toplevel_char needs to see the
730 ? find_toplevel_char (start
+ 1, '-')
731 : find_toplevel_char (start
, '-'));
733 /* Check for C++ "operator," and "operator-". */
734 comma
= skip_op_false_positives (start
, comma
);
735 hyphen
= skip_op_false_positives (start
, hyphen
);
737 /* Pick the one that appears first. */
738 const char *end
= first_of (hyphen
, comma
);
740 /* See if a linespec keyword appears first. */
741 const char *s
= start
;
742 const char *ws
= find_toplevel_char (start
, ' ');
743 while (ws
!= NULL
&& linespec_lexer_lex_keyword (ws
+ 1) == NULL
)
746 ws
= find_toplevel_char (s
, ' ');
749 end
= first_of (end
, ws
+ 1);
751 /* If we don't have any terminator, then take the whole string. */
753 end
= start
+ strlen (start
);
755 /* Trim whitespace at the end. */
756 while (end
> start
&& end
[-1] == ' ')
761 if (*inp
- start
> 0)
762 return gdb::unique_xmalloc_ptr
<char> (savestring (start
, *inp
- start
));
767 /* See description in location.h. */
770 string_to_explicit_location (const char **argp
,
771 const struct language_defn
*language
,
772 explicit_completion_info
*completion_info
)
774 /* It is assumed that input beginning with '-' and a non-digit
775 character is an explicit location. "-p" is reserved, though,
776 for probe locations. */
780 || !isalpha ((*argp
)[1])
781 || ((*argp
)[0] == '-' && (*argp
)[1] == 'p'))
784 std::unique_ptr
<event_location_explicit
> location
785 (new event_location_explicit ((const explicit_location
*) nullptr));
787 /* Process option/argument pairs. dprintf_command
788 requires that processing stop on ','. */
789 while ((*argp
)[0] != '\0' && (*argp
)[0] != ',')
794 /* Clear these on each iteration, since they should be filled
795 with info about the last option. */
796 if (completion_info
!= NULL
)
798 completion_info
->quoted_arg_start
= NULL
;
799 completion_info
->quoted_arg_end
= NULL
;
802 /* If *ARGP starts with a keyword, stop processing
804 if (linespec_lexer_lex_keyword (*argp
) != NULL
)
807 /* Mark the start of the string in case we need to rewind. */
810 if (completion_info
!= NULL
)
811 completion_info
->last_option
= start
;
813 /* Get the option string. */
814 gdb::unique_xmalloc_ptr
<char> opt
815 = explicit_location_lex_one (argp
, language
, NULL
);
817 /* Use the length of the option to allow abbreviations. */
818 len
= strlen (opt
.get ());
820 /* Get the argument string. */
821 *argp
= skip_spaces (*argp
);
823 /* All options have a required argument. Checking for this
824 required argument is deferred until later. */
825 gdb::unique_xmalloc_ptr
<char> oarg
;
826 /* True if we have an argument. This is required because we'll
827 move from OARG before checking whether we have an
829 bool have_oarg
= false;
831 /* True if the option needs an argument. */
832 bool need_oarg
= false;
834 /* Convenience to consistently set both OARG/HAVE_OARG from
836 auto set_oarg
= [&] (gdb::unique_xmalloc_ptr
<char> arg
)
838 if (completion_info
!= NULL
)
840 /* We do this here because the set of options that take
841 arguments matches the set of explicit location
843 completion_info
->saw_explicit_location_option
= true;
845 oarg
= std::move (arg
);
846 have_oarg
= oarg
!= NULL
;
850 if (strncmp (opt
.get (), "-source", len
) == 0)
852 set_oarg (explicit_location_lex_one (argp
, language
,
854 location
->explicit_loc
.source_filename
= oarg
.release ();
856 else if (strncmp (opt
.get (), "-function", len
) == 0)
858 set_oarg (explicit_location_lex_one_function (argp
, language
,
860 location
->explicit_loc
.function_name
= oarg
.release ();
862 else if (strncmp (opt
.get (), "-qualified", len
) == 0)
864 location
->explicit_loc
.func_name_match_type
865 = symbol_name_match_type::FULL
;
867 else if (strncmp (opt
.get (), "-line", len
) == 0)
869 set_oarg (explicit_location_lex_one (argp
, language
, NULL
));
870 *argp
= skip_spaces (*argp
);
873 location
->explicit_loc
.line_offset
874 = linespec_parse_line_offset (oarg
.get ());
878 else if (strncmp (opt
.get (), "-label", len
) == 0)
880 set_oarg (explicit_location_lex_one (argp
, language
, completion_info
));
881 location
->explicit_loc
.label_name
= oarg
.release ();
883 /* Only emit an "invalid argument" error for options
884 that look like option strings. */
885 else if (opt
.get ()[0] == '-' && !isdigit (opt
.get ()[1]))
887 if (completion_info
== NULL
)
888 error (_("invalid explicit location argument, \"%s\""), opt
.get ());
892 /* End of the explicit location specification.
893 Stop parsing and return whatever explicit location was
899 *argp
= skip_spaces (*argp
);
901 /* It's a little lame to error after the fact, but in this
902 case, it provides a much better user experience to issue
903 the "invalid argument" error before any missing
905 if (need_oarg
&& !have_oarg
&& completion_info
== NULL
)
906 error (_("missing argument for \"%s\""), opt
.get ());
909 /* One special error check: If a source filename was given
910 without offset, function, or label, issue an error. */
911 if (location
->explicit_loc
.source_filename
!= NULL
912 && location
->explicit_loc
.function_name
== NULL
913 && location
->explicit_loc
.label_name
== NULL
914 && (location
->explicit_loc
.line_offset
.sign
== LINE_OFFSET_UNKNOWN
)
915 && completion_info
== NULL
)
917 error (_("Source filename requires function, label, or "
921 return event_location_up (location
.release ());
924 /* See description in location.h. */
927 string_to_event_location_basic (const char **stringp
,
928 const struct language_defn
*language
,
929 symbol_name_match_type match_type
)
931 event_location_up location
;
934 /* Try the input as a probe spec. */
936 if (cs
!= NULL
&& probe_linespec_to_static_ops (&cs
) != NULL
)
938 location
= new_probe_location (*stringp
);
939 *stringp
+= strlen (*stringp
);
943 /* Try an address location. */
944 if (*stringp
!= NULL
&& **stringp
== '*')
946 const char *arg
, *orig
;
949 orig
= arg
= *stringp
;
950 addr
= linespec_expression_to_pc (&arg
);
951 location
= new_address_location (addr
, orig
, arg
- orig
);
952 *stringp
+= arg
- orig
;
956 /* Everything else is a linespec. */
957 location
= new_linespec_location (stringp
, match_type
);
964 /* See description in location.h. */
967 string_to_event_location (const char **stringp
,
968 const struct language_defn
*language
,
969 symbol_name_match_type match_type
)
971 const char *arg
, *orig
;
973 /* Try an explicit location. */
974 orig
= arg
= *stringp
;
975 event_location_up location
= string_to_explicit_location (&arg
, language
, NULL
);
976 if (location
!= NULL
)
978 /* It was a valid explicit location. Advance STRINGP to
980 *stringp
+= arg
- orig
;
982 /* If the user really specified a location, then we're done. */
983 if (!event_location_empty_p (location
.get ()))
986 /* Otherwise, the user _only_ specified optional flags like
987 "-qualified", otherwise string_to_explicit_location would
988 have thrown an error. Save the flags for "basic" linespec
989 parsing below and discard the explicit location. */
990 event_location_explicit
*xloc
991 = dynamic_cast<event_location_explicit
*> (location
.get ());
992 gdb_assert (xloc
!= nullptr);
993 match_type
= xloc
->explicit_loc
.func_name_match_type
;
996 /* Everything else is a "basic" linespec, address, or probe
998 return string_to_event_location_basic (stringp
, language
, match_type
);
1001 /* See description in location.h. */
1004 event_location_empty_p (const struct event_location
*location
)
1006 return location
->empty_p ();
1009 /* See description in location.h. */
1012 set_event_location_string (struct event_location
*location
,
1013 std::string
&&string
)
1015 location
->as_string
= std::move (string
);