View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] how to track a segmentation fault problem in Xotcl?

From: Zoran Vasiljevic <zoran_at_archiware.com>
Date: Fri, 29 Aug 2003 17:18:31 +0200

On Friday 29 August 2003 16:26, Catherine Letondal wrote:
> Hi,
>
> I have just re-installed Xotcl 1.0.2 version and succedeed in running my
> application with some minor changes since the last xotcl version I used on
> this platform (Sparc/Solaris 7) was the 0.9 :-)
>
> I have a segmentation fault that occurs when a command is called from a Tk
> menu. The command is attached to the popup by a:
> add command -command
> statement on a menu Tk widget that is raised by a tk_popup.
>
> However, the very same command, when called from the tcl (xowish)
> interpreter, works and does not produce any core dump. And most menu items
> also work well.
>
> So my question is: how do I debug such a situation?
> Thanks for any help...

You should compile wish with symbols (./configure --enable-symbols).
The same appiles for xotcl as well.
Then just say:

gdb wish
<some gdb output>
(gdb) run

This will start the wish. You can put some arguments to
the run command, the same ones you'd normally pass
to wish:

(gdb) run myscript.tcl

Then just run the code. On segv, the debugger will pop-up
and you can then do

(gdb) bt

which stands for "backtrace". This will show the stack.
This is very helpful in diagnosing problems.

Of course, you need a gdb debugger for Sun. I think
there are lots of sites on the net offering precompiled
binaries for solaris.

When you have the backtrace, just post it to the list
and we'll see what happens.

Cheers
Zoran