(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 |
Hi Mario, first you want to compile with debug symbols and perhaps with no optimization. Second it looks like you need to link with the pthreads library, not juts compile. So you can try e.g. platforms/unix/configure CFLAGS="-g3 -pthread" LIBS=-lpthread FWIW I routinely use gdb on Mac OS X, linux and windows to debug the Teleplace Cog vm.
HTH Eliot
On Sat, Mar 27, 2010 at 12:54 PM, Mariano Martinez Peck <[hidden email]> wrote:
|
On Fri Mar 19 07:13:18 UTC 2010, John M McIntosh wrote: > > On 2010-03-18, at 6:20 PM, David T. Lewis wrote: > > > > - Merge and adopt John's 64-bit and iPhone changes (John, need guidance > > as to specific things we need to include for 4.1). > > http://lists.squeakfoundation.org/pipermail/vm-dev/2010-January/003614.html > > > - Updates to support John's microsecond timer changes for profiling. > > http://bugs.squeak.org/view.php?id=7458 John, I have added your microsecond clock changes (Mantis 7458) to VMMaker on SqueakSource, and also added #primitiveUtdWithOffset as per earlier thread on vm-dev. Can you please follow up with the following: 1) Check in the new sq.h into Subversion (attached, and also on Mantis). This is your updated sq.h plus one additional declaration for ioUtcWithOffset(). 2) In your config.h for OS X and iPhone, add the following macro to override the default VMMaker definition and point to your actual platform function: #define ioMicroSecondClock ioMicroSeconds 3) Add the implementation for primitiveUtdWithOffset in OS X platform source by adding the following macro in your config.h: #define ioUtcWithOffset(clock, offset) setMicroSecondsandOffset(clock, offset) And then implement the function as: sqInt ioUtcWithOffset(sqLong *microSeconds, int *offset) { struct timeval timeval; if (gettimeofday(&timeval, NULL) == -1) return -1; long long seconds = timeval.tv_sec; suseconds_t usec = timeval.tv_usec; *microSeconds = seconds * 1000000 + usec; *offset = localtime(&seconds)->tm_gmtoff; return 0; } Note, the above ioUtcWithOffset is tested only on Linux but should be the same for OS X. I don't know if it would work for iPhone. If it does not work, just skip step 3 above and #primitiveUtcWithOffset will give a primitive failure at runtime. Thanks, Dave |
Oops, I forgot to attach the updated sq.h file. Here it is. Dave On Sun, Mar 28, 2010 at 02:33:47PM -0400, David T. Lewis wrote: > On Fri Mar 19 07:13:18 UTC 2010, John M McIntosh wrote: > > > > On 2010-03-18, at 6:20 PM, David T. Lewis wrote: > > > > > > - Merge and adopt John's 64-bit and iPhone changes (John, need guidance > > > as to specific things we need to include for 4.1). > > > > http://lists.squeakfoundation.org/pipermail/vm-dev/2010-January/003614.html > > > > > - Updates to support John's microsecond timer changes for profiling. > > > > http://bugs.squeak.org/view.php?id=7458 > > John, I have added your microsecond clock changes (Mantis 7458) to VMMaker > on SqueakSource, and also added #primitiveUtdWithOffset as per earlier > thread on vm-dev. > > Can you please follow up with the following: > > 1) Check in the new sq.h into Subversion (attached, and also on Mantis). This > is your updated sq.h plus one additional declaration for ioUtcWithOffset(). > > 2) In your config.h for OS X and iPhone, add the following macro to override > the default VMMaker definition and point to your actual platform function: > #define ioMicroSecondClock ioMicroSeconds > > 3) Add the implementation for primitiveUtdWithOffset in OS X platform source > by adding the following macro in your config.h: > #define ioUtcWithOffset(clock, offset) setMicroSecondsandOffset(clock, offset) > > And then implement the function as: > sqInt ioUtcWithOffset(sqLong *microSeconds, int *offset) > { > struct timeval timeval; > if (gettimeofday(&timeval, NULL) == -1) return -1; > long long seconds = timeval.tv_sec; > suseconds_t usec = timeval.tv_usec; > *microSeconds = seconds * 1000000 + usec; > *offset = localtime(&seconds)->tm_gmtoff; > return 0; > } > > Note, the above ioUtcWithOffset is tested only on Linux but should be > the same for OS X. I don't know if it would work for iPhone. If it does > not work, just skip step 3 above and #primitiveUtcWithOffset will give > a primitive failure at runtime. > > Thanks, > > Dave sq.h (17K) Download Attachment |
In reply to this post by Eliot Miranda-2
On Sat, Mar 27, 2010 at 5:57 PM, Eliot Miranda <[hidden email]> wrote:
Thanks Eliot. I tried what you said, but I got another problem now. I configure the VM, with this: ../unix/cmake/configure --CFLAGS="-g3 -pthread" --LIBS=-lpthread Then I make and make install. No problems. SqueakVM works ok and I can open my images. The problem is with gdb. I tried this: ubuntu@ubuntu-desktop:~/Pharo/vm/Squeak-3.11.3.2135-pharo-src/build$ gdb 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/>... "/home/ubuntu/Pharo/vm/Squeak-3.11.3.2135-pharo-src/build/squeak": not in executable format: File format not recognized (gdb) And the same happens with gdb ./squeak or gdb /usr/local/bin/squeak etc... But squeak IS executable: ubuntu@ubuntu-desktop:~/Pharo/vm/Squeak-3.11.3.2135-pharo-src/build$ ls -la /usr/local/bin/squeak -rwxr-xr-x 1 root root 1791 2010-03-28 21:57 /usr/local/bin/squeak So...any ideas what can be the problem ? Thanks a lot in advance, Mariano
|
In reply to this post by David T. Lewis
On Fri Mar 19 07:13:18 UTC 2010, John M McIntosh wrote: > > On 2010-03-18, at 6:20 PM, David T. Lewis wrote: > > > > - Merge and adopt John's 64-bit and iPhone changes (John, need guidance > > as to specific things we need to include for 4.1). > > http://lists.squeakfoundation.org/pipermail/vm-dev/2010-January/003614.html >From the above link: > sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, sqInt desiredHeapSize, squeakFileOffsetType imageOffset); > should be > sqInt readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize, squeakFileOffsetType imageOffset); > > EXPORT(sqInt) dumpImage(sqInt fileName); > should be > EXPORT(sqInt) dumpImage(char * fileName); The declarations for readImageFromFileHeapSizeStartingAt() and dumpImage() are both fixed in VMMaker-dtl.165 on SqueakSource. Dave |
In reply to this post by Mariano Martinez Peck
Hi Mariano, On Sun, Mar 28, 2010 at 1:10 PM, Mariano Martinez Peck <[hidden email]> wrote:
But what kind of executable is it? What does find(1) say? Also I find it hard to believe that "This GDB was configured as "i486-linux-gnu"", I would expect i686 at least. So trying different gdbs might help. Also have you tried to compile a helloworld.c compiled with the same flags as the squeak VM and see that gdb works with that? Your problem might be gdb not the VM.
HTH Eliot
|
In reply to this post by Mariano Martinez Peck
On Mon, Mar 29, 2010 at 9:10 AM, Mariano Martinez Peck <[hidden email]> wrote: > > > On Sat, Mar 27, 2010 at 5:57 PM, Eliot Miranda <[hidden email]> wrote: >> >> >> Hi Mario, >> first you want to compile with debug symbols and perhaps with no optimization. Second it looks like you need to link with the pthreads library, not juts compile. So you can try e.g. >> platforms/unix/configure CFLAGS="-g3 -pthread" LIBS=-lpthread >> FWIW I routinely use gdb on Mac OS X, linux and windows to debug the Teleplace Cog vm. > > Thanks Eliot. I tried what you said, but I got another problem now. I configure the VM, with this: > > ../unix/cmake/configure --CFLAGS="-g3 -pthread" --LIBS=-lpthread > > Then I make and make install. No problems. SqueakVM works ok and I can open my images. > > The problem is with gdb. I tried this: > > ubuntu@ubuntu-desktop:~/Pharo/vm/Squeak-3.11.3.2135-pharo-src/build$ gdb 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/>... > "/home/ubuntu/Pharo/vm/Squeak-3.11.3.2135-pharo-src/build/squeak": not in executable format: File format not recognized > (gdb) > > > And the same happens with gdb ./squeak or gdb /usr/local/bin/squeak etc... > > But squeak IS executable: > > ubuntu@ubuntu-desktop:~/Pharo/vm/Squeak-3.11.3.2135-pharo-src/build$ ls -la /usr/local/bin/squeak > -rwxr-xr-x 1 root root 1791 2010-03-28 21:57 /usr/local/bin/squeak > > > So...any ideas what can be the problem ? Try opening "squeak" in a text editor. It could be a script that starts the real VM executable which might be elsewhere. Also, a tip: if you're making VMs, it's better not to install them in /usr/local until you're happy with them being stable and working. Use: > ../unix/cmake/configure --CFLAGS="-g3 -pthread" --LIBS=-lpthread --prefix=~/Pharo/myvm (or something). > nice make install (I assume the configure script takes --prefix like GNU autoconf does?) Also, if you just want to see how the interpreter works, you can run it inside Squeak: http://n4.nabble.com/Simulate-3-4-with-InterpreterSimulator-td1678060.html#a1694237 Gulik. -- http://gulik.pbwiki.com/ |
In reply to this post by David T. Lewis
Let me check in stuff and update VMMaker assuming the target doesn't keep moving over the next hour. On 2010-03-28, at 11:33 AM, David T. Lewis wrote: > On Fri Mar 19 07:13:18 UTC 2010, John M McIntosh wrote: > -- =========================================================================== John M. McIntosh <[hidden email]> Twitter: squeaker68882 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com =========================================================================== smime.p7s (3K) Download Attachment |
In reply to this post by Michael van der Gulik-2
On Sun, Mar 28, 2010 at 3:59 PM, Michael van der Gulik <[hidden email]> wrote:
Doh! Try myvm/lib/squeak/3.9-7/squeak
|
Thanks to everybody. At the end it was the problem Michael said. /usr/local/bin/squeak was just a script but the executable was in /usr/local/lib/squeak/3.11.13-2135/squeakvm Now it works perfect. I can gdb the Squeak VM!! Thanks a lot. Mariano On Sun, Mar 28, 2010 at 10:04 PM, Eliot Miranda <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |