Explicit locations: introduce address locations
[deliverable/binutils-gdb.git] / gdb / location.h
CommitLineData
c7c1b3e9
KS
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
22struct language_defn;
23struct event_location;
24
25/* An enumeration of the various ways to specify a stop event
26 location (used with create_breakpoint). */
27
28enum event_location_type
29{
30 /* A traditional linespec. */
a06efdd6
KS
31 LINESPEC_LOCATION,
32
33 /* An address in the inferior. */
34 ADDRESS_LOCATION
c7c1b3e9
KS
35};
36
37/* Return the type of the given event location. */
38
39extern enum event_location_type
40 event_location_type (const struct event_location *);
41
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.
45
46 The result is cached in LOCATION. */
47
48extern const char *
49 event_location_to_string (struct event_location *location);
50
51/* Create a new linespec location. The return result is malloc'd
52 and should be freed with delete_event_location. */
53
54extern struct event_location *
55 new_linespec_location (char **linespec);
56
57/* Return the linespec location (a string) of the given event_location
58 (which must be of type LINESPEC_LOCATION). */
59
60extern const char *
61 get_linespec_location (const struct event_location *location);
62
a06efdd6
KS
63/* Create a new address location. The return result is malloc'd
64 and should be freed with delete_event_location. */
65
66extern struct event_location *
67 new_address_location (CORE_ADDR addr);
68
69/* Return the address location (a CORE_ADDR) of the given event_location
70 (which must be of type ADDRESS_LOCATION). */
71
72extern CORE_ADDR
73 get_address_location (const struct event_location *location);
74
c7c1b3e9
KS
75/* Free an event location and any associated data. */
76
77extern void delete_event_location (struct event_location *location);
78
79/* Make a cleanup to free LOCATION. */
80
81extern struct cleanup *
82 make_cleanup_delete_event_location (struct event_location *location);
83
84/* Return a copy of the given SRC location. */
85
86extern struct event_location *
87 copy_event_location (const struct event_location *src);
88
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,
92 NULL otherwise.
93
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
96 or invalid options.
97
98 The return result must be freed with delete_event_location. */
99
100extern struct event_location *
101 string_to_event_location (char **argp,
102 const struct language_defn *langauge);
103
104/* A convenience function for testing for unset locations. */
105
106extern int event_location_empty_p (const struct event_location *location);
107
108/* Set the location's string representation. If STRING is NULL, clear
109 the string representation. */
110
111extern void
112 set_event_location_string (struct event_location *location,
113 const char *string);
114#endif /* LOCATIONS_H */
This page took 0.027213 seconds and 4 git commands to generate.