aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2022-05-23 20:15:18 +0100
committerPedro Alves <pedro@palves.net>2022-06-17 09:41:24 +0100
commit264f98902f27497f7494933628b0f5c4e117fe59 (patch)
tree7a56e489f4441c3132a4d2b0b636a64ace58cd7c /gdb/python
parent14e283ff4e0656327179a5b69954796af3807b66 (diff)
downloadfsf-binutils-gdb-264f98902f27497f7494933628b0f5c4e117fe59.zip
fsf-binutils-gdb-264f98902f27497f7494933628b0f5c4e117fe59.tar.gz
fsf-binutils-gdb-264f98902f27497f7494933628b0f5c4e117fe59.tar.bz2
event_location -> location_spec
Currently, GDB internally uses the term "location" for both the location specification the user input (linespec, explicit location, or an address location), and for actual resolved locations, like the breakpoint locations, or the result of decoding a location spec to SaLs. This is expecially confusing in the breakpoints module, as struct breakpoint has these two fields: breakpoint::location; breakpoint::loc; "location" is the location spec, and "loc" is the resolved locations. And then, we have a method called "locations()", which returns the resolved locations as range... The location spec type is presently called event_location: /* Location we used to set the breakpoint. */ event_location_up location; and it is described like this: /* The base class for all an event locations used to set a stop event in the inferior. */ struct event_location { and even that is incorrect... Location specs are used for finding actual locations in the program in scenarios that have nothing to do with stop events. E.g., "list" works with location specs. To clean all this confusion up, this patch renames "event_location" to "location_spec" throughout, and then all the variables that hold a location spec, they are renamed to include "spec" in their name, like e.g., "location" -> "locspec". Similarly, functions that work with location specs, and currently have just "location" in their name are renamed to include "spec" in their name too. Change-Id: I5814124798aa2b2003e79496e78f95c74e5eddca
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-breakpoint.c20
-rw-r--r--gdb/python/py-finishbreakpoint.c6
-rw-r--r--gdb/python/python.c10
3 files changed, 18 insertions, 18 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 74de0d9..029ced74 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -412,8 +412,8 @@ bppy_get_location (PyObject *self, void *closure)
&& obj->bp->type != bp_hardware_breakpoint)
Py_RETURN_NONE;
- const char *str = event_location_to_string (obj->bp->location.get ());
- if (! str)
+ const char *str = location_spec_to_string (obj->bp->locspec.get ());
+ if (str == nullptr)
str = "";
return host_string_to_python_string (str).release ();
}
@@ -821,7 +821,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
case bp_breakpoint:
case bp_hardware_breakpoint:
{
- event_location_up location;
+ location_spec_up locspec;
symbol_name_match_type func_name_match_type
= (qualified != NULL && PyObject_IsTrue (qualified)
? symbol_name_match_type::FULL
@@ -833,9 +833,9 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
copy_holder (xstrdup (skip_spaces (spec)));
const char *copy = copy_holder.get ();
- location = string_to_event_location (&copy,
- current_language,
- func_name_match_type);
+ locspec = string_to_location_spec (&copy,
+ current_language,
+ func_name_match_type);
}
else
{
@@ -852,14 +852,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
explicit_loc.func_name_match_type = func_name_match_type;
- location = new_explicit_location (&explicit_loc);
+ locspec = new_explicit_location_spec (&explicit_loc);
}
- const struct breakpoint_ops *ops =
- breakpoint_ops_for_event_location (location.get (), false);
+ const struct breakpoint_ops *ops
+ = breakpoint_ops_for_location_spec (locspec.get (), false);
create_breakpoint (gdbpy_enter::get_gdbarch (),
- location.get (), NULL, -1, NULL, false,
+ locspec.get (), NULL, -1, NULL, false,
0,
temporary_bp, type,
0,
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index df54d36..c80096f 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -296,10 +296,10 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
try
{
/* Set a breakpoint on the return address. */
- event_location_up location
- = new_address_location (get_frame_pc (prev_frame), NULL, 0);
+ location_spec_up locspec
+ = new_address_location_spec (get_frame_pc (prev_frame), NULL, 0);
create_breakpoint (gdbpy_enter::get_gdbarch (),
- location.get (), NULL, thread, NULL, false,
+ locspec.get (), NULL, thread, NULL, false,
0,
1 /*temp_flag*/,
bp_breakpoint,
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 7faad2b..8f526bb 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -868,7 +868,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
const char *arg = NULL;
gdbpy_ref<> result;
gdbpy_ref<> unparsed;
- event_location_up location;
+ location_spec_up locspec;
if (! PyArg_ParseTuple (args, "|s", &arg))
return NULL;
@@ -883,17 +883,17 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
}
if (arg != NULL)
- location = string_to_event_location_basic (&arg, current_language,
- symbol_name_match_type::WILD);
+ locspec = string_to_location_spec_basic (&arg, current_language,
+ symbol_name_match_type::WILD);
std::vector<symtab_and_line> decoded_sals;
symtab_and_line def_sal;
gdb::array_view<symtab_and_line> sals;
try
{
- if (location != NULL)
+ if (locspec != NULL)
{
- decoded_sals = decode_line_1 (location.get (), 0, NULL, NULL, 0);
+ decoded_sals = decode_line_1 (locspec.get (), 0, NULL, NULL, 0);
sals = decoded_sals;
}
else