Rename variables hiding others defined on another scope.
* gdbtk/generic/gdbtk-cmds.c (gdb_find_file_command): rename struct stat st to
sbuf.
* gdbtk/generic/gdbtk-varobj.c (variable_update): rename Tcl_Obj *var to v.
* gdbtk/generic/gdbtk.c: global gdbtk_source_filename is now an std::string.
(gdbtk_source_start_file): drop const char *s, rephrase concatenation in C++.
(gdbtk_test): xstrdup is not needed anymore.
* gdbtk/generic/gdbtk-bp.c (gdb_trace_status): tp_vec is now an
std::vector<breakpoint *>.
* gdbtk/generic/gdbtk-cmds.c (gdb_clear_file): replace ptid_equal() call
by the inequality operator.
(gdb_target_has_execution_command): likewise.
(gdb_loc): likewise.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_call_command): replace ptid_equal() call
by the inequality operator.
(gdbtk_annotate_signal): replace ptid_equal() call by the equality operator.
Patrick Monnerat [Sun, 24 Jun 2018 15:00:35 +0000 (17:00 +0200)]
Introduce watchpoints.
New watchpoint events, a watchpoint window (double-click shows the
expression in the watch window), menu entries and icons to open watchpoint
window and add a watchpoint for a variable.
* gdbtk/generic/gdbtk-bp.c (have_masked_watchpoints): new local procedure.
(gdb_get_watchpoint_list): new tcl procedure.
(gdb_get_watchpoint_info): new tcl procedure.
(gdb_have_masked_watchpoints): new tcl procedure.
(breakpoint_notify): handle watchpoints.
* gdbtk/library/ehandler.ith (GDBEventHandler::watchpoint): new method.
* gdbtk/library/gdbevent.ith (WatchpointEvent): new class.
* gdbtk/library/gdbevent.itb (WatchpointEvent::get): new method.
(WatchpointEvent::_init): new method.
* gdbtk/library/interface.tcl (gdbtk_tcl_watchpoint): new procedure.
* gdbtk/library/pointwin.it[hb] (PointWin::watchpoint): new method.
* gdbtk/library/images/wp.gif: new icon image
* gdbtk/library/images2/wp.gif: new icon image
* gdbtk/library/prefs.tcl (pref_set_defaults): define watchpoints preferences.
* gdbtk/library/session.tcl (_serialize_bps): serialize watchpoints too.
* gdbtk/library/srcbar.itcl (SrcBar::create_view_menu): new Watchpoints entry.
(SrcBar::create_window_buttons): new watchpoints button.
(SrcBar::_load_images): load watchpoints icon image.
* gdbtk/library/srctextwin.it[hb] (SrcTextWin::config_win): bind watchpoints
shortcut.
(SrcTextWin::watchpoint): new method.
(SrcTextWin::do_source_popup): add menu entry to set a watchpoint on variable.
(SrcTextWin::do_key): handle watchpoint key binding.
* gdbtk/library/wpwin.it[hb] (WpWin) new class.
(WpWin::constructor): new.
(WpWin::watch_type): new variable.
(WpWin::watch_entry): new variable.
(WpWin::global_menu): new overloaded method.
(WpWin::local_menu): new overloaded method.
(WpWin::update_local_menu): new overloaded method.
(WpWin::header): new overloaded method.
(WpWin::change): new overloaded method.
(WpWin::add): new overloaded method.
(WpWin::store): new method.
(WpWin::watchpoint): new overloaded method.
(WpWin::toggle_threads): new method.
(WpWin::set_type): new method.
(WpWin::goto): new overloaded method.
(WpWin::delete_point): new overloaded method.
(WpWin::get_point_list): new overloaded method.
Patrick Monnerat [Sun, 24 Jun 2018 14:14:06 +0000 (16:14 +0200)]
Fix error occurring upon watch window closing.
Since some idle script can be pending for a VarTree, let tcl destroy it
when possible.
* gdbtk/library/watch.tcl (WatchTree::destructor): only delete variables
and clear root list; do not act on parent VarTree.
(WatchWin::destructor): do not explicitly delete tree, just unreference it.
Patrick Monnerat [Sun, 24 Jun 2018 12:18:45 +0000 (14:18 +0200)]
Restructure breakpoint/tracepoint window code.
BpWin and TpWin classes are now subclasses of a new PointWin class.
PointWin implements the window layout and its subclasses only provide
specific content-related code. See gdbtk/library/pointwin.ith for more
details.
Condition, ignore count and hits count columns are also added.
* gdbtk/library/pointwin.ith (PointWin): new class.
(PointWin::PointKind): new variable.
(PointWin::MenuBar): new variable.
(PointWin::Menu): new variable.
(PointWin::columns): new variable.
(PointWin::twin): new variable.
(PointWin::selected): new variable.
(PointWin::next_row): new variable.
(PointWin::bg1): new variable.
(PointWin::index_to_num): new variable.
(PointWin::enabled): new variable.
(PointWin::hidden): new variable.
* gdbtk/library/pointwin.itb (PointWin::constructor): new method.
(PointWin::create_event): new method.
(PointWin)::select): new method.
(PointWin::enable_disable): new method.
(PointWin::remove): new method.
(PointWin::delete_point): new method.
(PointWin::breakpoint): new method.
(PointWin::tracepoint): new method.
(PointWin::forall): new method.
(PointWin::hide_column): new method.
(PointWin::show_column): new method.
(PointWin::change): new method.
(PointWin::add): new method.
(PointWin::modify): new method.
(PointWin::restore): new method.
(PointWin::_select_and_popup): new method.
(PointWin::basename): new method.
(PointWin::header): new method.
(PointWin::global_menu): new method.
(PointWin::local_menu): new method.
(PointWin::update_local_menu): new method.
(PointWin::goto): new method.
(PointWin::store_details): new method.
* gdbtk/library/bpwin.it[hb] (BpWin): subclass of PointWin.
(BpWin::tracepoints): removed.
(BpWin::twin): removed.
(BpWin::next_row): removed.
(BpWin::index_to_bpnum): removed.
(BpWin::Index_to_bptype): renamed BpWin::disposition.
(BpWin::selected): removed.
(BpWin::mbar): removed.
(BpWin::bg1): removed.
(BpWin::Menu): removed.
(BpWin::show_threads): removed.
(BpWin::constructor): moved to bpwin.ith.
(BpWin::destructor): removed.
(BpWin::build_win): removed.
(BpWin::bp_add): renamed BpWin::add. Uses parent method.
(BpWin::bp_store): renamed BpWin::store.
(BpWin::bp_restore): removed.
(BpWin::bp_select): removed.
(BpWin:: _select_and_popup): removed.
(BpWin::bp_modify): removed.
(BpWin::bp_able): renamed BpWin::enable_disable. Uses parent method.
(BpWin::bp_remove): removed.
(BpWin::bp_type): renamed BpWin::set_type.
(BpWin::bp_delete): removed.
(BpWin::tracepoint): removed.
(BpWin::bp_all): renamed BpWin::forall. Uses parent method.
(BpWin::get_actions): removed.
(BpWin::toggle_threads): Use parent methods hide_column/show_column.
(BpWin::reconfig): removed.
(BpWin::goto_bp): renamed BpWin::goto.
(BpWin::global_menu): new overloaded method.
(BpWin::local_menu): new overloaded method.
(BpWin::update_local_menu): new overloaded method.
(BpWin::header): new overloaded method.
(BpWin::change): new overloaded method.
(BpWin::get_point_list): new overloaded method.
* gdbtk/library/tpwin.itcl: deleted.
* gdbtk/library/tpwin.it[hb] (TpWin): subclass of PointWin.
(TpWin::constructor): uses parent method.
(TpWin::local_menu): new overloaded method.
(TpWin::update_local_menu): new overloaded method.
(TpWin::header): new overloaded method.
(TpWin::change): new overloaded method.
(TpWin::add): new overloaded method.
(TpWin::store): new method.
(TpWin::forall): new overloaded method.
(TpWin::enable_disable): new overloaded method.
(TpWin::remove): new overloaded method.
(TpWin::tracepoint): new overloaded method.
(TpWin::get_actions): new method.
(TpWin::goto): new overloaded method.
(TpWin::get_point_list): new overloaded method.
Patrick Monnerat [Sun, 24 Jun 2018 10:14:47 +0000 (12:14 +0200)]
Breakpoint events do no include other point events anymore.
* gdbtk/generic/gdbtk-bp.c (get_point_list): new function.
(gdb_get_breakpoint_info): do not return user_specification.
(gdb_get_breakpoint_list): use get_point_list.
(breakpoint_notify): suppress get_tracepoint call since it should
always fail if get_breakpoint does.
Dispatch by point type to check it and build tcl command.
(gdb_get_tracepoint_info): return condition.
(gdb_get_tracepoint_list): use get_point_list.
* gdbtk/library/bpwin.itb (BpWin::bp_store): do not handle user_spec.
(BpWin::bp_type): likewise.
(BpWin::get_actions): adjust to gdb_get_tracepoint_info additional list value.
* gdbtk/library/gdbevent.ith, gdbtk/library/gdbevent.itb:
(BreakpointEvent): no more user_specification.
(TracepointEvent): implement condition.
* gdbtk/library/session.tcl (Session::_serialize_bps): handle breakpoints
only and drop user_specification.
* gdbtk/library/srctextwin.itb (SrcTextWin::showBPBalloon): drop
user_specification.
(SrcTextWin::showTPBalloon): lassign tracepoint condition.
* gdbtk/library/tracedlg.tcl (TraceDlg::build_win): comment new
get_get_tracepoint_info condition list item.
* gdbtk/library/util.tcl (bp_exists): drop user_specification.
Patrick Monnerat [Sun, 24 Jun 2018 09:14:34 +0000 (11:14 +0200)]
Watch: Automatic gdb variable clean-up.
Also supports specifying the frame context for an expression, external
selection and checking if a variable is watched.
The overall is handled by a new WatchTree subclass of VarTree.
* gdbtk/library/vartree.ith (VarTree::rootlist): protected.
(VarTree::setselection): public.
* gdbtk/library/watch.tcl (WatchTree): new class.
(WatchTree::add): new overloaded method.
(WatchTree::remove): new overloaded method.
(WatchTree::in_tree): new method.
(WatchWin::no_inferior): Delegate variable removal to tree methods.
(WatchWin::build_win): tree is a WatchTree.
(WatchWin::destructor): explicitly delete tree.
(WatchWin::remove): delegate removal to tree.
parameter.
(WatchWin::select): new method.
(WatchWin::watched): new method.
(WatchWin::add): delegate addition to tree. Supports an optional frame
(WatchWin::Watched): removed.
Patrick Monnerat [Tue, 12 Jun 2018 14:24:07 +0000 (16:24 +0200)]
Replace most dynamic allocations by STL objects.
This saves the need to explicitly deallocate storage when no longer used.
* gdbtk/generic/gdbtk-bp.c (breakpoint_notify): buf is now an std::string.
(tracepoint_exists): file is now an std::string. Catch allocation errors.
* gdbtk/generic/gdbtk-cmds.c (listfiles_info): keep files in a std::vector.
pathname is now a std::string. New method addfile ().
(do_listfiles): Use updated listfiles_info structure.
(gdb_listfiles): Variables files, file_size; numfiles and len deleted.
Use updated listfiles_info structure. Use std::sort rather than qsort.
(comp_files): deleted.
(gdb_search): files is now a std::vector. Catch allocation errors.
(gdbtk_load_asm): buffer is now a std::string.
(gdb_update_mem): mbuf is now a std::vector.
(gdbtk_set_result): buf is now a std::string.
* gdbtk/generic/gdbtk-register.c (gdbtk_reg_buffer): m_format and m_types are
now of type std::vector. Destructor deleted.
(get_register_types): buff deleted.
* gdbtk/generic/gdbtk.c (gdbtk_init): variable s deleted. Use string_printf
instad of xstrprintf.
(tk_command): result is now a std::string. Remove unneeded cleanup chain
handling.
(view_command): script is now a std::string. Remove unneeded cleanup chain
handling.
Patrick Monnerat [Thu, 10 May 2018 10:59:27 +0000 (12:59 +0200)]
Upgrade submodule, sync code.
* gdbtk/generic/gdbtk-bp.c (get_breakpoint_commands): use body_list_0.get() and
body_list_1.get() instead of body_list[0] and body_list[1].
body_count does not exist anymore: check instead body_list_1 being null.
(gdb_actions_command): replace type command_line_up by counted_command_line.
Pass a lambda function to read_command_lines_1 instead of removed
check_tracepoint_command function.
(gdb_get_action_list): use body_list_0 instead of body_list[0].
* gdbtk/generic/gdbtk-cmds.c (gdb_clear_file): use exec_close () instead of
exec_file_clear ().
(gdb_stop): do not check to_stop in non null, since this is now handled by
virtual methods.
(gdb_entry_point): use *target_stack instead of current_target.
(gdb_update_mem): likewise.
* gdbtk/generic/gdbtk.c (gdb_interactive): use *target_stack instead of
current_target.
(target_is_native): use method shortname () instead of member to_shortname.
Patrick Monnerat [Fri, 23 Mar 2018 02:37:40 +0000 (03:37 +0100)]
Upgate submodule, sync patch and code accordingly.
Gdb replaced the C observers by C++ objects. Adapt insight code to these.
* gdbtk/generic/gdbtk-bp.c: observer.h not used. Remove inclusion.
* gdbtk/generic/gdbtk-hooks.c: include observable.h.
(gdbtk_add_hooks): use C++ observers.
Patrick Monnerat [Fri, 16 Mar 2018 13:10:59 +0000 (14:10 +0100)]
gdbtk-register: use a gdb reg_buffer subclass for register storage
gdbtk_reg_buffer class extends reg_buffer to handle register change
detection and hold type/format storage.
* gdbtk/generic/gdbtk-register.c (gdbtk_reg_buffer): new subclass.
(old_regs, old_regs_count, regformat, regtype): replaced by a pointer to a
gdbtk_reg_buffer instance (registers).
(get_register): Use class instance.
(register_changed_p): Check register change using class method.
(setup_architecture_data): Allocate/free class instance.
(gdb_regformat): Use class instance.
Change set/show remotebaud commands to set/show serial baud.
The "remotebaud" subcommands have been removed from gdb and replaced by
"serial baud".
* gdbtk/library/interface.tcl (proc_set_baud): Use "set serial baud".
* gdbtk/library/targetselection.itb (TargetSelection::build_win): Use
"show serial baud".
(TargetSelection::change_baud): Use "set serial baud" and "show serial baud".
(TargetSelection::cancel): Use "set serial baud".
Replaces gdb_do_one_event expration parameter by a millisecond timeout
parameter.
Ignore notifier timer: tcl event rescheduling is handled explicitly.
Use thread storage for notifier state.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_call_command): call gdb_do_one_event
with an infinite timeout.
* gdbtk/generic/gdbtk.c: gdbtk_notifier_data state storage no longer static.
New notifier state structure type gdbtk_notifier_state.
(notifier_state): new procedure to get notifier state storage pointer.
(gdbtk_notifier_defer): new procedure to defer tcl redispatching.
(gdbtk_notifier_reschedule_tcl): use gdbtk_notifier_defer.
(gdbtk_notifier_schedule_proc): use gdbtk_notifier_defer. Use bit flags.
(gdbtk_notifier_get_file_data): use notifier state thread storage.
(gdbtk_notifier_timeout): deleted.
(gdbtk_notifier_set_timer): do nothing.
(gdbtk_notifier_wait_for_event): call gdb_do_one_event with a timeout.
(gdbtk_notifier_create_file_handler): use notifier state thread storage.
(gdbtk_notifier_initialize): Initialize scheduler async event.
(gdbtk_notifier_finalize): Release notifier state sub storage and clear
state.
(gdbtk_notifier_service_mode_hook): use notifier state thread storage.
(gdbtk_install_notifier): Remove tcl scheduler async event initialisation:
this is now done in gdbtk_notifier_initialize.
(gdbtk_uninstall_notifier): Remove notifier state cleanup: now done in
gdbtk_notifier_finalize.
* patches/binutils-gdb/005-gdb_do_one_event-add-an-expiration-parameter.patch:
deleted.
* patches/binutils-gdb/005-gdb_do_one_event-add-timeout-parameter.patch:
new patch.
* patches/binutils-gdb/006-add_file_handler_with_mode.patch: rebased.
This merges patches 006-add_file_handler-implement-a-mask-parameter.patch and
007-Avoid-creating-a-file-handler-for-a-negative-fd.patch into a simplified
006-add_file_handler_with_mode.patch implementing this new function.
* gdbtk/generic/gdbtk.c (gdbtk_notifier_create_file_handler): call
add_file_handler_with_mode instead of add_file_handler.
Patrick Monnerat [Sat, 25 Nov 2017 00:25:53 +0000 (01:25 +0100)]
Upgrade submodule, sync patch and code, reorder functions, drop value_ptr.
* gdbtk/generic/gdbtk-cmds.c (gdb_eval): drop value_ptr type, remove unused
variable dummy.
(gdb_update_mem); remove unused variable dummy.
* gdbtk/generic/gdbtk-varobj.c (variable_delete_tcl): children field is
now a std::vector.
(variable_children): varobj_list_children() now returns a std::vector&.
(variable_update): use a std::vector& as GDB_varobj_update() argument.
* gdbtk/generic/gdbtk-wrapper.[ch]: drop value_ptr_type, reorder functions
alphabetically, remove redundant prototypes.
(GDB_varobj_update): argument `changes' is now a std::vector& to accomodate
varobj_update() new result type.
Patrick Monnerat [Thu, 21 Sep 2017 12:28:16 +0000 (13:28 +0100)]
Delete all gdb breakpoint with a private API
* gdbtk/generic/gdbtk-bp.c (gdbtk_delete_all_breakpoints): new function.
* gdbtk/generic/gdbtk-cmds.c (gdb_clear_file): Use
gdbtk_delete_all_breakpoints() instead of delete_command().