/* Data structures and API for event locations in GDB.
- Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ Copyright (C) 2013-2016 Free Software Foundation, Inc.
This file is part of GDB.
{
/* The type of this breakpoint specification. */
enum event_location_type type;
-#define EL_TYPE(PTR) (PTR)->type
+#define EL_TYPE(P) (P)->type
union
{
This representation is used by both "normal" linespecs and
probes. */
char *addr_string;
-#define EL_LINESPEC(PTR) ((PTR)->u.addr_string)
-#define EL_PROBE(PTR) ((PTR)->u.addr_string)
+#define EL_LINESPEC(P) ((P)->u.addr_string)
+#define EL_PROBE(P) ((P)->u.addr_string)
/* An address in the inferior. */
CORE_ADDR address;
-#define EL_ADDRESS(PTR) (PTR)->u.address
+#define EL_ADDRESS(P) (P)->u.address
/* An explicit location. */
struct explicit_location explicit_loc;
-#define EL_EXPLICIT(PTR) (&((PTR)->u.explicit_loc))
+#define EL_EXPLICIT(P) (&((P)->u.explicit_loc))
} u;
/* Cached string representation of this location. This is used, e.g., to
save stop event locations to file. Malloc'd. */
char *as_string;
-#define EL_STRING(PTR) ((PTR)->as_string)
+#define EL_STRING(P) ((P)->as_string)
};
/* See description in location.h. */
/* See description in location.h. */
struct event_location *
-new_address_location (CORE_ADDR addr)
+new_address_location (CORE_ADDR addr, const char *addr_string,
+ int addr_string_len)
{
struct event_location *location;
location = XCNEW (struct event_location);
EL_TYPE (location) = ADDRESS_LOCATION;
EL_ADDRESS (location) = addr;
+ if (addr_string != NULL)
+ EL_STRING (location) = xstrndup (addr_string, addr_string_len);
return location;
}
/* See description in location.h. */
+const char *
+get_address_string_location (const struct event_location *location)
+{
+ gdb_assert (EL_TYPE (location) == ADDRESS_LOCATION);
+ return EL_STRING (location);
+}
+
+/* See description in location.h. */
+
struct event_location *
new_probe_location (const char *probe)
{
orig = arg = *stringp;
addr = linespec_expression_to_pc (&arg);
- location = new_address_location (addr);
+ location = new_address_location (addr, orig, arg - orig);
*stringp += arg - orig;
}
else