[squeak-dev] Can I use GDB with SqueakVM ?

Mariano Martinez Peck marianopeck at gmail.com
Sat Mar 27 19:54:59 UTC 2010

(cross posting)

Hi folks. I have a SqueakVM with an image that uses SqueakDBX to talk to a
database. SqueakDBX talks to a external library (written in C) called
OpenDBX. At the same time, OpenDBX then talks to another library which is
the database client library. When....I am having a problem with Firebird and
it seems to be related with threads management.

So, what I want to do is to start the SqueakVM with GDB, run my tests and
try to get as much information as possible when it crash.

So far I am in Ubuntu 9.10 and I have tried the following:

ubuntu at ubuntu-desktop:~/opendbx/trunk/test$ gdb
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from
(gdb) set args
(gdb) run
Starting program: /home/ubuntu/squeak/pharo-vm-0.15.2f-linux/squeak
[Thread debugging using libthread_db enabled]
Cannot find new threads: generic error

As you can see there the error

"[Thread debugging using libthread_db enabled]
Cannot find new threads: generic error"

I am not an expert in C or VM so I don't know if I am doing the things
correctly.  I tried to google a bit, and I found different solutions. I copy
exactly what I found:

"I've find a workaround, i've link the debugging app with libpthread and now
feels happy, and i can run it with gdb !"

"But however, if I compile the program with -pthread option, am able to
debug the program:
$ cc -W -Wall -Wextra -g 20.c `pkg-config --cflags --libs gtk+-2.0`

"The problem appears to be that something goes wrong with dynamically
loading libpthread in case the program has not been linked to it at
compile time. That would explain why it works when you use msethread,
because that one explicitly links to libpthread at compile time (via
the imports in mselibc, I guess).

Why dynamically loading libpthread causes problems is another
question. Maybe somehow the cthreads unit loads a different ("wrong")
copy of libpthread than the one the static linker uses when linking
the program. Or, alternatively, maybe the static linker selects a
different version of libc to link against if libpthread is also used
(libc and libpthread are quite interwoven on GNU systems, even though
they are separate libraries)."

So...I don't understand exactly how can I fix it.

Thanks for any help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100327/cec392f2/attachment.htm

More information about the Squeak-dev mailing list