RamDebugger

Summary

RamDebugger is a graphical debugger Tcl/Tk

http://www.compassis.com/ramdebugger/img/pastedimage3.jpeg

Download: ftp://ftp.compassis.com/pub/ramdebugger/

Attributes

website
http://www.compassis.com/ramdebugger ]
current version
8.3
release date
2012-02-03
author
Ramon Ribó (RAMSAN)
author email
[email protected]
author website
http://gid.cimne.com/ramsan

Response

AJD: First impressions are that this is an excellent, easy-to-use debugger. Thank you Ramon for making this public - it is obvious that large amount of effort has gone into this. One improvement I'd suggest is that in the variable list, it would be nice if array variables could be shown with the key/values on separate lines - similar to how structs are shown in Visual Studio.

jcw: Why oh why did it take me so long to discover this gem? Thanks for creating this terrific tool...

Someone have the energy to make a page along the lines of, "RamDebugger Testimonials"? They seem to be piling up here ... Notice that tclguy, himself responsible for a (proprietary) competitor, has written, "RamDebugger is probably your best bet for free GUI debuggers."

prasadpreeti 2010-05-26 09:07:55: Thanks Ramsen for the wonderful tool....

Documentation

official reference
change log

Description

http://www.gidhome.com/RamDebugger/Ramdebugger_images/image0.gif

With RamDebugger, it is possible to make Local Debugging, where the debugger starts the program to be debugged. and Remote debugging, where the program to debug is already started and RamDebugger connects to it.

RamDebugger has additional capabilities like:

  • Editing the code. It is possible to edit the code inside its own editor and resend the new code without closing the debugged program.
  • The TCL-TK source code is colorized and supports automatic indentation.
  • When stopping the debugger is one source code line, it is possible to view all the variables and expression values, as well as change them.
  • It has additional options to measure execution times in the debugged program.
  • Works in Linux and Windows
  • Includes additional packages, like Tkcon and VisualRegexp, developed by third party people, as a convenience for RamDebugger users.
  • The same program is an IDE for compiling and debugging c and c++

The version-control system GUI component of RamDebugger is also available as vcs-ramdebugger

Obtaining

When you visit the web site, and select Download, you choose between several compressed files to download, depending on the platform to be supported.

There are typos in the download URLs at the website; try ftp://ftp.compassis.com/pub/ramdebugger/

Installing

Make certain that the Tcl environment that you use has installed tcllib ; the code potentially uses snit, textutil, base64, fileutil, sha1, as well as Thread, vfs, img, tdom.

Misc

VL 2003-06-11: Perhaps add a note here about the ongoing discussion of using it with m68k-palmos-gdb on comp.lang.tcl? I would personally be very interested in that usage as well, I am on w2k so I will be able to help with some testing once you have the basic stuff dealt with.

Try to change the name gdb into another name in these two locations:

if { [auto_execok gdb] == "" } {   (near line 471)
    ...
    error "Could not find command 'gdb'"
}

set fid [open "|gdb -q |& cat" r+]  (near line 504)

Debugger appears not to instrument code within a switch statement, so it can't be stepped through.

ramsan answers:

It can instrument switch in this way:

switch ?options? string {pattern body ?pattern body ...?}

and not in this way:

switch ?options? string pattern body ?pattern body ...?

This has always worked:

switch aa {
    aa {
        set aa 3
    }
}

this is not instrumented, but does not give any error:

switch aa aa {
    set aa 3
}

anonymous: The debug start command is on one menu; the stop command is on another menu and buried two deep.

ramsan:

You will find both, the start and stop commands in:

   File->Debug on

anonymous: If I use the f11 Step Into command on a source statement that references another file, debugger will start another separate debugging session on the new file rather than incorporate it into the current session. If I use the f10 Step Through command, the sourced file will not be stepped through, but will be incorporated into the current session as I expected the f11 button to work.

ramsan:

The default way of working (can be changed in preferences), is that a file will only be entered when "stepping into" if it is already loaded into RamDebugger. In this way, a big amount of unnecessary files does not need to be instrumented and loaded. Apart from it, F10 and F11 should work OK

anonymous: Global variables can't be viewed in the right-hand variables table, even when the "local variables" checkbutton is deselected.

ramsan:

To deselect the "local variables", means that nothing will be viewed. If you want to see global variables, use:

    Debug->Expressions or
    the Right upper tab (inserting var names there) or
    put the cursor over one variable name in the code

HZe: I really like this one! It really helps finding bugs very easily. But I have two issues. Perhaps someone can help me with that:

First, (on Windows) when debugging and pressing the start/continue button the second time (while my application is already running) it asks whether to start new and I have to answer "no". This is somewhat irritating. But it works and continues debugging the running application.

ramsan: Version 3.2 should avoid this problem. Now, it is necessary to stop debugging before starting again.

HZe: Second, I would like to trigger the Debugger by a flag in all my applications. This would usually be done by remote debugging, I guess. But (again on Windows) I don't want to use an additional package (comm) and I want to have it platform-independent. I once did it with TUBA by just letting the application restart itself in the debugger (exec RamDebugger.tcl $argv0 $argv). How can I pass the program name and parameters to RamDebugger? It works, if I manually use "Debug-on" but RamDebugger seems to ignore additional parameters.

Of course, before restarting, the flag to invoke the Debugger has to be toggled, so we do not end up in a loop forever.

This scenario is so important to me, because my tcl applications are not started from a shell directly, but are invoked from another system. The application can only work properly, if the environment is set correctly and parameters (mostly names of temporarily created files) are used.

ramsan: Use RamDebugger as a package. Use something like this in your application:

bind all <F12> {
    # enter here the path where you have installed RamDebugger
    # for example: {c:\Program files\RamDebugger}
    lappend auto_path {C:\TclTk\RamDebugger3.2} {C:\TclTk\ActiveTcl8.4\lib}
    package require RamDebugger
}

Bryan Oakley 11-11-2003: this doesn't seem to help much. My tcl applications are started via another process, so I thought this sounded like a neat solution. So, I added the above code, started my application, then pressed F12. The debugger starts, but it doesn't seem to be connected to the running app. Color me disappointed.

ramsan: After starting the debugger, choose the file to debug and press Continue/go (F5). The debugger should become connected.

Bryan Oakley: That got me a little further, but now I get a dialog saying "Received Error from Debugged program: Already existing channel: :comm::comm Check Output for details". Clicking OK gives me "Received Error... too many nested calls to Tcl_EvalObj".

Remote debugging seems to work, so I'll try it that way instead.


anonymous: Where is the 'step out' command? I consider a debugger without this facility to be practically unusable.

ramsan: - Last RamDebugger version 5.5 has a command called "return" that should do a 'step out'.

ET: This seems to do an immediate return, not a step out. A step out, in say visual C, means run but do a breakpoint upon returning from the current level. And similarly, I don't think break does what I would want, to break from the current loop. It seems to just do a step (into).


HZe: It would be nice if there would be a switch to write only spaces, not tabs. I use indent size 4 (which RamDebugger allows to configure: great!) but when saving a file 8 spaces get a tab. I don't want to start a religious discussion about how indent size should be or how wide a tab is, but a switch to force RamDebugger to write always spaces for indentation would be appreciated. Nevertheless: great tool! I like it.

For me, this one does it (not the optimal solution, but a start):

proc RamDebugger::_savefile_only { file data } {
    variable FileSaveHandlers

    if { $file eq "*Macros*" } {
        SaveMacrosDocument $data
    } elseif { [info exists FileSaveHandlers($file)] } {
        set err [catch {eval $FileSaveHandlers($file) [list $file $data]} errstring]
        if { $err } { error "Error saving file '$file' ($errstring)" }
    } else {
        if { [file exists $file] } {
            set ic 0
            while { [file exists $file.~$ic~] } { incr ic }     
            set renfile $file.~$ic~
            set err [catch { file rename -force $file $renfile } errstring]
            if { $err } { error "Error saving file '$file' ($errstring)" }
        }
        set err [catch { open $file w } fout]
        if { $err } { error "Error saving file '$file'" }

        set header [string range $data 0 255]
        if { [regexp -- {-\*-\s*coding:\s*utf-8\s*;\s*-\*-} $header] } {
            fconfigure $fout -encoding utf-8
        }
        if 0 {
                # original:
                puts -nonewline $fout $data
        } else {
                # new: while saving, convert <tab> to 8 <blanks>
                foreach line [split $data \n] {
                    while {[regsub {^( *)\t} $line {\1        } line] > 0} {}
                    puts $fout $line
                }
        }
        close $fout
        if { [info exists renfile] } {
            file delete -force $renfile
        }
    }
}

ET: I'm running on windows. I'm a bit curious about a few things. I'm running the starkit. I see lots of registry activity and there is now an entry, but nothing seems to be there when looking from regedit, yet it does remember its prefs. I see tclkit.exe has launched cvs.exe, and my zone-alarm pops up wanting to know if cvs.exe can access the internet. Is there some version controlled default repository built into this program? Very odd behavior for what looks to be a rather fantastic program. I don't want to look a gift horse in the mouth, but better safe than sorry...

ramsan: The registry is used to save the preferences. cvs is used to maintain a history of changes in the files. Look at menu File->Revisions. Anyway, it is an open source program. You can look at the code to verify this.

ET: Ah, I see, cool feature. The ZA log said cvs.exe was trying to get to my router for some DNS lookup. Funny, the cvs.exe that get's invoked is in my cygnus directory. Anyway, no biggy. I just told ZA to prohibit access and it still works ok. This is quite a program.


CRV: I'm new -- while trying to follow the tutorial on file example1.tcl it gives a warning dialog that says "Recieved Error from Debugged program {invalid command name "toplevel"} Check Output for details" Reading the output tells me that the first line is the problem (i.e. toplevel .t). Similar things happen on other files -- what am I missing?

MG: It's only a guess, but it sounds like you might not have Tk loaded, CRV. Try adding

package require Tk

somewhere at the top of your code and trying it again?

LV: Also, be certain that the tcl that is being used to start the program is one that has Tk available to it. I've seen cases in the past where someone only installs Tcl or a tclkit that only has tcl in it, and thus doesn't have Tk available.


SEH 2006-07-21 -- I just downloaded rdb 5.6 and wanted to run it in text mode via Tkcon. I sourced RamDebugger.tcl, did the namespace import, did rlist -asmainfile on my file, and got the following error:

invalid command name "RamDebugger::TextOutRaise"
   while executing
"RamDebugger::TextOutRaise"
   (procedure "rlist" line 209)
   invoked from within
"rlist -asmainfile globfind.tcl"
   ("uplevel" body line 1)
   invoked from within
"uplevel #0 {rlist -asmainfile myfile.tcl}"

Update: my file had a missing close brace. Perhaps you should check files for well-formedness before sourcing.


escargo 2008-01-02: I just downloaded the 6.1.2 starkit, and it does run under Microsoft Windows XP SP2. When I bring up the "about" window from the Help menu, it's very animated, but I can't get the window to close. The "Close" button is animated to the point where it tries to run away when you try to point to it. The close button on the window decorations (X) is not honored. When I used the tab key to put the focus on the Close button, it would not honor the return key press to invoke its function. (I did shrink the window to restrict the room the button had to run around with and got a congratulations message when I finally clicked on it. That does demonstrate a perverse sense of humor, I guess.) I think the window's X and the tab-and-return ought to work to close the window.


ube: Looks great. Only I had problems on XP: "can't find package snit". I use Tcl/Tk version 8.5. Clicking on those little examples .. they work. Both environment variables are there. - Please, what could be a reason?

srinathk: Looks like a good debugger but I am not able to invoke this and getting the same error..

Error in startup script: can't find package snit
    while executing
"package require snit"
    (file "/psc/proj/DesignReUse_SW/prb/TclTK_Ram_Debugger/RamDebugger6.2/./addons/dialogwin/dialogwin.tcl" line 13)
    invoked from within
"source /psc/proj/DesignReUse_SW/prb/TclTK_Ram_Debugger/RamDebugger6.2/./addons/dialogwin/dialogwin.tcl"
    ("package ifneeded" script)
    invoked from within
"package require dialogwin"
    (procedure "RamDebugger::InitGUI" line 54)
    invoked from within
"RamDebugger::InitGUI .gui $geometry $ViewOnlyTextOrAll $topleveluse"
    invoked from within
"if { ![info exists SkipRamDebuggerInit] } {
    if { [info command master] != "" } {
        set registerasremote 0
    } else { set registerasremote 1 }
   ..."
    (file "RamDebugger.tcl" line 8482)

I am using tcl/tk 8.4.7 version Linux. Appreciate your help.

schlenk: Reading the error messages helps..., Snit is a package from tcllib, you should probably install it too.

srinathk hi schlenk, thanks for your inputs. I have tried installing snit package and later updated my environment. Now I am able to use RamDebugger. In the first look I found it very useful and am able to debug my application. Thanks a lot Ramsan.

azynheira 2014-12-01 It seems with ActiveState 8.6.3 the latest version of Ramdebugger (8.3) does not work very well. At least all the menus are garbagged in the left top corner. Anybody know what makes this not work with 8.6.3 ?. Also it seems the ftp site from http://www.compassis.com/ramdebugger is down and I cannot check if there is a new version that support Tcl 8.6.3 without issues. Thanks azynheira

LAM(2014-12-02): I'm working ok on Win7/core 8.6.3/Ramdebugger 8.3. For download use ftp://ftp.compassis.com/pub/ramdebugger because the ftp link in the site is malformed.

azynheira 2014-12-03 I got it from there and in Linux at least I still have the same problem. I works fine but there are all the menus grabbled on the top left side of the screen. I think now, this might be because I am on a dual monitor setup ???. I will test on my MacOSX when I get home! Thanks, azynheira

msc 2016-11-16 Is there any way to make this tool running with Tcl/TK 8.6.x? I tried, but didnot have success. (treectrl is missing etc.). I think there are some packages used, which are already in main distribution. Any help is welcome

Hi all! Same trouble for Me ... Windows 7(x64), ActiveTcl 8.6.4.1.299124 ... Anyone on the deck ? Best, Stan.

LAM 2018-03-07 Stan, i suggest you to visit comp.lang.tcl for help.