Access to the source line information has been moved from struct symtab
to source cache. Adapt code to this new situation.
* gdbtk/generic/gdbtk-cmds.c (gdbtk_load_source): Get line offsets from
source cache. Use normal open_source_file() since there are no offsets
loading anymore at this stage.
Patrick Monnerat [Fri, 12 Jul 2019 09:52:32 +0000 (11:52 +0200)]
Upgrade submodule, sync patches and code.
* gdbtk/generic/gdbtk-bp.c (get_point_list): first arg is now a bool function.
* gdbtk/generic/gdbtk-cmds.c: change resolution of STRINGIFY macro conflict.
* gdbtk/generic/gdbtk-hooks.c: likewise.
* gdbtk/generic/gdbtk.c: likewise.
gdb/common has been renamed: include version.h from gdb/gdbsupport.
Patrick Monnerat [Sun, 16 Jun 2019 04:01:43 +0000 (06:01 +0200)]
Upgrade submodule, sync patches and code.
* configure.ac: binutils-gdb/gdb/gnulib has moved up one level, so regenerate
at its new location.
* gdbtk/generic/gdbtk-cmds.c (gdbtk_load_source): find_source_lines() is not
exported anymore, but open_source_file_with_line_charpos() does it for you:
use the later instead of open_source_file().
Patrick Monnerat [Thu, 11 Apr 2019 15:34:08 +0000 (17:34 +0200)]
Upgrade submodule, sync patch and code.
The internal gdb exception TRY/CATCH support has been replaced by
C++ exceptions: adapt the code to this new situation.
* gdbtk/generic/gdbtk-bp.c (gdb_set_bp): use try/catch.
* gdbtk/generic/gdbtk-cmds.c (gdbtk_call_wrapper): use try/catch.
(gdbtk_load_asm): use try/catch/throw.
(gdb_loadfile): use try/catch.
* gdbtk/generic/gdbtk-varobj.c (variable_value): use try/catch.
(variable_print): use try/catch.
* gdbtk/generic/gdbtk-wrapper.c (GDBTK_CATCH_ERRORS): use try/catch.
* gdbtk/generic/gdbtk.c (gdbtk_source_start_file): use throw_error().
Function make_cleanup() has been removed: do not use it anymore. Instead,
use try/catch blocks and object destructors.
Move the global tcl interpreter pointer into the gdbtk_interp class. New
function gdbtk_get_interp() returns the current gdb interpreter, throwing
an exception if it is not a gdbtk_interp.
New header file gdbtk_interp.h holds the specific gdb interpreter's definitions.
* gdbtk/generic/gdbtk-bp.c (breakpoint_notify): get tcl interpreter from
gdbtk interpreter object.
* gdbtk/generic/gdbtk-cmds.c (Gdbtk_Init): use tcl interpreter parameter.
(gdbtk_load_asm): restore result pointer using a try/catch block.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_two_elem_cmd, gdbtk_file::read,
gdbtk_getpid, report_error, gdbtk_ignorable_warning, gdbtk_register_changed,
gdbtk_memory_changed, x_event, gdbtk_readline, gdbtk_readline_end,
gdbtk_call_command, gdbtk_param_changed, gdbtk_load_hash,
gdbtk_post_add_symbol, gdbtk_query, gdbtk_trace_find, gdbtk_trace_start_stop,
gdbtk_annotate_signal, gdbtk_attach, gdbtk_detach,
gdbtk_architecture_changed): get tcl interpreter from current gdbtk
interpreter.
* gdbtk/generic/gdbtk-interp.c: Move class and global definitions to new
header file.
(gdbtk_interp::gdbtk_interp): New constructor.
(gdbtk_interp::~gdbtk_interp): New destructor.
(gdbtk_interp::init): Call gdbtk_init() with parameter.
(gdbtk_interp::resume): Call gdbtk_source_start_file() with parameter.
(gdbtk_interp::pre_command_loop): Use tcl interpreter from object.
(gdbtk_get_interp): New function.
* gdbtk/generic/gdbtk-register.c (get_register_size, get_register_collectable,
get_register_types): get tcl interpreter from current gdbtk interpreter.
* gdbtk/generic/gdbtk.c (TclDebug, gdbtk_cleanup, tk_command, view_command):
Use tcl interpreter from current gdbtk interpreter.
(gdbtk_uninstall_notifier): not static anymore.
(cleanup_init): Deleted since the tcl interpreter is deleted in the
gdbtk interpreter destructor.
(gdbtk_init): store the tcl interpreter in the gdbtk interpreter. Drop
cleanup chain.
(gdbtk_source_start_file): use tcl interpreter from new parameter.
* gdbtk/generic/gdbtk.h (gdbtk_tcl_interp): Deleted.
(gdbtk_init, gdbtk_source_start_file): New parameter gdbtk_interp *.
(gdbtk_uninstall_notifier): extern.
* gdbtk/generic/gdbtk-interp.h: New header file.
Upgrade submodule, sync patches and create a new one.
Recent changes to gdb/Makefile break gdbtk compilation: the solution is
to keep gdbtk object files in their sources directory.
New patch gdbtk-obj-in-subdir implements this strategy.
Patrick Monnerat [Sat, 10 Nov 2018 01:34:52 +0000 (02:34 +0100)]
Upgrade submodule, sync code.
* gdbtk/generic/gdbtk-cmds.c (gdbtk_load_source): open_source_file now
returns a scoped_fd: get the file descriptor and release scoped_fd.
(symtab_to_filename): let scoped_fd be closed automatically.
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.