aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-24 19:26:04 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-24 19:26:41 -0400
commitc90e7d6352b2e16ac007d08b2e03ae10081147b5 (patch)
tree2ca6bb8a1d338ff48f2eed24dcb25300e4204f54 /gdb/python
parentec098003e27d67bca9e9880320e26ab8ad30fe31 (diff)
downloadgdb-c90e7d6352b2e16ac007d08b2e03ae10081147b5.zip
gdb-c90e7d6352b2e16ac007d08b2e03ae10081147b5.tar.gz
gdb-c90e7d6352b2e16ac007d08b2e03ae10081147b5.tar.bz2
gdbsupport, gdb: give names to observers
Give a name to each observer, this will help produce more meaningful debug message. gdbsupport/ChangeLog: * observable.h (class observable) <struct observer> <observer>: Add name parameter. <name>: New field. <attach>: Add name parameter, update all callers. Change-Id: Ie0cc4664925215b8d2b09e026011b7803549fba0
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-breakpoint.c9
-rw-r--r--gdb/python/py-finishbreakpoint.c6
-rw-r--r--gdb/python/py-inferior.c29
-rw-r--r--gdb/python/py-unwind.c3
4 files changed, 29 insertions, 18 deletions
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 9650bd0..b414071 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -1125,9 +1125,12 @@ gdbpy_initialize_breakpoints (void)
(PyObject *) &breakpoint_object_type) < 0)
return -1;
- gdb::observers::breakpoint_created.attach (gdbpy_breakpoint_created);
- gdb::observers::breakpoint_deleted.attach (gdbpy_breakpoint_deleted);
- gdb::observers::breakpoint_modified.attach (gdbpy_breakpoint_modified);
+ gdb::observers::breakpoint_created.attach (gdbpy_breakpoint_created,
+ "py-breakpoint");
+ gdb::observers::breakpoint_deleted.attach (gdbpy_breakpoint_deleted,
+ "py-breakpoint");
+ gdb::observers::breakpoint_modified.attach (gdbpy_breakpoint_modified,
+ "py-breakpoint");
/* Add breakpoint types constants. */
for (i = 0; pybp_codes[i].name; ++i)
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 38b4cc6..d2a1ec4 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -417,8 +417,10 @@ gdbpy_initialize_finishbreakpoints (void)
(PyObject *) &finish_breakpoint_object_type) < 0)
return -1;
- gdb::observers::normal_stop.attach (bpfinishpy_handle_stop);
- gdb::observers::inferior_exit.attach (bpfinishpy_handle_exit);
+ gdb::observers::normal_stop.attach (bpfinishpy_handle_stop,
+ "py-finishbreakpoint");
+ gdb::observers::inferior_exit.attach (bpfinishpy_handle_exit,
+ "py-finishbreakpoint");
return 0;
}
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index a3d5952..c2861cc 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -904,18 +904,23 @@ gdbpy_initialize_inferior (void)
infpy_inf_data_key =
register_inferior_data_with_cleanup (NULL, py_free_inferior);
- gdb::observers::new_thread.attach (add_thread_object);
- gdb::observers::thread_exit.attach (delete_thread_object);
- gdb::observers::normal_stop.attach (python_on_normal_stop);
- gdb::observers::target_resumed.attach (python_on_resume);
- gdb::observers::inferior_call_pre.attach (python_on_inferior_call_pre);
- gdb::observers::inferior_call_post.attach (python_on_inferior_call_post);
- gdb::observers::memory_changed.attach (python_on_memory_change);
- gdb::observers::register_changed.attach (python_on_register_change);
- gdb::observers::inferior_exit.attach (python_inferior_exit);
- gdb::observers::new_objfile.attach (python_new_objfile);
- gdb::observers::inferior_added.attach (python_new_inferior);
- gdb::observers::inferior_removed.attach (python_inferior_deleted);
+ gdb::observers::new_thread.attach (add_thread_object, "py-inferior");
+ gdb::observers::thread_exit.attach (delete_thread_object, "py-inferior");
+ gdb::observers::normal_stop.attach (python_on_normal_stop, "py-inferior");
+ gdb::observers::target_resumed.attach (python_on_resume, "py-inferior");
+ gdb::observers::inferior_call_pre.attach (python_on_inferior_call_pre,
+ "py-inferior");
+ gdb::observers::inferior_call_post.attach (python_on_inferior_call_post,
+ "py-inferior");
+ gdb::observers::memory_changed.attach (python_on_memory_change,
+ "py-inferior");
+ gdb::observers::register_changed.attach (python_on_register_change,
+ "py-inferior");
+ gdb::observers::inferior_exit.attach (python_inferior_exit, "py-inferior");
+ gdb::observers::new_objfile.attach (python_new_objfile, "py-inferior");
+ gdb::observers::inferior_added.attach (python_new_inferior, "py-inferior");
+ gdb::observers::inferior_removed.attach (python_inferior_deleted,
+ "py-inferior");
membuf_object_type.tp_new = PyType_GenericNew;
if (PyType_Ready (&membuf_object_type) < 0)
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index f0574eb..5dc8d33 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -630,7 +630,8 @@ gdbpy_initialize_unwind (void)
&setdebuglist, &showdebuglist);
pyuw_gdbarch_data
= gdbarch_data_register_post_init (pyuw_gdbarch_data_init);
- gdb::observers::architecture_changed.attach (pyuw_on_new_gdbarch);
+ gdb::observers::architecture_changed.attach (pyuw_on_new_gdbarch,
+ "py-unwind");
if (PyType_Ready (&pending_frame_object_type) < 0)
return -1;