gdb/tui: fairer distribution of excess space during apply
[binutils-gdb.git] / gdb / location.h
index 4ede1835fbd97406e8675632a904eede800640f8..ff21c1c21cc3bdc0c3f63b9a12124618c69891af 100644 (file)
@@ -1,5 +1,5 @@
 /* Data structures and API for event locations in GDB.
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
+   Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef LOCATIONS_H
-#define LOCATIONS_H 1
+#ifndef LOCATION_H
+#define LOCATION_H
+
+#include "symtab.h"
 
 struct language_defn;
 struct event_location;
@@ -107,16 +109,10 @@ struct explicit_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.
@@ -173,7 +169,7 @@ extern const char *
 
 /* 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).  */
@@ -209,12 +205,11 @@ extern event_location_up
   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
@@ -226,7 +221,7 @@ extern event_location_up
    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
@@ -279,10 +274,10 @@ extern event_location_up
 
 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);
-#endif /* LOCATIONS_H */
+                            std::string &&string);
+
+#endif /* LOCATION_H */