Can I use GDB with SqueakVM ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Can I use GDB with SqueakVM ?

Mariano Martinez Peck
(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@ubuntu-desktop:~/opendbx/trunk/test$ gdb /home/ubuntu/squeak/pharo-vm-0.15.2f-linux/squeak
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:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ubuntu/squeak/pharo-vm-0.15.2f-linux/squeak...done.
(gdb) set args /home/ubuntu/squeak/pharo1.0-10500-rc1dev09.12.1/pharo1.0-10500-rc1dev09.12.dbx.1.image
(gdb) run
Starting program: /home/ubuntu/squeak/pharo-vm-0.15.2f-linux/squeak /home/ubuntu/squeak/pharo1.0-10500-rc1dev09.12.1/pharo1.0-10500-rc1dev09.12.dbx.1.image
[Thread debugging using libthread_db enabled]
Cannot find new threads: generic error
(gdb)



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 gdb
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` -pthread"


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

Mariano