/* Data structures and API for event locations in GDB.
- Copyright (C) 2013-2019 Free Software Foundation, Inc.
+ Copyright (C) 2013-2022 Free Software Foundation, Inc.
This file is part of GDB.
#ifndef LOCATION_H
#define LOCATION_H
+#include "symtab.h"
+
struct language_defn;
struct event_location;
extern enum event_location_type
event_location_type (const struct event_location *);
-/* Return a malloc'd explicit string representation of the given
- explicit location. The location must already be canonicalized/valid. */
-
-extern char *
- explicit_location_to_string (const struct explicit_location *explicit_loc);
-
-/* Return a malloc'd linespec string representation of the given
- explicit location. The location must already be canonicalized/valid. */
+/* Return a linespec string representation of the given explicit
+ location. The location must already be canonicalized/valid. */
-extern char *
+extern std::string
explicit_location_to_linespec (const struct explicit_location *explicit_loc);
/* Return a string representation of the LOCATION.
/* Create a new probe location. */
-extern event_location_up new_probe_location (const char *probe);
+extern event_location_up new_probe_location (std::string &&probe);
/* Return the probe location (a string) of the given event_location
(which must be of type PROBE_LOCATION). */
copy_event_location (const struct event_location *src);
/* Attempt to convert the input string in *ARGP into an event_location.
- ARGP is advanced past any processed input. Returns an event_location
- (malloc'd) if an event location was successfully found in *ARGP,
- NULL otherwise.
+ ARGP is advanced past any processed input. Always returns a non-nullptr
+ event_location unique pointer object.
- This function may call error() if *ARGP looks like properly formed,
- but invalid, input, e.g., if it is called with missing argument parameters
+ This function may call error() if *ARGP looks like properly formed, but
+ invalid, input, e.g., if it is called with missing argument parameters
or invalid options.
This function is intended to be used by CLI commands and will parse
in the input string, it will take precedence over this parameter. */
extern event_location_up string_to_event_location
- (const char **argp, const struct language_defn *langauge,
+ (const char **argp, const struct language_defn *language,
symbol_name_match_type match_type = symbol_name_match_type::WILD);
/* Like string_to_event_location, but does not attempt to parse
extern int event_location_empty_p (const struct event_location *location);
-/* Set the location's string representation. If STRING is NULL, clear
- the string representation. */
+/* Set the location's string representation. */
extern void
set_event_location_string (struct event_location *location,
- const char *string);
+ std::string &&string);
#endif /* LOCATION_H */