diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-24 19:26:04 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-24 19:26:41 -0400 |
commit | c90e7d6352b2e16ac007d08b2e03ae10081147b5 (patch) | |
tree | 2ca6bb8a1d338ff48f2eed24dcb25300e4204f54 /gdb | |
parent | ec098003e27d67bca9e9880320e26ab8ad30fe31 (diff) | |
download | gdb-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')
45 files changed, 197 insertions, 141 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d170a1e..28f14c9 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13494,7 +13494,7 @@ DWARF attribute."), NULL, xcalloc, xfree); /* The ada-lang observers. */ - gdb::observers::new_objfile.attach (ada_new_objfile_observer); - gdb::observers::free_objfile.attach (ada_free_objfile_observer); - gdb::observers::inferior_exit.attach (ada_inferior_exit); + gdb::observers::new_objfile.attach (ada_new_objfile_observer, "ada-lang"); + gdb::observers::free_objfile.attach (ada_free_objfile_observer, "ada-lang"); + gdb::observers::inferior_exit.attach (ada_inferior_exit, "ada-lang"); } diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index a5908d4..a9c6b5e 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -1478,8 +1478,10 @@ void _initialize_tasks () { /* Attach various observers. */ - gdb::observers::normal_stop.attach (ada_tasks_normal_stop_observer); - gdb::observers::new_objfile.attach (ada_tasks_new_objfile_observer); + gdb::observers::normal_stop.attach (ada_tasks_normal_stop_observer, + "ada-tasks"); + gdb::observers::new_objfile.attach (ada_tasks_new_objfile_observer, + "ada-tasks"); /* Some new commands provided by this module. */ add_info ("tasks", info_tasks_command, diff --git a/gdb/agent.c b/gdb/agent.c index 79bb32e..5e52865 100644 --- a/gdb/agent.c +++ b/gdb/agent.c @@ -78,7 +78,8 @@ void _initialize_agent (); void _initialize_agent () { - gdb::observers::new_objfile.attach (agent_new_objfile); + gdb::observers::new_objfile.attach (agent_new_objfile, + "agent"); add_setshow_enum_cmd ("agent", class_run, can_use_agent_enum, diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index fc34210..889cb65 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -1839,11 +1839,12 @@ void _initialize_aix_thread () { /* Notice when object files get loaded and unloaded. */ - gdb::observers::new_objfile.attach (new_objfile); + gdb::observers::new_objfile.attach (new_objfile, "aix-thread"); /* Add ourselves to inferior_created event chain. This is needed to enable the thread target on "attach". */ - gdb::observers::inferior_created.attach (aix_thread_inferior_created); + gdb::observers::inferior_created.attach (aix_thread_inferior_created, + "aix-thread"); add_setshow_boolean_cmd ("aix-thread", class_maintenance, &debug_aix_thread, _("Set debugging of AIX thread module."), diff --git a/gdb/annotate.c b/gdb/annotate.c index 3d42aec..8c81373 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -627,8 +627,8 @@ void _initialize_annotate (); void _initialize_annotate () { - gdb::observers::breakpoint_created.attach (breakpoint_changed); - gdb::observers::breakpoint_deleted.attach (breakpoint_changed); - gdb::observers::breakpoint_modified.attach (breakpoint_changed); - gdb::observers::thread_exit.attach (annotate_thread_exited); + gdb::observers::breakpoint_created.attach (breakpoint_changed, "annotate"); + gdb::observers::breakpoint_deleted.attach (breakpoint_changed, "annotate"); + gdb::observers::breakpoint_modified.attach (breakpoint_changed, "annotate"); + gdb::observers::thread_exit.attach (annotate_thread_exited, "annotate"); } diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 2354009..056973f 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9553,7 +9553,7 @@ _initialize_arm_tdep () gdbarch_register (bfd_arch_arm, arm_gdbarch_init, arm_dump_tdep); /* Add ourselves to objfile event chain. */ - gdb::observers::new_objfile.attach (arm_exidx_new_objfile); + gdb::observers::new_objfile.attach (arm_exidx_new_objfile, "arm-tdep"); /* Register an ELF OS ABI sniffer for ARM binaries. */ gdbarch_register_osabi_sniffer (bfd_arch_arm, diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 1dfcf21..239efa3 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1503,7 +1503,7 @@ _initialize_auto_load () char *guile_name_help; const char *suffix; - gdb::observers::new_objfile.attach (auto_load_new_objfile); + gdb::observers::new_objfile.attach (auto_load_new_objfile, "auto-load"); add_setshow_boolean_cmd ("gdb-scripts", class_support, &auto_load_gdb_scripts, _("\ @@ -1613,7 +1613,8 @@ This option has security implications for untrusted inferiors."), show_auto_load_safe_path, auto_load_set_cmdlist_get (), auto_load_show_cmdlist_get ()); - gdb::observers::gdb_datadir_changed.attach (auto_load_gdb_datadir_changed); + gdb::observers::gdb_datadir_changed.attach (auto_load_gdb_datadir_changed, + "auto-load"); cmd = add_cmd ("add-auto-load-safe-path", class_support, add_auto_load_safe_path, @@ -600,7 +600,7 @@ _initialize_auxv () This is information provided by the operating system at program startup.")); /* Observers used to invalidate the auxv cache when needed. */ - gdb::observers::inferior_exit.attach (invalidate_auxv_cache_inf); - gdb::observers::inferior_appeared.attach (invalidate_auxv_cache_inf); - gdb::observers::executable_changed.attach (invalidate_auxv_cache); + gdb::observers::inferior_exit.attach (invalidate_auxv_cache_inf, "auxv"); + gdb::observers::inferior_appeared.attach (invalidate_auxv_cache_inf, "auxv"); + gdb::observers::executable_changed.attach (invalidate_auxv_cache, "auxv"); } diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c index 7335377..9100ac6 100644 --- a/gdb/break-catch-syscall.c +++ b/gdb/break-catch-syscall.c @@ -607,7 +607,8 @@ _initialize_break_catch_syscall () { initialize_syscall_catchpoint_ops (); - gdb::observers::inferior_exit.attach (clear_syscall_counts); + gdb::observers::inferior_exit.attach (clear_syscall_counts, + "break-catch-syscall"); add_catch_command ("syscall", _("\ Catch system calls by their names, groups and/or numbers.\n\ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index a20464a..9cc53f8 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -15646,9 +15646,12 @@ _initialize_breakpoint () initialize_breakpoint_ops (); - gdb::observers::solib_unloaded.attach (disable_breakpoints_in_unloaded_shlib); - gdb::observers::free_objfile.attach (disable_breakpoints_in_freed_objfile); - gdb::observers::memory_changed.attach (invalidate_bp_value_on_memory_change); + gdb::observers::solib_unloaded.attach (disable_breakpoints_in_unloaded_shlib, + "breakpoint"); + gdb::observers::free_objfile.attach (disable_breakpoints_in_freed_objfile, + "breakpoint"); + gdb::observers::memory_changed.attach (invalidate_bp_value_on_memory_change, + "breakpoint"); breakpoint_chain = 0; /* Don't bother to call set_breakpoint_count. $bpnum isn't useful @@ -16232,6 +16235,8 @@ This is useful for formatted output in user-defined commands.")); automatic_hardware_breakpoints = true; - gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed); - gdb::observers::thread_exit.attach (remove_threaded_breakpoints); + gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed, + "breakpoint"); + gdb::observers::thread_exit.attach (remove_threaded_breakpoints, + "breakpoint"); } diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c index 3cb8f64..f8353f0 100644 --- a/gdb/bsd-uthread.c +++ b/gdb/bsd-uthread.c @@ -550,7 +550,10 @@ _initialize_bsd_uthread () { bsd_uthread_data = gdbarch_data_register_pre_init (bsd_uthread_init); - gdb::observers::inferior_created.attach (bsd_uthread_inferior_created); - gdb::observers::solib_loaded.attach (bsd_uthread_solib_loaded); - gdb::observers::solib_unloaded.attach (bsd_uthread_solib_unloaded); + gdb::observers::inferior_created.attach (bsd_uthread_inferior_created, + "bsd-uthread"); + gdb::observers::solib_loaded.attach (bsd_uthread_solib_loaded, + "bsd-uthread"); + gdb::observers::solib_unloaded.attach (bsd_uthread_solib_unloaded, + "bsd-uthread"); } diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 882384e..31fe934 100644 --- a/gdb/cli/cli-interp.c +++ b/gdb/cli/cli-interp.c @@ -482,14 +482,16 @@ _initialize_cli_interp () interp_factory_register (INTERP_CONSOLE, cli_interp_factory); /* If changing this, remember to update tui-interp.c as well. */ - gdb::observers::normal_stop.attach (cli_on_normal_stop); - gdb::observers::end_stepping_range.attach (cli_on_end_stepping_range); - gdb::observers::signal_received.attach (cli_on_signal_received); - gdb::observers::signal_exited.attach (cli_on_signal_exited); - gdb::observers::exited.attach (cli_on_exited); - gdb::observers::no_history.attach (cli_on_no_history); - gdb::observers::sync_execution_done.attach (cli_on_sync_execution_done); - gdb::observers::command_error.attach (cli_on_command_error); + gdb::observers::normal_stop.attach (cli_on_normal_stop, "cli-interp"); + gdb::observers::end_stepping_range.attach (cli_on_end_stepping_range, + "cli-interp"); + gdb::observers::signal_received.attach (cli_on_signal_received, "cli-interp"); + gdb::observers::signal_exited.attach (cli_on_signal_exited, "cli-interp"); + gdb::observers::exited.attach (cli_on_exited, "cli-interp"); + gdb::observers::no_history.attach (cli_on_no_history, "cli-interp"); + gdb::observers::sync_execution_done.attach (cli_on_sync_execution_done, + "cli-interp"); + gdb::observers::command_error.attach (cli_on_command_error, "cli-interp"); gdb::observers::user_selected_context_changed.attach - (cli_on_user_selected_context_changed); + (cli_on_user_selected_context_changed, "cli-interp"); } diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 8269a40..6bbcbba 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -439,5 +439,5 @@ _initialize_dummy_frame () _("Print the contents of the internal dummy-frame stack."), &maintenanceprintlist); - gdb::observers::inferior_created.attach (cleanup_dummy_frames); + gdb::observers::inferior_created.attach (cleanup_dummy_frames, "dummy-frame"); } diff --git a/gdb/extension.c b/gdb/extension.c index 0e0d426..85d410e 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -900,5 +900,5 @@ void _initialize_extension (); void _initialize_extension () { - gdb::observers::before_prompt.attach (ext_lang_before_prompt); + gdb::observers::before_prompt.attach (ext_lang_before_prompt, "extension"); } diff --git a/gdb/frame.c b/gdb/frame.c index dc9fdd4..2032abb 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -3179,7 +3179,8 @@ _initialize_frame () frame_stash_create (); - gdb::observers::target_changed.attach (frame_observer_target_changed); + gdb::observers::target_changed.attach (frame_observer_target_changed, + "frame"); add_basic_prefix_cmd ("backtrace", class_maintenance, _("\ Set backtrace specific variables.\n\ diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c index af63893..25b438b 100644 --- a/gdb/guile/scm-breakpoint.c +++ b/gdb/guile/scm-breakpoint.c @@ -1322,8 +1322,10 @@ gdbscm_initialize_breakpoints (void) scm_set_smob_free (breakpoint_smob_tag, bpscm_free_breakpoint_smob); scm_set_smob_print (breakpoint_smob_tag, bpscm_print_breakpoint_smob); - gdb::observers::breakpoint_created.attach (bpscm_breakpoint_created); - gdb::observers::breakpoint_deleted.attach (bpscm_breakpoint_deleted); + gdb::observers::breakpoint_created.attach (bpscm_breakpoint_created, + "scm-breakpoint"); + gdb::observers::breakpoint_deleted.attach (bpscm_breakpoint_deleted, + "scm-breakpoint"); gdbscm_define_integer_constants (breakpoint_integer_constants, 1); gdbscm_define_functions (breakpoint_functions, 1); diff --git a/gdb/inflow.c b/gdb/inflow.c index b3d90aa..994c73e 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -963,5 +963,5 @@ _initialize_inflow () /* OK, figure out whether we have job control. */ have_job_control (); - gdb::observers::inferior_exit.attach (inflow_inferior_exit); + gdb::observers::inferior_exit.attach (inflow_inferior_exit, "inflow"); } diff --git a/gdb/infrun.c b/gdb/infrun.c index 2c31cf4..cfec079 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -9759,11 +9759,13 @@ enabled by default on some platforms."), inferior_ptid = null_ptid; target_last_wait_ptid = minus_one_ptid; - gdb::observers::thread_ptid_changed.attach (infrun_thread_ptid_changed); - gdb::observers::thread_stop_requested.attach (infrun_thread_stop_requested); - gdb::observers::thread_exit.attach (infrun_thread_thread_exit); - gdb::observers::inferior_exit.attach (infrun_inferior_exit); - gdb::observers::inferior_execd.attach (infrun_inferior_execd); + gdb::observers::thread_ptid_changed.attach (infrun_thread_ptid_changed, + "infrun"); + gdb::observers::thread_stop_requested.attach (infrun_thread_stop_requested, + "infrun"); + gdb::observers::thread_exit.attach (infrun_thread_thread_exit, "infrun"); + gdb::observers::inferior_exit.attach (infrun_inferior_exit, "infrun"); + gdb::observers::inferior_execd.attach (infrun_inferior_execd, "infrun"); /* Explicitly create without lookup, since that tries to create a value with a void typed value, and when we get here, gdbarch @@ -1243,10 +1243,10 @@ _initialize_jit () show_jit_debug, &setdebuglist, &showdebuglist); - gdb::observers::inferior_created.attach (jit_inferior_created_hook); - gdb::observers::inferior_execd.attach (jit_inferior_created_hook); - gdb::observers::inferior_exit.attach (jit_inferior_exit_hook); - gdb::observers::breakpoint_deleted.attach (jit_breakpoint_deleted); + gdb::observers::inferior_created.attach (jit_inferior_created_hook, "jit"); + gdb::observers::inferior_execd.attach (jit_inferior_created_hook, "jit"); + gdb::observers::inferior_exit.attach (jit_inferior_exit_hook, "jit"); + gdb::observers::breakpoint_deleted.attach (jit_breakpoint_deleted, "jit"); jit_gdbarch_data = gdbarch_data_register_pre_init (jit_gdbarch_data_init); if (is_dl_available ()) diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 19604b5..927e69b 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -2694,9 +2694,12 @@ _initialize_linux_tdep () gdbarch_data_register_pre_init (init_linux_gdbarch_data); /* Observers used to invalidate the cache when needed. */ - gdb::observers::inferior_exit.attach (invalidate_linux_cache_inf); - gdb::observers::inferior_appeared.attach (invalidate_linux_cache_inf); - gdb::observers::inferior_execd.attach (invalidate_linux_cache_inf); + gdb::observers::inferior_exit.attach (invalidate_linux_cache_inf, + "linux-tdep"); + gdb::observers::inferior_appeared.attach (invalidate_linux_cache_inf, + "linux-tdep"); + gdb::observers::inferior_execd.attach (invalidate_linux_cache_inf, + "linux-tdep"); add_setshow_boolean_cmd ("use-coredump-filter", class_files, &use_coredump_filter, _("\ diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index de8687e..1c6ea4d 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -2028,10 +2028,11 @@ as they are loaded."), &maintenance_show_cmdlist); /* Add ourselves to objfile event chain. */ - gdb::observers::new_objfile.attach (thread_db_new_objfile); + gdb::observers::new_objfile.attach (thread_db_new_objfile, "linux-thread-db"); /* Add ourselves to inferior_created event chain. This is needed to handle debugging statically linked programs where the new_objfile observer won't get called for libpthread. */ - gdb::observers::inferior_created.attach (thread_db_inferior_created); + gdb::observers::inferior_created.attach (thread_db_inferior_created, + "linux-thread-db"); } diff --git a/gdb/m68k-linux-tdep.c b/gdb/m68k-linux-tdep.c index 7b3cd5f..c72f485 100644 --- a/gdb/m68k-linux-tdep.c +++ b/gdb/m68k-linux-tdep.c @@ -429,5 +429,6 @@ _initialize_m68k_linux_tdep () { gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_LINUX, m68k_linux_init_abi); - gdb::observers::inferior_created.attach (m68k_linux_inferior_created); + gdb::observers::inferior_created.attach (m68k_linux_inferior_created, + "m68k-linux-tdep"); } diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 5a4a62c..1b7eaf5 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -84,7 +84,8 @@ setup_breakpoint_reporting (void) { if (! mi_breakpoint_observers_installed) { - gdb::observers::breakpoint_created.attach (breakpoint_notify); + gdb::observers::breakpoint_created.attach (breakpoint_notify, + "mi-cmd-break"); mi_breakpoint_observers_installed = 1; } diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 4c5612e..144521b 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -1338,33 +1338,40 @@ _initialize_mi_interp () interp_factory_register (INTERP_MI3, mi_interp_factory); interp_factory_register (INTERP_MI, mi_interp_factory); - gdb::observers::signal_received.attach (mi_on_signal_received); - gdb::observers::end_stepping_range.attach (mi_on_end_stepping_range); - gdb::observers::signal_exited.attach (mi_on_signal_exited); - gdb::observers::exited.attach (mi_on_exited); - gdb::observers::no_history.attach (mi_on_no_history); - gdb::observers::new_thread.attach (mi_new_thread); - gdb::observers::thread_exit.attach (mi_thread_exit); - gdb::observers::inferior_added.attach (mi_inferior_added); - gdb::observers::inferior_appeared.attach (mi_inferior_appeared); - gdb::observers::inferior_exit.attach (mi_inferior_exit); - gdb::observers::inferior_removed.attach (mi_inferior_removed); - gdb::observers::record_changed.attach (mi_record_changed); - gdb::observers::normal_stop.attach (mi_on_normal_stop); - gdb::observers::target_resumed.attach (mi_on_resume); - gdb::observers::solib_loaded.attach (mi_solib_loaded); - gdb::observers::solib_unloaded.attach (mi_solib_unloaded); - gdb::observers::about_to_proceed.attach (mi_about_to_proceed); - gdb::observers::traceframe_changed.attach (mi_traceframe_changed); - gdb::observers::tsv_created.attach (mi_tsv_created); - gdb::observers::tsv_deleted.attach (mi_tsv_deleted); - gdb::observers::tsv_modified.attach (mi_tsv_modified); - gdb::observers::breakpoint_created.attach (mi_breakpoint_created); - gdb::observers::breakpoint_deleted.attach (mi_breakpoint_deleted); - gdb::observers::breakpoint_modified.attach (mi_breakpoint_modified); - gdb::observers::command_param_changed.attach (mi_command_param_changed); - gdb::observers::memory_changed.attach (mi_memory_changed); - gdb::observers::sync_execution_done.attach (mi_on_sync_execution_done); + gdb::observers::signal_received.attach (mi_on_signal_received, "mi-interp"); + gdb::observers::end_stepping_range.attach (mi_on_end_stepping_range, + "mi-interp"); + gdb::observers::signal_exited.attach (mi_on_signal_exited, "mi-interp"); + gdb::observers::exited.attach (mi_on_exited, "mi-interp"); + gdb::observers::no_history.attach (mi_on_no_history, "mi-interp"); + gdb::observers::new_thread.attach (mi_new_thread, "mi-interp"); + gdb::observers::thread_exit.attach (mi_thread_exit, "mi-interp"); + gdb::observers::inferior_added.attach (mi_inferior_added, "mi-interp"); + gdb::observers::inferior_appeared.attach (mi_inferior_appeared, "mi-interp"); + gdb::observers::inferior_exit.attach (mi_inferior_exit, "mi-interp"); + gdb::observers::inferior_removed.attach (mi_inferior_removed, "mi-interp"); + gdb::observers::record_changed.attach (mi_record_changed, "mi-interp"); + gdb::observers::normal_stop.attach (mi_on_normal_stop, "mi-interp"); + gdb::observers::target_resumed.attach (mi_on_resume, "mi-interp"); + gdb::observers::solib_loaded.attach (mi_solib_loaded, "mi-interp"); + gdb::observers::solib_unloaded.attach (mi_solib_unloaded, "mi-interp"); + gdb::observers::about_to_proceed.attach (mi_about_to_proceed, "mi-interp"); + gdb::observers::traceframe_changed.attach (mi_traceframe_changed, + "mi-interp"); + gdb::observers::tsv_created.attach (mi_tsv_created, "mi-interp"); + gdb::observers::tsv_deleted.attach (mi_tsv_deleted, "mi-interp"); + gdb::observers::tsv_modified.attach (mi_tsv_modified, "mi-interp"); + gdb::observers::breakpoint_created.attach (mi_breakpoint_created, + "mi-interp"); + gdb::observers::breakpoint_deleted.attach (mi_breakpoint_deleted, + "mi-interp"); + gdb::observers::breakpoint_modified.attach (mi_breakpoint_modified, + "mi-interp"); + gdb::observers::command_param_changed.attach (mi_command_param_changed, + "mi-interp"); + gdb::observers::memory_changed.attach (mi_memory_changed, "mi-interp"); + gdb::observers::sync_execution_done.attach (mi_on_sync_execution_done, + "mi-interp"); gdb::observers::user_selected_context_changed.attach - (mi_user_selected_context_changed); + (mi_user_selected_context_changed, "mi-interp"); } diff --git a/gdb/printcmd.c b/gdb/printcmd.c index a4f62f2..1c68d19 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -3186,7 +3186,8 @@ _initialize_printcmd () current_display_number = -1; - gdb::observers::free_objfile.attach (clear_dangling_display_expressions); + gdb::observers::free_objfile.attach (clear_dangling_display_expressions, + "printcmd"); add_info ("address", info_address_command, _("Describe where symbol SYM is stored.\n\ 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; diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 1398d1b..84a0390 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -714,7 +714,8 @@ _initialize_ravenscar () { /* Notice when the inferior is created in order to push the ravenscar ops if needed. */ - gdb::observers::inferior_created.attach (ravenscar_inferior_created); + gdb::observers::inferior_created.attach (ravenscar_inferior_created, + "ravenscar-thread"); add_basic_prefix_cmd ("ravenscar", no_class, _("Prefix command for changing Ravenscar-specific settings."), diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index b7b3c91..c888ad0 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -307,7 +307,8 @@ record_btrace_auto_enable (void) DEBUG ("attach thread observer"); gdb::observers::new_thread.attach (record_btrace_enable_warn, - record_btrace_thread_observer_token); + record_btrace_thread_observer_token, + "record-btrace"); } /* Disable automatic tracing of new threads. */ diff --git a/gdb/regcache.c b/gdb/regcache.c index bf3c6f4..d238630 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -2084,8 +2084,10 @@ _initialize_regcache () regcache_descr_handle = gdbarch_data_register_post_init (init_regcache_descr); - gdb::observers::target_changed.attach (regcache_observer_target_changed); - gdb::observers::thread_ptid_changed.attach (regcache_thread_ptid_changed); + gdb::observers::target_changed.attach (regcache_observer_target_changed, + "regcache"); + gdb::observers::thread_ptid_changed.attach (regcache_thread_ptid_changed, + "regcache"); add_cmd ("register-cache", class_maintenance, reg_flush_command, _("Force gdb to flush its register and frame cache."), diff --git a/gdb/remote.c b/gdb/remote.c index 2e365df..a7312a9 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -14842,7 +14842,7 @@ _initialize_remote () add_target (extended_remote_target_info, extended_remote_target::open); /* Hook into new objfile notification. */ - gdb::observers::new_objfile.attach (remote_new_objfile); + gdb::observers::new_objfile.attach (remote_new_objfile, "remote"); #if 0 init_remote_threadtests (); diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 825f691..18eacf1 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -1190,7 +1190,7 @@ _initialize_sol_thread () _("Show info on Solaris user threads."), &maintenanceinfolist); /* Hook into new_objfile notification. */ - gdb::observers::new_objfile.attach (sol_thread_new_objfile); + gdb::observers::new_objfile.attach (sol_thread_new_objfile, "sol-thread"); return; die: diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index faccf29..4b58058 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -737,7 +737,8 @@ _initialize_solib_aix () = solib_aix_in_dynsym_resolve_code; solib_aix_so_ops.bfd_open = solib_aix_bfd_open; - gdb::observers::normal_stop.attach (solib_aix_normal_stop_observer); + gdb::observers::normal_stop.attach (solib_aix_normal_stop_observer, + "solib-aix"); /* Debug this file's internals. */ add_setshow_boolean_cmd ("aix-solib", class_maintenance, diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 5314694..60eeac5 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -3296,5 +3296,6 @@ _initialize_svr4_solib () svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints; svr4_so_ops.handle_event = svr4_handle_solib_event; - gdb::observers::free_objfile.attach (svr4_free_objfile_observer); + gdb::observers::free_objfile.attach (svr4_free_objfile_observer, + "solib-svr4"); } diff --git a/gdb/solib.c b/gdb/solib.c index d32b221..f3cd48f 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1556,11 +1556,12 @@ _initialize_solib () { solib_data = gdbarch_data_register_pre_init (solib_init); - gdb::observers::free_objfile.attach (remove_user_added_objfile); + gdb::observers::free_objfile.attach (remove_user_added_objfile, + "solib"); gdb::observers::inferior_execd.attach ([] (inferior *inf) { solib_create_inferior_hook (0); - }); + }, "solib"); add_com ("sharedlibrary", class_files, sharedlibrary_command, _("Load shared object library symbols for files matching REGEXP.")); diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index c676647..cc3a777 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -218,5 +218,5 @@ _initialize_symfile_mem () /* Want to know of each new inferior so that its vsyscall info can be extracted. */ - gdb::observers::inferior_created.attach (add_vsyscall_page); + gdb::observers::inferior_created.attach (add_vsyscall_page, "symfile-mem"); } diff --git a/gdb/symfile.c b/gdb/symfile.c index 7dfe1ee..5defc22 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3814,7 +3814,7 @@ _initialize_symfile () { struct cmd_list_element *c; - gdb::observers::free_objfile.attach (symfile_free_objfile); + gdb::observers::free_objfile.attach (symfile_free_objfile, "symfile"); #define READNOW_READNEVER_HELP \ "The '-readnow' option will cause GDB to read the entire symbol file\n\ diff --git a/gdb/symtab.c b/gdb/symtab.c index 274ddfd..061177e 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -6906,7 +6906,8 @@ If zero then the symbol cache is disabled."), class_maintenance, 0, &maintenancelist); deprecate_cmd (c, "maintenancelist flush symbol-cache"); - gdb::observers::executable_changed.attach (symtab_observer_executable_changed); - gdb::observers::new_objfile.attach (symtab_new_objfile_observer); - gdb::observers::free_objfile.attach (symtab_free_objfile_observer); + gdb::observers::executable_changed.attach (symtab_observer_executable_changed, + "symtab"); + gdb::observers::new_objfile.attach (symtab_new_objfile_observer, "symtab"); + gdb::observers::free_objfile.attach (symtab_free_objfile_observer, "symtab"); } diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 2d7660a..52519ae 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -222,7 +222,7 @@ static void attach_or_detach (T &observable, typename T::func_type func, bool attach) { if (attach) - observable.attach (func, tui_observers_token); + observable.attach (func, tui_observers_token, "tui-hooks"); else observable.detach (tui_observers_token); } @@ -282,5 +282,5 @@ void _initialize_tui_hooks () { /* Install the permanent hooks. */ - gdb::observers::new_objfile.attach (tui_new_objfile_hook); + gdb::observers::new_objfile.attach (tui_new_objfile_hook, "tui-hooks"); } diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c index f70e1a7..aaa353c 100644 --- a/gdb/tui/tui-interp.c +++ b/gdb/tui/tui-interp.c @@ -343,14 +343,16 @@ _initialize_tui_interp () } /* If changing this, remember to update cli-interp.c as well. */ - gdb::observers::normal_stop.attach (tui_on_normal_stop); - gdb::observers::signal_received.attach (tui_on_signal_received); - gdb::observers::end_stepping_range.attach (tui_on_end_stepping_range); - gdb::observers::signal_exited.attach (tui_on_signal_exited); - gdb::observers::exited.attach (tui_on_exited); - gdb::observers::no_history.attach (tui_on_no_history); - gdb::observers::sync_execution_done.attach (tui_on_sync_execution_done); - gdb::observers::command_error.attach (tui_on_command_error); + gdb::observers::normal_stop.attach (tui_on_normal_stop, "tui-interp"); + gdb::observers::signal_received.attach (tui_on_signal_received, "tui-interp"); + gdb::observers::end_stepping_range.attach (tui_on_end_stepping_range, + "tui-interp"); + gdb::observers::signal_exited.attach (tui_on_signal_exited, "tui-interp"); + gdb::observers::exited.attach (tui_on_exited, "tui-interp"); + gdb::observers::no_history.attach (tui_on_no_history, "tui-interp"); + gdb::observers::sync_execution_done.attach (tui_on_sync_execution_done, + "tui-interp"); + gdb::observers::command_error.attach (tui_on_command_error, "tui-interp"); gdb::observers::user_selected_context_changed.attach - (tui_on_user_selected_context_changed); + (tui_on_user_selected_context_changed, "tui-interp"); } diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index c73d129..17682b0 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1120,6 +1120,6 @@ the line numbers and uses less horizontal space."), tui_set_compact_source, tui_show_compact_source, &tui_setlist, &tui_showlist); - tui_border_style.changed.attach (tui_rehighlight_all); - tui_active_border_style.changed.attach (tui_rehighlight_all); + tui_border_style.changed.attach (tui_rehighlight_all, "tui-win"); + tui_active_border_style.changed.attach (tui_rehighlight_all, "tui-win"); } diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 058079e..908d901 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -294,7 +294,7 @@ tui_source_window_base::tui_source_window_base () gdb::observers::source_styling_changed.attach (std::bind (&tui_source_window::style_changed, this), - m_observable); + m_observable, "tui-winsource"); } tui_source_window_base::~tui_source_window_base () diff --git a/gdb/unittests/observable-selftests.c b/gdb/unittests/observable-selftests.c index e19eaf8..0e3b53f 100644 --- a/gdb/unittests/observable-selftests.c +++ b/gdb/unittests/observable-selftests.c @@ -73,7 +73,7 @@ run_tests () const gdb::observers::token token1 {}, token2 {} , token3 {}; /* Now, attach one observer, and send a notification. */ - test_notification.attach (&test_second_notification_function, token2); + test_notification.attach (&test_second_notification_function, token2, "test"); notify_check_counters (0, 1, 0); /* Remove the observer, and send a notification. */ @@ -81,15 +81,15 @@ run_tests () notify_check_counters (0, 0, 0); /* With a new observer. */ - test_notification.attach (&test_first_notification_function, token1); + test_notification.attach (&test_first_notification_function, token1, "test"); notify_check_counters (1, 0, 0); /* With 2 observers. */ - test_notification.attach (&test_second_notification_function, token2); + test_notification.attach (&test_second_notification_function, token2, "test"); notify_check_counters (1, 1, 0); /* With 3 observers. */ - test_notification.attach (&test_third_notification_function, token3); + test_notification.attach (&test_third_notification_function, token3, "test"); notify_check_counters (1, 1, 1); /* Remove middle observer. */ @@ -106,9 +106,9 @@ run_tests () /* Go back to 3 observers, and remove them in a different order... */ - test_notification.attach (&test_first_notification_function, token1); - test_notification.attach (&test_second_notification_function, token2); - test_notification.attach (&test_third_notification_function, token3); + test_notification.attach (&test_first_notification_function, token1, "test"); + test_notification.attach (&test_second_notification_function, token2, "test"); + test_notification.attach (&test_third_notification_function, token3, "test"); notify_check_counters (1, 1, 1); /* Remove the third observer. */ |