d35fecbf08c2e1082a232344541146f236105c93
[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
34 /* Return the type of the given event location. */
35
36 extern enum event_location_type
37 event_location_type (const struct event_location *);
38
39 /* Return a string representation of the LOCATION.
40 This function may return NULL for unspecified linespecs,
41 e.g, LOCATION_LINESPEC and addr_string is NULL.
42
43 The result is cached in LOCATION. */
44
45 extern const char *
46 event_location_to_string (struct event_location *location);
47
48 /* Create a new linespec location. The return result is malloc'd
49 and should be freed with delete_event_location. */
50
51 extern struct event_location *
52 new_linespec_location (char **linespec);
53
54 /* Return the linespec location (a string) of the given event_location
55 (which must be of type LINESPEC_LOCATION). */
56
57 extern const char *
58 get_linespec_location (const struct event_location *location);
59
60 /* Free an event location and any associated data. */
61
62 extern void delete_event_location (struct event_location *location);
63
64 /* Make a cleanup to free LOCATION. */
65
66 extern struct cleanup *
67 make_cleanup_delete_event_location (struct event_location *location);
68
69 /* Return a copy of the given SRC location. */
70
71 extern struct event_location *
72 copy_event_location (const struct event_location *src);
73
74 /* Attempt to convert the input string in *ARGP into an event_location.
75 ARGP is advanced past any processed input. Returns an event_location
76 (malloc'd) if an event location was successfully found in *ARGP,
77 NULL otherwise.
78
79 This function may call error() if *ARGP looks like properly formed,
80 but invalid, input, e.g., if it is called with missing argument parameters
81 or invalid options.
82
83 The return result must be freed with delete_event_location. */
84
85 extern struct event_location *
86 string_to_event_location (char **argp,
87 const struct language_defn *langauge);
88
89 /* A convenience function for testing for unset locations. */
90
91 extern int event_location_empty_p (const struct event_location *location);
92
93 /* Set the location's string representation. If STRING is NULL, clear
94 the string representation. */
95
96 extern void
97 set_event_location_string (struct event_location *location,
98 const char *string);
99 #endif /* LOCATIONS_H */
This page took 0.031135 seconds and 4 git commands to generate.