views:

21

answers:

1

I have a nice fully functioning module (wrtten using tcl/cpp) it works fine.

I want to use ramdebugger to debug scripts using that module

When I enter

load mylib.so
command1_from_lib xx
command2_from lib yy

If (say) command2 returns an error then ramdebugger dies

[paul@paul-es5 ramdebugger7.7.1]$ ./ramdebugger 
alloc: invalid block: 0x999c058: 0 0
Aborted

It dies here in libtcl / ResetObjResult

if ((objResultPtr->bytes != NULL)
        && (objResultPtr->bytes != tclEmptyStringRep)) {
    ckfree((char *) objResultPtr->bytes);
}

My suspicion is there is confusion over the global tclEmptyStringRep. I think the starkitted(?) ramdebugger has one and the dynamically loaded libtcl has a different one - the bytes pointer should logically be pointing to an empty string but the value there does not match what gdb shows for the global

I am a tcl noob and need any help I can get. Alternatively a suggestion for a different debugger would work

edit: fixed

Use tclStub to defer the link between the extension and the tcl runtime.

+1  A: 

This sounds very much like a bug to me, as opposed to a question which this site can answer. You should contact the ramdebugger people to see if they can help.

However, for general Tcl debugging you could also see if the tools produced by ActiveState help; IIRC you can get a free trial to see if they can make any headway. (Myself, I'm of the put-lots-of-printf-calls in school of debugging, so I'm nobody's poster child.)

Donal Fellows
i thought thats what people would say; I was hoping for a 'yup thats a well known issue with tcl in general ....'. I did use ActiveState's excellent debugger and it works fine (but is sadly not free)
pm100
Well, I typically just write code interactively until it does about what I want, then cut-n-paste it into a file to make procedures that do it all for me. Then I test it, typically with edge cases. If that all works, I package it all up and pop it into my personal package archive. But that's not necessarily practical for you, and it helps not at all with ramdebugger (which I've never used; when I get a crash, I just use gdb and brain-cells…)
Donal Fellows