[Pharo-project] COG VM and Locale
I am still willing to get Locale working with the combination of COG VM and Pharo. especially to make a version of DrGeo for the XO laptop where the CPU is subminimal, it brings a big usability improvement for the kids. But so far, the locale plugin does not work, any clue? Hilaire
On Wed, Mar 2, 2011 at 8:21 AM, Hilaire Fernandes < hilaire.fernandes@gmail.com> wrote:
I am still willing to get Locale working with the combination of COG VM and Pharo. especially to make a version of DrGeo for the XO laptop where the CPU is subminimal, it brings a big usability improvement for the kids. But so far, the locale plugin does not work, any clue?
Run under gdb. Things to check: there could be an unresolved reference which causes it to fail to load. See "Testing an external plugin has completely linked" in http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild. If it loads, put a breakpoint in initialiseModule and step through it. Building a debug VM can help in debugging (again see HowToBuild)
Hilaire
On Wed, Mar 2, 2011 at 6:23 PM, Eliot Miranda <eliot.miranda@gmail.com>wrote:
On Wed, Mar 2, 2011 at 8:21 AM, Hilaire Fernandes < hilaire.fernandes@gmail.com> wrote:
I am still willing to get Locale working with the combination of COG VM and Pharo. especially to make a version of DrGeo for the XO laptop where the CPU is subminimal, it brings a big usability improvement for the kids. But so far, the locale plugin does not work, any clue?
Run under gdb.
Is there a "how to run under gdb" ? Laurent
Things to check: there could be an unresolved reference which causes it to fail to load. See "Testing an external plugin has completely linked" in http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild. If it loads, put a breakpoint in initialiseModule and step through it. Building a debug VM can help in debugging (again see HowToBuild)
Hilaire
Le 02/03/2011 18:23, Eliot Miranda a écrit :
On Wed, Mar 2, 2011 at 8:21 AM, Hilaire Fernandes <hilaire.fernandes@gmail.com <mailto:hilaire.fernandes@gmail.com>> wrote:
I am still willing to get Locale working with the combination of COG VM and Pharo. especially to make a version of DrGeo for the XO laptop where the CPU is subminimal, it brings a big usability improvement for the kids. But so far, the locale plugin does not work, any clue?
Run under gdb. Things to check: there could be an unresolved reference
Hum, remember the good old unpleasant time with DrGeo C++ and debugging with GDB.
which causes it to fail to load. See "Testing an external plugin has completely linked" in
Nevertheless it looks like the plugin is loaded as: Smalltalk listLoadedModules. #('SocketPlugin VMMaker-oscog.40 (i)' 'Matrix2x3Plugin VMMaker-oscog.40 (i)' 'FloatArrayPlugin VMMaker-oscog.40 (i)' 'JPEGReadWriter2Plugin VMMaker-oscog.40 (i)' 'DropPlugin VMMaker-oscog.40 (i)' 'B2DPlugin VMMaker-oscog.40 (i)' 'ZipPlugin VMMaker-oscog.40 (i)' 'LargeIntegers v1.5 VMMaker-oscog.40 (i)' 'LocalePlugin VMMaker-oscog.40 (e)' 'BitBltPlugin VMMaker-oscog.40 (i)' 'SecurityPlugin VMMaker-oscog.40 (i)' 'FilePlugin VMMaker-oscog.40 (i)' 'MiscPrimitivePlugin VMMaker-oscog.40 (i)')
http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild. If it loads, put a breakpoint in initialiseModule and step through it. Building a debug VM can help in debugging (again see HowToBuild)
I will try this Hilaire -- Education 0.2 -- http://blog.ofset.org/hilaire
Le 02/03/2011 18:23, Eliot Miranda a écrit :
Run under gdb. Things to check: there could be an unresolved reference which causes it to fail to load. See "Testing an external plugin has completely linked" in http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild. If it loads, put a breakpoint in initialiseModule and step through it. Building a debug VM can help in debugging (again see HowToBuild)
Not sure I got it right, but I have unreferenced symbols warning following the step above: bash-3.2# /bin/sh /home/olpc/COG/unixbuild/bld/libtool --mode=link gcc -Wl,--warn-unresolved-symbols -Wl,--no-allow-shlib-undefined -g -O2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0 -msse -DLSB_FIRST=1 -avoid-version -module -rpath /usr/local/lib/squeak/3.9-7 -o LocalePlugin.la LocalePlugin.lo sqUnixLocale.lo rm -fr .libs/LocalePlugin.la .libs/LocalePlugin.* .libs/LocalePlugin.* gcc -shared LocalePlugin.lo sqUnixLocale.lo -Wl,--warn-unresolved-symbols -Wl,--no-allow-shlib-undefined -Wl,-soname -Wl,LocalePlugin -o .libs/LocalePlugin /lib/libc.so.6: warning: undefined reference to `__libc_stack_end@GLIBC_2.1' /lib/libc.so.6: warning: undefined reference to `_dl_argv@GLIBC_PRIVATE' /lib/libc.so.6: warning: undefined reference to `_rtld_global_ro@GLIBC_PRIVATE' /lib/libc.so.6: warning: undefined reference to `___tls_get_addr@GLIBC_2.3' /lib/libc.so.6: warning: undefined reference to `_rtld_global@GLIBC_PRIVATE' /lib/libc.so.6: warning: undefined reference to `__libc_enable_secure@GLIBC_PRIVATE' creating LocalePlugin.la (cd .libs && rm -f LocalePlugin.la && ln -s ../LocalePlugin.la LocalePlugin.la)
On Wed, Mar 2, 2011 at 12:32 PM, Hilaire Fernandes < hilaire.fernandes@gmail.com> wrote:
Le 02/03/2011 18:23, Eliot Miranda a écrit :
Run under gdb. Things to check: there could be an unresolved reference which causes it to fail to load. See "Testing an external plugin has completely linked" in http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild. If it loads, put a breakpoint in initialiseModule and step through it. Building a debug VM can help in debugging (again see HowToBuild)
Not sure I got it right, but I have unreferenced symbols warning following the step above:
I think you can ignore these because they come from libc, not form the plugin. Since you see the plugin loaded above I *think* you know there's no undefined symbol in the plugin. I think the below is some mysterious internal glibc detail that always gets warned about.
bash-3.2# /bin/sh /home/olpc/COG/unixbuild/bld/libtool --mode=link gcc -Wl,--warn-unresolved-symbols -Wl,--no-allow-shlib-undefined -g -O2 -D_GNU_SOURCE -DNDEBUG -DITIMER_HEARTBEAT=1 -DNO_VM_PROFILE=1 -DCOGMTVM=0 -DDEBUGVM=0 -msse -DLSB_FIRST=1 -avoid-version -module -rpath /usr/local/lib/squeak/3.9-7 -o LocalePlugin.la LocalePlugin.lo sqUnixLocale.lo rm -fr .libs/LocalePlugin.la .libs/LocalePlugin.* .libs/LocalePlugin.* gcc -shared LocalePlugin.lo sqUnixLocale.lo -Wl,--warn-unresolved-symbols -Wl,--no-allow-shlib-undefined -Wl,-soname -Wl,LocalePlugin -o .libs/LocalePlugin /lib/libc.so.6: warning: undefined reference to `__libc_stack_end@GLIBC_2.1 ' /lib/libc.so.6: warning: undefined reference to `_dl_argv@GLIBC_PRIVATE' /lib/libc.so.6: warning: undefined reference to `_rtld_global_ro@GLIBC_PRIVATE' /lib/libc.so.6: warning: undefined reference to `___tls_get_addr@GLIBC_2.3 ' /lib/libc.so.6: warning: undefined reference to `_rtld_global@GLIBC_PRIVATE ' /lib/libc.so.6: warning: undefined reference to `__libc_enable_secure@GLIBC_PRIVATE' creating LocalePlugin.la (cd .libs && rm -f LocalePlugin.la && ln -s ../LocalePlugin.la LocalePlugin.la)
Le 02/03/2011 18:23, Eliot Miranda a écrit :
/branches/Cog/unixbuild/HowToBuild <http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild>. If it loads, put a breakpoint in initialiseModule and step through it.
I tried this, but my setup is a bit complicated as I am cross compiling for OLPC XO environment from an Ubuntu box. Building from the ubuntu host does not work at all: In file included from /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:30: /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.h:13: error: redefinition of 'struct glRenderer' /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.h:16: error: conflicting types for 'glRenderer' /home/hilaire/Travaux/pharo/temp/COG/platforms/unix/plugins/B3DAcceleratorPlugin/sqUnixOpenGL.h:13: note: previous declaration of 'glRenderer' was here /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c: In function 'glRenderVertexBuffer': /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c:811: warning: unused variable 'nFaces' make[1]: *** [sqOpenGLRenderer.lo] Erreur 1 make: *** [B3DAcceleratorPlugin.la] Erreur 2 May be wrong installed dev libraries. Btw, there are no way to clean the compiled .o code with 'make clean' Hilaire
Le 03/03/2011 20:57, Hilaire Fernandes a écrit :
Le 02/03/2011 18:23, Eliot Miranda a écrit :
/branches/Cog/unixbuild/HowToBuild <http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild>. If it loads, put a breakpoint in initialiseModule and step through it.
Okay, strangely setting a break point to initialiseModule, put it on SurfacePlugin (gdb) break initialiseModule Breakpoint 1 at 0x811acc8: file /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c, line 204. I have to start the VM then quit, then adding again a break point on initialiseModule set it to locale: Program exited normally. (gdb) break initialiseModule Breakpoint 5 at 0x559542: file /home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c, line 112. step throught the function is: (gdb) r Starting program: /home/hilaire/Travaux/pharo/temp/COG/target/lib/squeak/3.9-7/squeak drgeo.image [Thread debugging using libthread_db enabled] [New Thread 0x77f88b70 (LWP 27787)] Breakpoint 5, initialiseModule () at /home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c:112 112 return sqLocInitialize(); (gdb) s heartbeat_handler (sig=14, sig_info=0x33, context=0x0) at /home/hilaire/Travaux/pharo/temp/COG/platforms/unix/vm/sqUnixHeartbeat.c:475 475 { (gdb) s 476 if (!ioOSThreadsEqual(ioCurrentOSThread(),getVMOSThread())) { (gdb) s Program received signal SIGTRAP, Trace/breakpoint trap. 0x0013cdc6 in pthread_self () from /lib/tls/i686/cmov/libpthread.so.0 Hilaire -- Education 0.2 -- http://blog.ofset.org/hilaire
On Thu, Mar 3, 2011 at 12:31 PM, Hilaire Fernandes < hilaire.fernandes@gmail.com> wrote:
Le 03/03/2011 20:57, Hilaire Fernandes a écrit :
Le 02/03/2011 18:23, Eliot Miranda a écrit :
/branches/Cog/unixbuild/HowToBuild <http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild>. If it loads, put a breakpoint in initialiseModule and step through it.
Okay, strangely setting a break point to initialiseModule, put it on SurfacePlugin
(gdb) break initialiseModule Breakpoint 1 at 0x811acc8: file
/home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c, line 204.
I have to start the VM then quit, then adding again a break point on initialiseModule set it to locale:
Program exited normally. (gdb) break initialiseModule Breakpoint 5 at 0x559542: file
/home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c, line 112.
step throught the function is:
(gdb) r Starting program: /home/hilaire/Travaux/pharo/temp/COG/target/lib/squeak/3.9-7/squeak drgeo.image [Thread debugging using libthread_db enabled] [New Thread 0x77f88b70 (LWP 27787)]
Breakpoint 5, initialiseModule () at
/home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c:112 112 return sqLocInitialize(); (gdb) s heartbeat_handler (sig=14, sig_info=0x33, context=0x0) at
/home/hilaire/Travaux/pharo/temp/COG/platforms/unix/vm/sqUnixHeartbeat.c:475 475 { (gdb) s 476 if (!ioOSThreadsEqual(ioCurrentOSThread(),getVMOSThread())) { (gdb) s
Program received signal SIGTRAP, Trace/breakpoint trap. 0x0013cdc6 in pthread_self () from /lib/tls/i686/cmov/libpthread.so.0
You'll need to state (gdb) handle SIGALRM nostop noprint noignore first. In fact, do that for most signals. What's happening below is gdb stopping on delivery of the 1KHz heartbeat, so you won't get far without ignoring it.
Hilaire
-- Education 0.2 -- http://blog.ofset.org/hilaire
Le 03/03/2011 21:43, Eliot Miranda a écrit :
You'll need to state
(gdb) handle SIGALRM nostop noprint noignore
first. In fact, do that for most signals. What's happening below is gdb stopping on delivery of the 1KHz heartbeat, so you won't get far without ignoring it.
Tell me what I am supposed to look at ro do, I hardly remember the keyword in GDB. Hilaire
On 3 March 2011 21:43, Eliot Miranda <eliot.miranda@gmail.com> wrote:
On Thu, Mar 3, 2011 at 12:31 PM, Hilaire Fernandes <hilaire.fernandes@gmail.com> wrote:
Le 03/03/2011 20:57, Hilaire Fernandes a écrit :
Le 02/03/2011 18:23, Eliot Miranda a écrit :
/branches/Cog/unixbuild/HowToBuild <http://www.squeakvm.org/svn/squeak/branches/Cog/unixbuild/HowToBuild>. Â If it loads, put a breakpoint in initialiseModule and step through it.
Okay, strangely setting a break point to initialiseModule, put it on SurfacePlugin
(gdb) break initialiseModule Breakpoint 1 at 0x811acc8: file
/home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c, line 204.
I have to start the VM then quit, then adding again a break point on initialiseModule set it to locale:
Program exited normally. (gdb) break initialiseModule Breakpoint 5 at 0x559542: file
/home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c, line 112.
step throught the function is:
(gdb) r Starting program: /home/hilaire/Travaux/pharo/temp/COG/target/lib/squeak/3.9-7/squeak drgeo.image [Thread debugging using libthread_db enabled] [New Thread 0x77f88b70 (LWP 27787)]
Breakpoint 5, initialiseModule () at
/home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c:112 112 Â Â Â Â Â Â return sqLocInitialize(); (gdb) s heartbeat_handler (sig=14, sig_info=0x33, context=0x0) at
/home/hilaire/Travaux/pharo/temp/COG/platforms/unix/vm/sqUnixHeartbeat.c:475 475 Â Â { (gdb) s 476 Â Â Â Â Â Â if (!ioOSThreadsEqual(ioCurrentOSThread(),getVMOSThread())) { (gdb) s
Program received signal SIGTRAP, Trace/breakpoint trap. 0x0013cdc6 in pthread_self () from /lib/tls/i686/cmov/libpthread.so.0
You'll need to state (gdb) handle SIGALRM nostop noprint noignore first. Â In fact, do that for most signals. Â What's happening below is gdb stopping on delivery of the 1KHz heartbeat, so you won't get far without ignoring it.
yeah.. i also were stuck with this cruelty before.. trying to step instruction-wise and was always interfered by heartbeat thread :)
Hilaire
-- Education 0.2 -- http://blog.ofset.org/hilaire
-- Best regards, Igor Stasenko AKA sig.
Le 04/03/2011 11:19, Igor Stasenko a écrit :
yeah.. i also were stuck with this cruelty before.. trying to step instruction-wise and was always interfered by heartbeat thread :)
Now, I still don't figure out what I should look at when stepping in the VM from GDB. I will try to figure out again. Hilaire
Le 04/03/2011 14:37, Hilaire Fernandes a écrit :
Now, I still don't figure out what I should look at when stepping in the VM from GDB. I will try to figure out again.
Here is the step by step from breakpoint to running state: Breakpoint 1, initialiseModule () at /home/hilaire/Travaux/pharo/temp/COG/src/plugins/LocalePlugin/LocalePlugin.c:112 112 return sqLocInitialize(); (gdb) n 113 } (gdb) n callInitializersIn (pluginName=<value optimized out>, ffiLoad=<value optimized out>) at /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/vm/sqNamedPrims.c:211 211 if(!okay) { (gdb) print The history is empty. (gdb) print init2 $1 = (void *) 0x559530 (gdb) print okay $2 = <value optimized out> (gdb) n findOrLoadModule (pluginName=0x559530 "U\211\345S\350\356\370\377\377\201û\032", ffiLoad=5606992) at /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/vm/sqNamedPrims.c:286 286 } (gdb) n ioLoadFunctionFrom (functionName=0xbff5d74c "primitiveTimezoneOffset", pluginName=0xbff5d64c "LocalePlugin") at /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/vm/sqNamedPrims.c:298 298 if(!module) { (gdb) n 303 if(!functionName) { (gdb) n 309 } (gdb) n 308 return findFunctionIn(functionName, module); (gdb) n 309 } (gdb) n ioLoadFunctionFrom (functionName=0x78139a2c "primitiveTimezoneOffset", pluginName=0x17 <Address 0x17 out of bounds>) at /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/vm/sqNamedPrims.c:308 308 return findFunctionIn(functionName, module); (gdb) n findFunctionIn (functionName=0xbff5d74c "primitiveTimezoneOffset", module=0x81a11e8) at /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/vm/sqNamedPrims.c:157 157 { (gdb) n 158 if(module->handle == squeakModule->handle) (gdb) n 161 return findExternalFunctionIn(functionName, module); (gdb) n 162 } (gdb) n ioLoadExternalFunctionOfLengthFromModuleOfLength (functionNameIndex=2014550572, functionNameLength=23, moduleNameIndex=2014550204, moduleNameLength=12) at /home/hilaire/Travaux/pharo/temp/COG/platforms/Cross/vm/sqNamedPrims.c:332 332 } (gdb) n primitiveExternalCall () at /home/hilaire/Travaux/pharo/temp/COG/src/vm/gcc3x-cointerp.c:27113 27113 if (addr == 0) { (gdb) n 27118 for (i = GIV(externalPrimitiveTableFirstFreeIndex); i <= (MaxExternalPrimitiveTableSize - 1); i += 1) { (gdb) n 27122 goto l1; (gdb) n 27119 if ((externalPrimitiveTable[i]) == 0) { (gdb) n 27120 externalPrimitiveTable[i] = addr; (gdb) n 27121 index = GIV(externalPrimitiveTableFirstFreeIndex) = i + 1; (gdb) n 27128 longAtput((lit + BaseHeaderSize) + (3 << ShiftForWord), ((index << 1) | 1)); (gdb) n 27129 if (index >= 0) { (gdb) n 27130 rewriteMethodCacheEntryForExternalPrimitiveToFunction(addr); (gdb) n 27131 callExternalPrimitive(addr); (gdb) n 27137 } (gdb) n activateInterpreterMethodFromMachineCode () at /home/hilaire/Travaux/pharo/temp/COG/src/vm/gcc3x-cointerp.c:8598 8598 if (FailImbalancedPrimitives (gdb) n 8600 && ((GIV(framePointer) == savedFramePointer) (gdb) n 8598 if (FailImbalancedPrimitives (gdb) n 8601 && (!((((usqInt)(longAt(GIV(framePointer) + FoxMethod)))) < heapBase))))) { (gdb) n 8608 if (GIV(nextProfileTick) > 0) { (gdb) n 8613 if (GIV(primFailCode) == 0) { (gdb) n 8614 returntoExecutive(popStack(), 0); (gdb) n 8621 activateNewMethod(); (gdb) n -- Education 0.2 -- http://blog.ofset.org/hilaire
participants (4)
-
Eliot Miranda -
Hilaire Fernandes -
Igor Stasenko -
laurent laffont