Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: flightaware/TclProDebug
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: puremourning/TclProDebug
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Jan 12, 2019

  1. WIP: Debug adapter server for TclProDebug

    Ben Jackson committed Jan 12, 2019
    Copy the full SHA
    564461b View commit details
  2. HACK: debugging puts statements

    Ben Jackson committed Jan 12, 2019
    Copy the full SHA
    58f21ce View commit details

Commits on Jan 15, 2019

  1. WIP: Fix logging and stderr less

    Ben Jackson committed Jan 15, 2019
    Copy the full SHA
    ae3e31a View commit details
  2. Finish threads and stackTrace requests. Notifiy on stopped event. Thi…

    …s allows vimspector at least to get a stack and PC marker up for the simple test application
    Ben Jackson committed Jan 15, 2019
    Copy the full SHA
    b41644f View commit details

Commits on Jan 16, 2019

  1. Print the full error to the log

    Ben Jackson committed Jan 16, 2019
    Copy the full SHA
    e3f457b View commit details
  2. Copy the full SHA
    846255a View commit details

Commits on Jan 17, 2019

  1. LIne breakpoints work

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    3c15c63 View commit details
  2. For hover, use 'set <expr>' to get the value

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    1a7a6d6 View commit details
  3. Add continue request and exit/terminate events

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    99b62a9 View commit details
  4. Change product name

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    5287aa1 View commit details
  5. Fix stupid in pkgIndedx

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    5b151f1 View commit details
  6. When an error is trapped allow to suppress it with StepOUt (FIXME: th…

    …is is dumb, but what other options are there?
    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    8e91fe2 View commit details
  7. Update README

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    45934ca View commit details
  8. Update license

    Ben Jackson committed Jan 17, 2019
    Copy the full SHA
    31ff601 View commit details

Commits on Feb 28, 2019

  1. Add tcllib

    Ben Jackson committed Feb 28, 2019
    Copy the full SHA
    d5aa47c View commit details
  2. Allow multiple watches to work; queue the requests

    Ben Jackson committed Feb 28, 2019
    Copy the full SHA
    2d23c14 View commit details
  3. Handle errors without crashing

    Ben Jackson committed Feb 28, 2019
    Copy the full SHA
    24915e9 View commit details
  4. Copy the full SHA
    3184f22 View commit details
  5. Put the stack the right way up

    Ben Jackson committed Feb 28, 2019
    Copy the full SHA
    1c8cb17 View commit details
  6. Support remote debugging via attach request; flip the way sockets are…

    … used by the normal remote debug, so that you can start the app and it waits for the debugger to connect, rather than the other way round
    Ben Jackson committed Feb 28, 2019
    Copy the full SHA
    ce83b39 View commit details

Commits on Apr 23, 2019

  1. Retab some files

    Ben Jackson committed Apr 23, 2019
    Copy the full SHA
    295c6a6 View commit details
  2. Acutally use the env var for debug port

    Ben Jackson committed Apr 23, 2019
    Copy the full SHA
    3860573 View commit details
  3. Map remote filenames to local for remote debugging.

    Store the launch arguments for later use
    Improve remote debugging by allowing regex file name mappings in a
    'tolocal' block in the launch arguments:
    
      "tolocal": [ { "<exp>": "<subSpec>", ... }, ... ]
    
    The arguments 'exp' and 'subSpec' are as supplied to TCL's regsub
    command and named accordingly. The format of 'tolocal' is a list of
    objects whose .  The keys of the objects are regular expressions ('exp')
    and the values are the replacements ('subSpec'). The first mapping which
    matches is used. The expressions are evaluated in the sequence they
    appear in the list. Note that values within an object are not sequenced,
    but allowed to make reading/writing simpler where the expressions are
    not sequence dependent.
    
    Example from vimspector:
    
        "t: {
            "adapter": "tclpro",
            "remote-request": "launch",
            "remote-cmdLine": [ "run-test", "testing" ],
            "configuration": {
                "request": "attach",
                "pauseOnEntry": true,
                "host": "${host}",
                "port": "${port}",
                "tolocal": [
                    {
                        "^.*/runtime/(testing|overlay)/(tcl|scripts)/testing_(.*)":
                            "${workspaceRoot}/src/\\2/\\3",
                        "^.*/runtime/(test-test-test|overlay)/(tcl|scripts)/test-test-test_(.*)":
                            "${workspaceRoot}/src/TEST/\\2/\\3"
                    },
                    {
                        "^.*/runtime/dependency/": "/path/to/dependency/",
                    }
                ]
            }
        }
    Ben Jackson committed Apr 23, 2019
    Copy the full SHA
    6cf6b81 View commit details
  4. Don't attempt to speak to the GUI directly in the debugger when movin…

    …g breakpoints
    Ben Jackson committed Apr 23, 2019
    Copy the full SHA
    f5c56b7 View commit details

Commits on Nov 14, 2019

  1. Copy the full SHA
    9d5c956 View commit details
  2. Debugging is on by default

    Ben Jackson committed Nov 14, 2019
    Copy the full SHA
    3070a6d View commit details

Commits on Jan 9, 2020

  1. Retry connection when remote debugging

    Ben Jackson committed Jan 9, 2020
    Copy the full SHA
    ab3e5b3 View commit details

Commits on Jan 27, 2020

  1. Add some debugging to the remove launcher

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    abf2c07 View commit details
  2. Remove spammy debugging

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    1290748 View commit details
  3. Add brief spec for launch config

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    11cf10b View commit details
  4. Fix handling of instrumentation errors

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    91b3e2e View commit details
  5. Copy the full SHA
    ff208eb View commit details
  6. Fix step-in to actually step, rather than continue

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    7ea35c0 View commit details
  7. Fix nub crash when using return -code X Y

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    a34f0ce View commit details
  8. Note that we ignore client configuration (sorry) about line numbers a…

    …nd path
    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    028147d View commit details
  9. Include the TCL level in the stack trace

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    7d5c2b4 View commit details
  10. Add ability to load extensions from DAP

    Ben Jackson committed Jan 27, 2020
    Copy the full SHA
    08d5d77 View commit details

Commits on Feb 4, 2020

  1. Don't debug by default

    Ben Jackson committed Feb 4, 2020
    Copy the full SHA
    2af0571 View commit details
  2. Improve stack trace and scopes: Show the TCL level in stack trace, an…

    …d only show TCL levels in scopes. Skip uplevel frames and use the latest frame for a given scope as this is what TCL will actually use
    Ben Jackson committed Feb 4, 2020
    Copy the full SHA
    a060537 View commit details
  3. Provide the ability for plugins to disable instrumentation for certai…

    …n procs. This makes debugging 'infrastructure' or 'plumbing' procs much more intuitive
    Ben Jackson committed Feb 4, 2020
    Copy the full SHA
    432be12 View commit details
  4. Support runInTerminal for local debugging

    Ben Jackson committed Feb 4, 2020
    Copy the full SHA
    3a51e5b View commit details

Commits on Feb 6, 2020

  1. Fix regression: proc parsing without testKit extension

    Ben Jackson committed Feb 6, 2020
    Copy the full SHA
    0d6bee1 View commit details
  2. Create vscode extention

    Ben Jackson committed Feb 6, 2020
    Copy the full SHA
    383ea71 View commit details
  3. extension readme

    Ben Jackson committed Feb 6, 2020
    Copy the full SHA
    d0c2bd7 View commit details

Commits on Feb 16, 2020

  1. Fixed typo

    D4D3VD4V3 authored Feb 16, 2020
    Copy the full SHA
    0fdada2 View commit details
  2. Merge pull request #1 from D4D3VD4V3/patch-1

    Fixed typo
    puremourning authored Feb 16, 2020
    Copy the full SHA
    5249f0a View commit details

Commits on Apr 27, 2020

  1. Support conditional line breakpoints

    Ben Jackson committed Apr 27, 2020
    Copy the full SHA
    050c272 View commit details

Commits on May 11, 2020

  1. Expand the current stack frame in variables

    Ben Jackson committed May 11, 2020
    Copy the full SHA
    f13c42e View commit details

Commits on Sep 23, 2020

  1. Print message when listen fails

    Ben Jackson committed Sep 23, 2020
    Copy the full SHA
    67de1c3 View commit details
  2. Use log levels (part one)

    Ben Jackson committed Sep 23, 2020
    Copy the full SHA
    6086dc9 View commit details
Showing 721 changed files with 342,956 additions and 3,985 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
lib/tclparser/config.status
lib/tclparser/config.log
lib/tclparser/Makefile
lib/tclparser/libtclparser*.so
lib/tclparser/pkgIndex.tcl
lib/tclparser/*.o
34 changes: 34 additions & 0 deletions .vimspector.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
"adapters": {
"this-tclpro": {
"variables": {
"tclpro": "${workspaceRoot}"
},
"name": "tclpro",
"command": [
"tclsh",
"${tclpro}/bin/debugadapter",
"-verbose"
],
"configuration": {
"extensionDirs": [
"${workspaceRoot}/.tclpro"
]
}
}
},
"configurations": {
"Debug current script with this tclpro": {
"adapter": "this-tclpro",
"autoselect": false,
"configuration": {
"request": "launch",
"tclsh": "tclsh",
"args": [ "*${args}" ],
"target": "${file}",
"cwd": "${fileDirname}"
}
}
}
}
35 changes: 0 additions & 35 deletions README

This file was deleted.

97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
The TclPro Debugger version 3.0 is an upgrade of of the debugger included in the
TclPro product version 1.5 released and open-sourced by Scriptics Corporation.

Notably, this fork of TclProDebug provides a [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/)
implementation allowing it to be used by any client implementing that protocol,
including:

- [Vimspector](https://github.com/puremourning/vimspector)
- Visual Studio Code

Note: It's only tested with Vimspector.

## Install

To install: You will need to install the extension in lib/tclparser to add the
parse command to Tcl.

cd lib/tclparser && autoreconf && ./configure && make install

## Debug Adapter

To use the debug adapter with vimspector, use the following example
`.vimspector.json`:

```json
{
"adapters": {
"tclpro": {
"name": "tclpro",
"command": [
"$HOME/path/to/TclProDebug/bin/debugadapter"
]
}
},
"configurations": {
"launch": {
"adapter": "tclpro",
"configuration": {
"request": "launch",
"tclsh": "/usr/bin/wish",
"cwd": "${workspaceRoot}",
"target": "${workspaceRoot}/main.tcl",
"args": [ "this", "is", "a", "test" ]
}
}
}
}
```

Notes:

* Debug adapter is highly experimental and probably very very buggy.
* Debugger breaks on `error`. Use "Step Out" command to suppress an error when
it is trapped by the debugger. Then use "Step Over" or "Step In" to continue.
To deliver the error, just use "Stop Over" or "Step In" and the application
will terminate.
* pass `-debug` to `debugserver` to trace a lot of spam to `stderr`
* only stdout/stdin DAP supported (no sockets)
* `attach` request not supported
* `tclsh` may be a tclsh or a wish (or possibly an `expect`)
* `target` is the script to launch
* `cwd` is the working directory to launch the script in
* `args` is list of command line arguments
* All launch options are mandatory but `args` may be an empty list.

## GUI

To run the standalone GUI: execute the file bin/prodebug

The Help menu item on the Debugger's menu bar has an option to open the TclPro
user's guide, which will appear as a PDF file in the user's default browser.
The information in the chapter on the Debugger is still valid.

## Changes since TclPro

The debugger code has been upgraded to function with up-to-date releases of
Tcl/Tk (i.e., versions 8.5, 8.6):


* Tk GUI code upgraded to work with current Tk API.

* Upgraded OS interaction code to work with current operating system releases.

* Instrumentation code added to accomodate the expand operator.

* Code added for proper custom instrumentation of new Tcl commands (e.g. apply,
dict, try) and subcommands.

* Put remote-debugging client code file into package for ease of access.

* Cleanup and correction of doc files.

* Files and directories re-arranged into starkit-ready format.

* Added script to wrap debugger code into a starkit of minimum size.

* Miscellaneous bug fixes.
9 changes: 9 additions & 0 deletions bin/debugadapter
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
#\
exec tclsh "$0" "$@"

lappend auto_path [file join [file dirname [info script]] ../vendor/tcllib1.19]

source [file join [file dirname [info script]] ../debug_server_main.tcl]

# vim: ft=tcl
55 changes: 55 additions & 0 deletions bin/remote_debug_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh
#\
exec tclsh "$0" "$@"

set TclProDirectory [file dirname [file dirname [info script]]]

lappend auto_path [file join $TclProDirectory lib remotedebug]

package require remotedebug 2.0

set port 2345
if { [info exists ::env(TCLPRO_DEBUG_PORT)] } {
set port $::env(TCLPRO_DEBUG_PORT)
}

#
# Parse additional arguments for this process:
# -port <port>
# -cwd <cwd>
#
while { [llength $argv] } {
set arg [lindex $argv 0]
if { $arg == "--" } {
set argv [lassign $argv ignored_]
break
} elseif { $arg == "-port" } {
set argv [lassign $argv ignored_ port]
} elseif { $arg == "-cwd" } {
set argv [lassign $argv ignored_ cwd]
cd $cwd
} else {
break
}
}


set script [lindex $argv 0]
set argv [lrange $argv 1 end]
set argv0 $script

puts "Preparing to execute $argv0 with args $argv"

puts "Using TCL interpreter: [info nameofexecutable]"
puts "Using TCL version: [info tclversion], [info patchlevel]"
puts "Using TCL library: [info library]"

puts stderr "Listening for connections on $port"
if { ! [debugger_init_accept $port] } {
puts stderr "Unable to connect?"
exit 1
}

puts "Ready? Let's go. Running $argv0 with $argv"

source $argv0
83 changes: 83 additions & 0 deletions debug_server_main.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env tclsh

# Copyright (c) 2017 Forward Folio LLC
# See the file "license.terms" for information on usage and redistribution of this file.

# This is the only way to know definitively if a package is available without
# putting "package require" in a catch statement. Catch statement is bad
# because it hides the errors you don't anticipate as well as the ones you do:
if {"starkit" ni [package names]} {
eval [package unknown] starkit
}

# Now "package names" holds the definitive answer as to whether the desired
# package is available:
if {"starkit" in [package names]} {
package require starkit

# unset existing state vars in case this is a nested starkit and
# startup has been done before:
unset -nocomplain ::starkit::mode ::starkit::topdir

::starkit::startup

# Starkits predate Tcl modules. Starkit boot doesn't anticipate that
# module paths may lie outside starkit dir, thus losing true
# encapsulation.
# In case this is a starpack, strip out module paths outside the vfs,
# thus ensuring only modules loaded are those within the vfs:
set tpaths [::tcl::tm::path list]
if {$::starkit::mode ne {starpack}} {
set tpaths {}
}
foreach tpath $tpaths {
if {[string first $::starkit::topdir/ $tpath/]} {
::tcl::tm::path remove $tpath
}
}

} else {
# Should be possible to run an unwrapped starkit even without starkit
# package. If missing, do the things ::starkit::startup would do:
namespace eval ::starkit {
set topscript [
file dirname [
file norm [
file join [info script] x
]
]
]
variable topdir [file dirname $topscript]
variable mode sourced
if {$topscript eq [
file dirname [
file norm [
file join $::argv0 x
]
]
]} {
variable mode unwrapped
}
}

if {
[lsearch -exact $::auto_path $::starkit::topdir/lib] < 0 &&
[file isdir $::starkit::topdir/lib]
} {
lappend ::auto_path $::starkit::topdir/lib
}
}

unset -nocomplain tpath tpaths topscript

# If this is the first starkit started, save state variables in global space
# so that any nested starkit can access them:
if {![info exists topdir]} {
set topdir $::starkit::topdir
set mode $::starkit::mode
}

# Add module path within package lib path:
::tcl::tm::path add [file dirname $::starkit::topdir]//[file tail $::starkit::topdir]/lib/tm

source $::starkit::topdir/src/debug_server.tcl
Binary file added doc/TclProUsersGuide14.pdf
Binary file not shown.
Loading