1 /* Data structures and API for event locations in GDB.
2 Copyright (C) 2013-2015 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/>. */
23 struct event_location;
25 /* An enumeration of the various ways to specify a stop event
26 location (used with create_breakpoint). */
28 enum event_location_type
30 /* A traditional linespec. */
33 /* An address in the inferior. */
37 /* Return the type of the given event location. */
39 extern enum event_location_type
40 event_location_type (const struct event_location *);
42 /* Return a string representation of the LOCATION.
43 This function may return NULL for unspecified linespecs,
44 e.g, LOCATION_LINESPEC and addr_string is NULL.
46 The result is cached in LOCATION. */
49 event_location_to_string (struct event_location *location);
51 /* Create a new linespec location. The return result is malloc'd
52 and should be freed with delete_event_location. */
54 extern struct event_location *
55 new_linespec_location (char **linespec);
57 /* Return the linespec location (a string) of the given event_location
58 (which must be of type LINESPEC_LOCATION). */
61 get_linespec_location (const struct event_location *location);
63 /* Create a new address location. The return result is malloc'd
64 and should be freed with delete_event_location. */
66 extern struct event_location *
67 new_address_location (CORE_ADDR addr);
69 /* Return the address location (a CORE_ADDR) of the given event_location
70 (which must be of type ADDRESS_LOCATION). */
73 get_address_location (const struct event_location *location);
75 /* Free an event location and any associated data. */
77 extern void delete_event_location (struct event_location *location);
79 /* Make a cleanup to free LOCATION. */
81 extern struct cleanup *
82 make_cleanup_delete_event_location (struct event_location *location);
84 /* Return a copy of the given SRC location. */
86 extern struct event_location *
87 copy_event_location (const struct event_location *src);
89 /* Attempt to convert the input string in *ARGP into an event_location.
90 ARGP is advanced past any processed input. Returns an event_location
91 (malloc'd) if an event location was successfully found in *ARGP,
94 This function may call error() if *ARGP looks like properly formed,
95 but invalid, input, e.g., if it is called with missing argument parameters
98 The return result must be freed with delete_event_location. */
100 extern struct event_location *
101 string_to_event_location (char **argp,
102 const struct language_defn *langauge);
104 /* A convenience function for testing for unset locations. */
106 extern int event_location_empty_p (const struct event_location *location);
108 /* Set the location's string representation. If STRING is NULL, clear
109 the string representation. */
112 set_event_location_string (struct event_location *location,
114 #endif /* LOCATIONS_H */