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");
}
_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,
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,
_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."),
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");
}
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,
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, _("\
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,
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");
}
{
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\
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
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");
}
{
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");
}
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");
}
_("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");
}
void
_initialize_extension ()
{
- gdb::observers::before_prompt.attach (ext_lang_before_prompt);
+ gdb::observers::before_prompt.attach (ext_lang_before_prompt, "extension");
}
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\
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);
/* 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");
}
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
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 ())
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, _("\
&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");
}
{
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");
}
{
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;
}
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");
}
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\
(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)
(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;
}
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)
&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;
{
/* 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."),
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. */
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."),
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 ();
_("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:
= 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,
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");
}
{
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."));
/* 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");
}
{
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\
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");
}
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);
}
_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");
}
}
/* 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");
}
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");
}
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 ()
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. */
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. */
/* 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. */
+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.
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:
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