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
This commit is contained in:
parent
ec098003e2
commit
c90e7d6352
47 changed files with 219 additions and 149 deletions
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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."),
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
12
gdb/infrun.c
12
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 ())
|
||||
|
|
|
@ -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, _("\
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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."),
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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."),
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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."));
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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\
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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 ()
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2021-04-24 Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
* observable.h (class observable) <struct observer> <observer>:
|
||||
Add name parameter.
|
||||
<name>: New field.
|
||||
<attach>: Add name parameter, update all callers.
|
||||
|
||||
2021-04-24 Simon Marchi <simon.marchi@polymtl.ca>
|
||||
|
||||
* observable.h (class observable) <struct observer>: New.
|
||||
|
|
|
@ -61,12 +61,13 @@ public:
|
|||
private:
|
||||
struct observer
|
||||
{
|
||||
observer (const struct token *token, func_type func)
|
||||
: token (token), func (func)
|
||||
observer (const struct token *token, func_type func, const char *name)
|
||||
: token (token), func (func), name (name)
|
||||
{}
|
||||
|
||||
const struct token *token;
|
||||
func_type func;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -78,17 +79,23 @@ public:
|
|||
DISABLE_COPY_AND_ASSIGN (observable);
|
||||
|
||||
/* Attach F as an observer to this observable. F cannot be
|
||||
detached. */
|
||||
void attach (const func_type &f)
|
||||
detached.
|
||||
|
||||
NAME is the name of the observer, used for debug output purposes. Its
|
||||
lifetime must be at least as long as the observer is attached. */
|
||||
void attach (const func_type &f, const char *name)
|
||||
{
|
||||
m_observers.emplace_back (nullptr, f);
|
||||
m_observers.emplace_back (nullptr, f, name);
|
||||
}
|
||||
|
||||
/* Attach F as an observer to this observable. T is a reference to
|
||||
a token that can be used to later remove F. */
|
||||
void attach (const func_type &f, const token &t)
|
||||
a token that can be used to later remove F.
|
||||
|
||||
NAME is the name of the observer, used for debug output purposes. Its
|
||||
lifetime must be at least as long as the observer is attached. */
|
||||
void attach (const func_type &f, const token &t, const char *name)
|
||||
{
|
||||
m_observers.emplace_back (&t, f);
|
||||
m_observers.emplace_back (&t, f, name);
|
||||
}
|
||||
|
||||
/* Remove observers associated with T from this observable. T is
|
||||
|
|
Loading…
Add table
Reference in a new issue