Upgrade submodule, update code accordingly.
The gdb procedure varobj_delete() has dropped the "returned variable list"
feature, thus we can no longer use it to remove our tcl alias variables.
A new procedure variable_delete_tcl() is thus implemented to perform this
task before removing the gdb variable.
* gdbtk/generic/gdbtk_varobj.c: new procedure variable_delete_tcl().
(variable_delete): remove tcl alias variable using variable_delete_tcl().
Set running state in text window even if tracing features are enabled.
Failure to do so can segfault at rerun because the balloon variable may still
contain a dangling pointer to an item from the previous run.
Allow run commands to complete before target stops.
Latest gdb versions run command handlers return before the target stops,
even in synchronous mode. Insight must therefore monitor gdb events until
the target stops running.
* gdbtk/generic/gdbtk-hooks.c: include event-loop.h.
(gdbtk_call_command): Monitor gdb events after run command execution until
the inferior ptid has stopped or disappeared.
Patrick Monnerat [Wed, 26 Aug 2015 11:10:37 +0000 (13:10 +0200)]
plugins: unbundle tcl and adjust to latest cygwin.
* gdbtk/plugins/Make-rules: Use Tcl private include C flags from autotools
for Windows.
* gdbtk/plugins/rhabout/rhabout.c: Use __declspec(dllexport) for all
Windows builds.
(DllMain): Define for all native Windows builds. Remember Cygwin is not
a native Windows environment anymore.
Patrick Monnerat [Mon, 24 Aug 2015 16:44:02 +0000 (18:44 +0200)]
Action dialog: accept while-stepping without data collect.
Upgrade submodule.
* gdbtk/library/tracedlg.tcl (TraceDlg::get_actions): Preset empty data in
case scan does not set it.
(TraceDlg::edit): Preset empty data in case scan does not set it.
Set Editing option when creating an action dialog.
(gdb_add_tracepoint): Accept empty action for while-stepping.
(gdb_edit_tracepoint): Likewise.
* gdbtk/library/actiondlg.tcl: New option Editing.
(ActionDlg::ok): Check validity of step count for while-stepping.
Accept no data collection in while-stepping.
Rely on Editing option rather than data presence to determine add or modify
command to use.
Patrick Monnerat [Sat, 22 Aug 2015 11:58:01 +0000 (13:58 +0200)]
Action dialog: refine "change other".
* gdbtk/library/actiondlg.tcl (ActionDlg::change_other): Trim entry first.
Use regular expressions to match special tag names with multiple spaces.
Check if we are adding or deleting before any semantic check: this allows to
locally link to lists rather than copying them in and out, and simplifies
later processing.
Trim $ on the left only to check for a register name.
Patrick Monnerat [Sat, 22 Aug 2015 10:08:08 +0000 (12:08 +0200)]
Action dialog: fix "Collect Stack" processing.
* gdbtk/library/actiondlg.tcl (ActionDlg::change): Use lassign where possible.
Link to Collect and Variables rather than copying them in an out locally.
Use modified prototypes for procedures all_locals, all_regs and all_args.
Process the "Collect Stack" action specifically.
(ActionDlg::all_args): Arguments are listnamedel listnameadd.
Work directly on named arguments rather than copying in and returning a value.
(ActionDlg::all_locals): Likewise.
(ActionDlg::all_regs): Likewise.
(ActionDlg::change_other): Map expressions representing special tags to
the tag itself.
Compute add/del flag and copy in lists before checking the tag name.
Use new prototypes for procedures all_locals, all_regs and all_args.
Process "Collect Stack" properly.
Patrick Monnerat [Sat, 22 Aug 2015 09:27:20 +0000 (11:27 +0200)]
Consider C function arguments as such, not as local variables.
C function arguments do not have an argument class, but are regular local
variables flagged as being an argument. Check this flag in addition to
the symbol class.
* gdbtk/generic/gdbtk-stack.c (gdb_get_vars_command): Symbols with a
LOC_LOCAL, LOC_STATIC, LOC_REGISTER or LOC_COMPUTED class are arguments
if they are flagged as such.
Patrick Monnerat [Thu, 20 Aug 2015 15:35:58 +0000 (17:35 +0200)]
Actions dialog: do not propose expressions that cannot be collected.
This filters out uncollectable pseudo-registers and builds the stack collection
expression at run time.
* gdbtk/generic/gdbtk-register.c (get_register_collectable): New procedure:
lists whether a register is collectable or not.
(gdb_regspecial): New procedure: lists the register number of special
registers.
(gdb_register_info): New options "collectable" and "special".
* gdbtk/library/actiondlg.tcl (class ActionDlg): Do not preset StackCollect.
Define protected field StackPointer.
(ActionDlg::constructor): Filter out non-collectable registers.
Compute stack collection expression from current architecture's stack pointer.
Do not propose "All registers" if none exists.
Do not propose "Collect Stack" if the stack pointer is not collectable.
(ActionDlg::change_other): Fix a cut+pasted comment.
Patrick Monnerat [Wed, 19 Aug 2015 16:15:36 +0000 (18:15 +0200)]
Emulate trace start/stop hook.
This deprecated hook still exisits in gdb, but is not called anymore.
The optimal solution would be to have it replaced by an observer.
In the meantime, we check for a trace status change at each run/trace command
execution and eventually call the hook procedure explicitely.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_add_hooks): Do not set the
deprecated_trace_start_stop_hook anymore.
(gdbtk_call_command): When a run/trace class command is executed, save the
trace running status before command and, if changed after command terminates,
call the hook procedure accordingly.
Patrick Monnerat [Wed, 19 Aug 2015 13:35:21 +0000 (15:35 +0200)]
Implement disabled tracepoint support.
* gdbtk/library/srctextwin.ith (class SrcTextWin): Add new type disabled_tp.
Fix a typo in comment.
* gdbtk/library/srctextwin.itb (SrcTextWin::constructor): Initialize
break_image for disabled_tp.
(SrcTextWin::build_popups): Initialize popups for disabled_tp.
Add Enable/Disable Tracepoint menu entries.
(SrcTextWin::enable_disable_src_tags): Bind <Enter>/<Motion>/<Leave> events of
disabled_tp_tag.
(SrcTextWin::config_win): Configure disabled_tp_tag.
Bind <Button-1> and <Button-3> event of disable_bp_tag.
(SrcTextWin::removeBreakTag): Match also disabled_tp tags.
(SrcTextWin::hasTP): Likewise.
(SrcTextWin::showTPBalloon): Determine tracepoint type.
Patrick Monnerat [Tue, 18 Aug 2015 17:43:49 +0000 (19:43 +0200)]
Implement tracepoint balloons.
* gdbtk/library/srctextwin.ith (SrcTextWin::showTPBalloon): New method.
* gdbtk/library/srctextwin.itb (SrcTextWin::showTPBalloon): New method.
(SrcTextWin::enable_disable_src_tags): Preset motion for tracepoints.
(SrcTextWin::motion): Check tracepoint type in addition to breakpoint and
variables.
Patrick Monnerat [Tue, 18 Aug 2015 14:28:44 +0000 (16:28 +0200)]
Enable tracepoint creation events.
* gdbtk/generic/gdbtk-bp.c (BREAKPOINT_IS_INTERESTING): Tracepoints are
interesting! This enables observer routing to Tcl events for tracepoints.
* gdbtk/library/bpwin.itb (BpWin::breakpoint): Ignore event if this is a
tracepoint window.
(BpWin::tracepoint): Ignore event if this is a breakpoint window.
Patrick Monnerat [Tue, 18 Aug 2015 12:23:36 +0000 (14:23 +0200)]
TraceDlg: replace WhileStepping flag by a presence test method.
This effectively allows deleting the while-stepping action and recreate a
new one.
* gdbtk/library/tracedlg.tcl: Delete obsolete WhileStepping flag.
(has_while_stepping): New method.
(add_action): Test duplicate while-stepping using method instead of flag.
(add_action_to_list): Do not set obsolete WhileStepping flag.
Patrick Monnerat [Tue, 18 Aug 2015 12:00:44 +0000 (14:00 +0200)]
Trace dialog: be more selective on action regular expressions.
Only allow the command word to appear at the beginning of the command: this
will avoid positive patches on variable names, such as understanding
"collect endOfFile" as and "end" command.
Patrick Monnerat [Mon, 17 Aug 2015 23:26:05 +0000 (00:26 +0100)]
Get tracepoint action subcommands too.
The while-stepping action may have collect subcommands: include them in
tracepoint info.
* gdbtk/generic/gdbtk-bp.c (gdb_get_action_list): New recursive procedure.
(gdb_get_tracepoint_info): Use gdb_get_action_list to recursively list
commands.
* gdbtk/library/tracedlg.tcl (add_all_actions): Process multiple while-stepping
subcommands.
(edit): Pass option -Data value as a list (to accept multiple expressions).
Patrick Monnerat [Sun, 16 Aug 2015 16:47:06 +0000 (17:47 +0100)]
Implement a subclass for the tracepoint window.
This prevents the confusion between the breakpont and the tracepoint windows.
It allows to have both open at the same time.
* gdbtk/library/managedwin.itb (ManagedWin::_open): Do not match an object
with a class if it's not the top class.
* gdbtk/library/srcbar.itcl (create_view_menu): Direct the tracepoints menu
entry to open a Tpwin tracepoint window.
Remove redundant "-tracepoints 0" on the breakpoints menu entry.
(create_window_buttons): The Tracepoints button opens a TpWin, not a Bpwin.
* gdbtk/library/srctextwin.itb (SrcTextWin::do_key): Key "tracepoints" opens
a TpWin, not a BpWin.
* gdbtk/library/tpwin.itcl: New file. Defines the TpWin subclass of BpWin.
* gdbtk/library/tclIndex: Defines the TpWin related indexes.
Patrick Monnerat [Sun, 16 Aug 2015 13:08:20 +0000 (14:08 +0100)]
Avoid accessing non-existing event "disposition" on a tracepoint.
* gdbtk/library/bpwin.itb (BpWin::bp_add): Get disposition event only for
breakpoints. Fix a typo.
(BpWin::bp_modify): Get disposition event only for breakpoints.
Patrick Monnerat [Fri, 14 Aug 2015 18:30:25 +0000 (20:30 +0200)]
Make the "Set Tracepoint" dialog working.
This is achieved by accepting configure arguments in the Labelledframe
constructor and avoiding a null-pointer dereferencing when no action is
associated.
* gdbtk/generic/gdbtk-bp.c (gdb_actions_command): When no action is given,
parse commands from a zero-length string.
* libgui/library/lframe.tcl (constructor): Accept arguments and configure.
Patrick Monnerat [Fri, 14 Aug 2015 15:52:28 +0000 (17:52 +0200)]
Make trace find feature working again.
The trace frame find GUI feature was connected to the deprecated_trace_find_hook
that gdb still defines, but does not call anymore.
The same function is now achieved via a traceframe_changed observer.
* gdbtk/generic/gdbtk-hooks.c:
(gdbtk_trace_find): Change prototype to match the traceframe_changed observer.
Pass the new arguments to tcl/tk.
(gdbtk_add_hooks): Connect gdbtk_trace_find as an observer, not a hook.
* gdbtk/library/interface.tcl (gdbtk_tcl_trace_find_hook):
Use observer parameters.
* gdbtk/library/srcbar.itcl (handle_trace_find_hook): Use observer parameters.
* gdbtk/library/srctextwin.it[bh] (trace_find_hook): Use observer parameters.
Patrick Monnerat [Thu, 13 Aug 2015 13:04:59 +0000 (15:04 +0200)]
gdbtk: adapt to the new explicit locations API
* gdb/generic/gdbtk-bp.c: Include location.h.
(gdb_get_breakpoint_info): Use event_location_to_string instead of
`addr_string'.
(gdb_set_bp): Use string_to_event_location and pass this to
create_breakpoint instead of an address string.
(tracepoint_exists): Use string_to_event_location and pass this to
decode_line_1 instead of an address string.
* gdb/generic/gdbtk-cmds.c: Include location.h.
(gdb_get_line_command): Use string_to_event_location and pass this to
decode_line_1 instead of an address string.
(gdb_get_file_command): Likewise.
(gdb_get_function_command): Likewise.
* gdb/generic/gdbtk-stack.c: Include location.h.
(gdb_get_vars_command):Use string_to_event_location and pass this to
decode_line_1 instead of an address string.
Patrick Monnerat [Tue, 11 Aug 2015 14:30:54 +0000 (16:30 +0200)]
Tcl does not like defining an array item as a global variable.
Only the array name may be declared global.
* gdbtk/library/targetselection.itb (set_run): Comment out global declaration.
Patrick Monnerat [Tue, 11 Aug 2015 14:25:54 +0000 (16:25 +0200)]
Match allocator to destructor: bfd_openr --> gdb_bfd_openr.
This avoids a segmentation fault at cleanup time.
* gdbtk/generic/gdbtk-cmds.c (gdb_load_info): Use gdb_bfd_openr().
Upgrade submodule. Update gui code according to submodule change.
Replace (suppressed) deprecated_register_changed_hook by observer.
* generic/gdbtk-hooks.c (gdbtk_register_changed): Alter prototype for use as
an observer.
(gdbtk_add_hooks): Remove reference to deprecated_register_changed_hook. Use
observer_attach_register_changed() instead.
Upgrade submodule. Adapt sources according to submodule changes.
GDB suppressed the deprecated_selected_frame_level_changed_hook: the following
changes have been made to accomodate gdbtk to this new situation:
* gdbtk/generic/gdbtk-hooks.c (deprecated_selected_frame_level_changed_hook):
Remove assignment.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_selected_frame_changed): No longer used.
Remove.
* gdbtk/generic/gdbtk-stack.c (gdb_selected_frame_level): New Tcl function.
* gdbtk/library/stackwin.itb (StackWin::update): replace use of
gdb_selected_frame_level global variable by a call to gdb_selected_frame_level.