0
votes

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

1 Answers

1
votes

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.)