Explicit locations: introduce probe locations
[deliverable/binutils-gdb.git] / gdb / location.h
1 /* Data structures and API for event locations in GDB.
2 Copyright (C) 2013-2015 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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/>. */
18
19 #ifndef LOCATIONS_H
20 #define LOCATIONS_H 1
21
22 struct language_defn;
23 struct event_location;
24
25 /* An enumeration of the various ways to specify a stop event
26 location (used with create_breakpoint). */
27
28 enum event_location_type
29 {
30 /* A traditional linespec. */
31 LINESPEC_LOCATION,
32
33 /* An address in the inferior. */
34 ADDRESS_LOCATION,
35
36 /* A probe location. */
37 PROBE_LOCATION
38 };
39
40 /* Return the type of the given event location. */
41
42 extern enum event_location_type
43 event_location_type (const struct event_location *);
44
45 /* Return a string representation of the LOCATION.
46 This function may return NULL for unspecified linespecs,
47 e.g, LOCATION_LINESPEC and addr_string is NULL.
48
49 The result is cached in LOCATION. */
50
51 extern const char *
52 event_location_to_string (struct event_location *location);
53
54 /* Create a new linespec location. The return result is malloc'd
55 and should be freed with delete_event_location. */
56
57 extern struct event_location *
58 new_linespec_location (char **linespec);
59
60 /* Return the linespec location (a string) of the given event_location
61 (which must be of type LINESPEC_LOCATION). */
62
63 extern const char *
64 get_linespec_location (const struct event_location *location);
65
66 /* Create a new address location. The return result is malloc'd
67 and should be freed with delete_event_location. */
68
69 extern struct event_location *
70 new_address_location (CORE_ADDR addr);
71
72 /* Return the address location (a CORE_ADDR) of the given event_location
73 (which must be of type ADDRESS_LOCATION). */
74
75 extern CORE_ADDR
76 get_address_location (const struct event_location *location);
77
78 /* Create a new probe location. The return result is malloc'd
79 and should be freed with delete_event_location. */
80
81 extern struct event_location *
82 new_probe_location (const char *probe);
83
84 /* Return the probe location (a string) of the given event_location
85 (which must be of type PROBE_LOCATION). */
86
87 extern const char *
88 get_probe_location (const struct event_location *location);
89
90 /* Free an event location and any associated data. */
91
92 extern void delete_event_location (struct event_location *location);
93
94 /* Make a cleanup to free LOCATION. */
95
96 extern struct cleanup *
97 make_cleanup_delete_event_location (struct event_location *location);
98
99 /* Return a copy of the given SRC location. */
100
101 extern struct event_location *
102 copy_event_location (const struct event_location *src);
103
104 /* Attempt to convert the input string in *ARGP into an event_location.
105 ARGP is advanced past any processed input. Returns an event_location
106 (malloc'd) if an event location was successfully found in *ARGP,
107 NULL otherwise.
108
109 This function may call error() if *ARGP looks like properly formed,
110 but invalid, input, e.g., if it is called with missing argument parameters
111 or invalid options.
112
113 The return result must be freed with delete_event_location. */
114
115 extern struct event_location *
116 string_to_event_location (char **argp,
117 const struct language_defn *langauge);
118
119 /* A convenience function for testing for unset locations. */
120
121 extern int event_location_empty_p (const struct event_location *location);
122
123 /* Set the location's string representation. If STRING is NULL, clear
124 the string representation. */
125
126 extern void
127 set_event_location_string (struct event_location *location,
128 const char *string);
129 #endif /* LOCATIONS_H */
This page took 0.035193 seconds and 5 git commands to generate.