Here is my setup:
- Vmware, FC7 installed, Cell SDK 3 installed (I use this for developing, PS3 as remote Cell box)
- PS3, FC7 installed, Cell SDK 3 installed
- Eclipse debugger used (yes, I know there might be some mega haxx cmdline GDB magic that could make this work,
but I'm not interested in that, unless it can be somehow integrated with Eclipse so that I have to do it only once)
When I try to debug a program with PPU and SPU code (PPU launching SPU, the communicating with it via mailboxes), the breakpoints I set to my SPU code will just not work. Debugging PPU programs or SPU programs separately work just fine (ppu and spu gdbserver..). I can always try to add tons of SPU code to emulate the PPU-SPU interactions, but that is clearly not the best way to debug multithreaded programs...
I've been trying to add source paths to the PPU project that is used to launch the debugged (in BE mode), but still there is always this on the console log:
"no source file named spu.c".
Probably this has something to do with the attaching of the SPU side of the debugger to the SPU thread that is launched by the PPU code. I've also tried setting SPU_DEBUG_START to 1 in the Eclipse debugger environment settings, but it doesn't work.
Any idea how to make this work?
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
4 replies Latest Post - 2008-03-07T13:25:47Z by SystemAdmin
Pinned topic Is there really no way to insert breakpoints into SPU code??
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2008-03-07T13:25:47Z at 2008-03-07T13:25:47Z by SystemAdmin
Re: Is there really no way to insert breakpoints into SPU code??2008-02-21T19:42:11Z in response to SystemAdminOK. So it seems to work with systemsim (and the linux running there) if I add this to .gdbinit:
set spe stop-on-init
But it doesn't work when using PS3 for debug. Does the libspe2 have to be compiled with debugging support or similar for this to work?
(or perhaps support for debugging in kernel?)
Re: Is there really no way to insert breakpoints into SPU code??2008-02-21T23:03:28Z in response to SystemAdminIf someone else has similar problems. I found a way to make this work. Example here is for 64-bit debug:
1) on host: enable GDB verbose logging from debug settings, start debug session (in my case vmware), wait until it hits the beginning of main
2) on PS3: find the PPU executable (will be /tmp/IBM/CellSDK/ ... something, you can see the path also from some of the Eclipse consoles)
3) on PS3: do "ldd <name_of_executable>"
4) on PS3: copy all the libraries that are referenced by exe and copy those over to your host where you have the Eclipse
5) on host: "mv /opt/cell/sysroot /opt/cell/sysroot_orig"
6) on host: "mkdir /opt/cell/sysroot", "mkdir /opt/cell/sysroot/lib64", "mkdir /opt/cell/sysroot/usr", "mkdir /opt/cell/sysroot/usr/lib64"
7a) on host: see from the GDB log where those libraries listed by LDD should be located and copy the files to those places
(should be /opt/cell/sysroot/lib64 and /opt/cell/sysroot/usr/lib64 for 64-bit for example..)
or if you are lazy:
7b) on host: just copy all the libs you grabbed to /opt/cell/sysroot/lib64 and /opt/cell/sysroot/usr/lib64.. it just takes some extra space
Basic problem is that the GDB on the SDK side is using the library files from the SDK and not from the PS3 for some of the debugging stuff. Probably this interferes on how the "set spu stop-on-load" should work. Similar thing should work for 32-bit mode, just the directories will be different. Surely there must be a way throught the gdbserver interface to pull these lib files from PS3 automatically?
Message was edited by: FlamepygmyUpdated on 2008-02-21T23:03:28Z at 2008-02-21T23:03:28Z by SystemAdmin
Ulrich.Weigand 060000NF8Y35 PostsACCEPTED ANSWER
Re: Is there really no way to insert breakpoints into SPU code??2008-02-27T23:34:17Z in response to SystemAdminYes, for GDB to work properly via gdbserver, the libraries in the hosts' sysroot directory need to exactly match the libraries on the target system. In particular, this applies to libc, libpthread, and libspe2.
We are looking into a way to remove this requirement for the next SDK release.
Re: Is there really no way to insert breakpoints into SPU code??2008-03-07T13:25:47Z in response to SystemAdminHello, I'm having the same problem as described in this thread (and completely identical setup). I'm unable to put breakpoints in SPU code (PPU breakpoints work).
As suggested I copied over the libraries from the PS3 to my workstation, this fixed the warnings when loading the shared libraries. Then I created a .gdbinit file in my project directory and put "set spu stop-on-load" in there and used it in my debug configuration.
The symbols are not getting loaded when debugging on the PS3.
~"From To Syms Read Shared Object Library\n"
~"0x0ffc1890 0x0ffda630 Yes /opt/cell/sysroot/lib/ld.so.1\n"
~"0x0fdf4570 0x0fe02560 No /opt/cell/sysroot/usr/lib/libspe2.so.2\n"
~"0x00192170 0x001a1e80 No /opt/cell/sysroot/lib/libgcc_s.so.1\n"
~"0x0fe3db20 0x0ff5e650 No /opt/cell/sysroot/lib/libc.so.6\n"
~"0x0fcd4560 0x0fce3250 No /opt/cell/sysroot/lib/libpthread.so.0\n"
~"0x0f9c1850 0x0f9c6d70 No /opt/cell/sysroot/lib/librt.so.1\n"
In a local simulation the symbols for all libraries are loaded and the breakpoint can be succesfully inserted.
~"From To Syms Read Shared Object Library\n"
~"0xf7fb1960 0xf7fca700 Yes /opt/cell/sysroot/lib/ld.so.1\n"
~"0x0ffc4570 0x0ffd2560 Yes /opt/cell/sysroot/usr/lib/libspe2.so.2\n"
~"0x10112170 0x10121e80 Yes /opt/cell/sysroot/lib/libgcc_s.so.1\n"
~"0x0fdedb20 0x0ff0e650 Yes /opt/cell/sysroot/lib/libc.so.6\n"
~"0x1fa54560 0x1fa63250 Yes /opt/cell/sysroot/lib/libpthread.so.0\n"
~"0x0fd41850 0x0fd46d70 Yes /opt/cell/sysroot/lib/librt.so.1\n"
Although the symbols are getting loaded in the simulator, and the breakpoint is succesfully set, the breakpoint is never hit
I think the problem is that now I copied the libraries from the PS3 to my workstation they are out of sync with the simulator. Running "$ sudo ./cellsdk_sync_simulator" did not solve this.
The messages I see when running the simulator (the same for the other libraries):
warning: .dynamic section for "/opt/cell/sysroot/usr/lib/libspe2.so.2" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
And also (multiple times):
gdb: error initializing thread_db library: version mismatch between libthread_db and libpthread
I think my .gdbinit file is not executed when starting debugging. I can not find it in the verbose gdb output. At the moment I'm working around this by manually inserting the command "set spu stop-on-load" when the program breaks on main() in the PPU.
Can somebody help me with any of these problems? Any tip, suggestion or solution is very welcome!