Patrick Monnerat [Sat, 15 Apr 2017 00:24:51 +0000 (01:24 +0100)]
Upgrade submodule, sync patch and code.
Several gdb function arguments and structure members are now unique pointer
types event_location_up and command_line_up instead of struct event_location *
and struct command_line * respectively.
Code changes in this commit adapt the insight-specfic code to this situation.
* gdbtk/generic/gdbtk-bp.c (gdb_get_breakpoint_info): convert breakpoint
location to a regular pointer.
(gdb_set_bp): use an event_location_up local variable.
No more cleanup needed.
(gdb_actions_command): use a command_line_up local variable.
(tracepoint_exists): use an event_location_up local variable.
No more cleanup needed.
* gdbtk/generic/gdbtk-cmds.c (gdb_get_line_command): likewise.
(gdb_get_file_command): likewise.
(gdb_get_function_command): likewise.
* gdbtk/generic/gdbtk-stack.c (gdb_get_vars_command): likewise.
Upgrade submodule, sync patch and code.
gdb makefiles now enforces ISO C++ that forbids to assign a string constant to
a non-const char pointer. All changes in this commit fixes those kind of
assignments.
* gdbtk/generic/gdbtk-bp.c (bptypes, bpdisp): change type to const char *[].
* gdbtk/generic/gdbtk-cmds.c (struct disassembly_client_data): change map_arr
type to const char *.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_readline_begin): change format argument
type to const char *.
(gdbtk_two_elem_cmd): change cmd_name argument type to const char *.
(gdbtk_pre_add_symbol): remove unneeded cast.
* gdbtk/generic/gdbtk-varobj.c (format_string): change type to const char *[].
* gdbtk/generic/gdbtk.c (TclDebug): change priority type to const char *.
(gdbtk_init): for non-CygWin code, change srcdir type to const char *.
(gdbtk_source_start_file): change s type to const char *.
* libgui/src/guitcl.h, libgui/src/paths.c (ide_initialize_paths): change
ide_appname argument type to const char *.
Code changes are motivated by:
- gdb struct interp is now a C++ class.
- ui_file is now a C++ class.
- memory ui_file is replaced by new class string_file.
* gdbtk/generic/gdbtk.h: gdbtk_interp renamed to gdbtk_ctl_interp.
(gdbtk_fputs), (gdbtk_fileopenin): deleted.
gdbtk_disable_fputs: renamed to gdbtk_disable_write, set to bool.
* gdbtk/generic/gdbtk-bp.c (breakpoint_notify): gdbtk_interp renamed.
* gdbtk/generic/gdbtk-cmds.c (gdbtk_restore_fputs):
renamed to gdbtk_restore_write.
(Gdbtk_init): gdbtk_restore_fputs and gdbtk_interp renamed.
(gdb_eval), (gdb_update_mem):
use stack-based string file. cleanup chain no longer needed.
* gdbtk/generic/gdbtk-hooks.c: gdbtk_in_fputs renamed.
Subclass gdbtk_file of ui_file to support console I/O.
(gdbtk_read): replaced by gdbtk_file::read.
(gdbtk_fputs): replaced by gdbtk_file::write.
(gdbtk_two_elem_cmd), (gdbtk_getpid), (report_error),
(gdbtk_ignorable_warning), (gdbtk_memory_change), (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): gdbtk_interp renamed.
(gdbtk_fileopenin): deleted.
(gdbtk_fileopen): use gdbtk_file subclass object.
(gdbtk_warning): use ui_file class object for gdb_stderr.
(x_event): in_fputs renamed. gdbtk_interp renamed.
(gdbtk_readline): gdbtk_interp renamed. Use gdb_stdout puts method.
* gdbtk/generic/gdbtk-interp.c: New subclass gdbtk_interp of interp.
Move struct gdbtk_interp_data fields to gdbtk_interp.
(gdbtk_interpreter_init): replaced by gdbtk_interp::init.
(gdbtk_interpreter_resume): replaced by gdbtk_interp::resume.
(gdbtk_interpreter_suspend): replaced by gdbtk_interp::suspend.
(gdbtk_interpreter_exec): replaced by gdbtk_interp::exec.
(gdbtk_supports_command_editing): deleted.
(gdbtk_pre_command_loop): replaced by gdbtk_interp::pre_command_loop.
gdbtk_interp renamed to gdbtk_tcl_interp.
(gdbtk_interpreter_ui_out): replaced by gdbtk_interp::interp_ui_out.
(gdbtk_interp_factory): use new interp class.
* gdbtk/generic/gdbtk-register.c (get_register_size),
(get_register_collectable), (get_register_types): gdbtk_interp renamed.
(get_register): gdbtk_interp renamed. Use stack-based memory file.
Drop obsolete cleanup chain.
* gdbtk/generic/gdbtk-varobj.c (variable_print): Use stack-based memory file.
* gdbtk/generic/gdbtk.c: gdbtk_interp renamed to gdbtk_tcl_interp.
gdbtk_disable_fputs replaced by gdbtk_disable_write.
(TclDebug), (cleanup_init), (gdbtk_cleanup), (tk_command), (view_command):
gdbtk_interp renamed.
)gdbtk_init): gdbtk_interp and gdbtk_disable_fputs renamed.
* gdbtk/library/interface.tcl (gdbtk_idle), (gdbtk_tcl_fputs):
gdb_restore_fputs renamed to gdb_restore_write.
Patrick Monnerat [Fri, 11 Nov 2016 15:28:24 +0000 (16:28 +0100)]
Upgrade submodule. Update patches and code accordingly.
Latest gdb changes introduce C++-only function types. Thus the current
insight code updates make it not compilable with C.
* gdbtk/generic/gdbtk-cmds.c (gdb_eval): expr is now an expression_up class
instance. New cleanup head is thus the memory file deletion.
* gdbtk/generic/gdbtk-register.c (get_register): Remove the obsolete second
parameter.
* gdbtk/generic/gdbtk-varobj.c (install_variable, uninstall_variable):
Set the variable name parameter as const.
(variable_obj_command): called procedure varobj_get_expression () now returns
a std::string.
(variable_delete_tcl): varobj_p member obj_name is now a std::string.
(variable_children): set childname as const.
(variable_type): varobj_get_type () now returns a std::string. Replace
tcl regexp processing by std::string methods call.
(variable_value): varobj_get_value () now returns a std::string.
* gdbtk/generic/gdbtk-wrapper.[ch] (GDB_val_print, wrap_val_print): no
longer used: deleted.
Patrick Monnerat [Sat, 30 Jul 2016 15:36:42 +0000 (16:36 +0100)]
Tcl 8.6 compatibility.
Version 8.6 of Tcl changes some procedure parameters to const. Hopefully,
a CONST86 macro is defined by Tcl for this purpose. Use it where necessary.
* gdbtk/generic/gdbtk.c: define CONST84 and CONST86 macros as empty by default.
(gdbtk_notifier_set_timer): define parameter with CONST86.
(gdbtk_notifier_wait_for_event): likewise.
(gdbtk_notifier_procs): cast initializers.
Patrick Monnerat [Wed, 29 Jun 2016 15:08:50 +0000 (17:08 +0200)]
Upgrade submodule. Modify patches and code accordingly.
The upgrade introduces a new interpreter API. The main loop is now under
gdb control.
The input stream handling has also changed: everything goes through a
struct ui. To support it, a new gdb patch has been introduced.
* patches/binutils-gdb/007-Avoid-creating-a-file-handler-for-a-negative-fd.patch
New patch.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_warning): add new parameter to
stderr_fileopen.
* gdbtk/generic/gdbtk-interp.c (gdbtk_command_loop): deleted.
(gdbtk_supports_command_editing): new dummy procedure.
(gdbtk_pre_command_loop): new procedure. Sets input fd to -1 to disable
gdb commands from standard input.
(gdbtk_interp_factory): new procedure.
(_initialize_gdbtk_interp): use new interpreter API.
Patrick Monnerat [Tue, 28 Jun 2016 15:48:59 +0000 (17:48 +0200)]
Insert Tcl event loop into gdb event loop. Use gdb event loop.
This is done via a new Tcl notifier and a gdb asynchronous event to call
Tcl_DoOneEvent when needed.
Gdb event handler needs some updates to support the Tcl notifier: they are
currently implemented by patches.
* patches/binutils-gdb/005-gdb_do_one_event-add-an-expiration-parameter.patch:
New patch.
* patches/binutils-gdb/006-add_file_handler-implement-a-mask-parameter.patch
New patch.
* gdbtk/generic/gdbtk.c (gdbtk_notifier_schedule_proc): New procedure.
(gdbtk_notifier_reschedule_tcl): New procedure.
(gdbtk_notifier_get_file_data): New procedure.
(gdbtk_notifier_file_handler_event_proc): New procedure.
(gdbtk_notifier_file_proc): New procedure.
(gdbtk_notifier_timeout): New procedure.
(gdbtk_notifier_set_timer): New procedure.
(gdbtk_notifier_wait_for_event): New procedure.
(gdbtk_notifier_delete_file_handler): New procedure.
(gdbtk_notifier_create_file_handler): New procedure.
(gdbtk_notifier_initialize): New procedure.
(gdbtk_notifier_finalize): New procedure.
(gdbtk_notifier_alert): New procedure.
(gdbtk_notifier_service_mode_hook): New procedure.
(gdbtk_install_notifier): New procedure.
(gdbtk_uninstall_notifier): New procedure.
(cleanup_init): Uninstall notifier.
(gdbtk_init): Install notifier.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_call_command): Add timeout parameter to
gdb_do_one_event.
* gdbtk/generic/gdbtk-interp.c (gdbtk_command_loop): Use gdb start_event_loop
instead of Tk_MainLoop.
Patrick Monnerat [Fri, 22 Apr 2016 13:13:13 +0000 (15:13 +0200)]
Adjust C code for C++ syntax compatibility.
Gdb will soon be compiled as C++ code, thus our source code must match
this requirement.
* gdbtk/generic/gdbtk-bp.c (Gdbtk_Breakpoint_Init): Explicit casts to
ClientData in Tcl_CreateObjCommand() calls.
(tracepoint_exists): Explicit cast xmalloc() result.
* gdbtk/generic/gdbtk-cmds.c (Gdbtk_Init): Explicit casts to ClientData in
Tcl_CreateObjCommand() calls.
(wrapped_call): Explicit cast to ClientData of first callback call argument.
(do_listfiles): Explicit cast for initial info assignment.
Explicit cast of xrealloc() result.
(gdb_search): `space' is an enum search_domain, not a domain_enum.
(gdb_loadfile): Explicit cast 2nd catch_errors() argument to void *.
(perror_with_name_wrapper): Explicit cast of perror_with_name() argument.
* gdbtk/generic/gdbtk-hooks.c (gdbtk_two_elem_cmd): Explicit cast of
malloc() result.
(gdbtk_ignorable_warning): Rename formal argument 'class', as it is a
C++ reserved word.
* gdbtk/generic/gdbtk-interp.c (gdbtk_interpreter_ui_out): Explicit cast
initializer value of `data'.
* gdbtk/generic/gdbtk-register.c (Gdbtk_Register_Init): Explicit casts to
ClientData in Tcl_CreateObjCommand() calls.
(setup_architecture_data): Explicit cast of xcalloc() result.
* gdbtk/generic/gdbtk-stack.c (Gdbtk_Stack_Init): Explicit casts to ClientData
in Tcl_CreateObjCommand() calls.
* gdbtk/generic/gdbtk-varobj.c (variable_create): Variable `how_specified' is
an enum varobj_type, not an int.
* gdbtk/generic/gdbtk-wrapper.c (GDB_varobj_update): Rename argument
`explicit', as this is a C++ reserved word.
Properly cast `*changes' assignment value.
(wrap_type_print): Explicit cast of varstring initializer.
(wrap_varobj_update): Rename variable `explicit', as this is a C++ reserved
word.
* gdbtk/generic/gdbtk-wrapper.h (GDB_varobj_update): Rename argument
`explicit', as this is a C++ reserved word.
* gdbtk/generic/gdbtk.c: Unconditionally declare external Tktable_Init() as C
procedure.
* gdbtk/generic/gdbtk.h: Do not (wrongly) redeclare ptid_t.
* libgui/src/tkTable.h: Allow inclusion from a C++ source.
* libgui/src/tkTableCmd.h: Likewise.
* libgui/src/tkTableInitScript.h: Likewise.
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.