From: Andreev Nikita (nik_at_kemsu.ru)
Date: Wed Sep 09 2009 - 21:40:08 PDT
> I have sanity-checked this by building a compiler configured as > described above and confirmed that "upcc -c -g -inst ..." attempts to > invoke the proper sub-build, and that the resulting object file and the > libs in that sub-build all contain debug info. However, I don't have > PPW or other GASP-enabled tools setup to perform a more complete test. You are a genius, Paul. Actually I needed debug info just for GASP-enabled tool (it seems to me that opt_inst sub-build didn't want to pass -g to the compiler) not for UPC itself. But your patch also works for me. Nevertheless I still have a problem. I got line numbering information but it looks wrong. I noticed the following: # gdb a.out 2644 GNU gdb Fedora (6.8-27.el5) Copyright (C) 2008 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 "x86_64-redhat-linux-gnu"... Attaching to program: /root/upc/a.out, process 2644 Reading symbols from /usr/lib64/libstdc++.so.6...done. Loaded symbols for /usr/lib64/libstdc++.so.6 Reading symbols from /lib64/libm.so.6...done. Loaded symbols for /lib64/libm.so.6 Reading symbols from /lib64/libgcc_s.so.1...done. Loaded symbols for /lib64/libgcc_s.so.1 Reading symbols from /lib64/libc.so.6...done. Loaded symbols for /lib64/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Reading symbols from /lib64/libnss_files.so.2...done. Loaded symbols for /lib64/libnss_files.so.2 0x00000030208b9d47 in sched_yield () from /lib64/libc.so.6 (gdb) b gaspu_dump_shared Breakpoint 1 at 0x416882: file /root/trace-mod/src/aux.c, line 31. (gdb) set bupc_frozen=0 (gdb) c Continuing. Breakpoint 1, gaspu_dump_shared (ptr_to_ptr_to_shared=0x7fff1b082170, addrfield=0x7fff1b081fa0, thread=0x7fff1b081f9c, phase=0x7fff1b081f98) at /root/trace-mod/src/aux.c:31 31 void gaspu_dump_shared(void *ptr_to_ptr_to_shared, size_t *addrfield, size_t *thread, size_t *phase) { (gdb) s gasneti_checkinit () at /root/install/berkeley_upc-2.8.0/gasnet/gasnet_internal.c:83 83 if (!gasneti_init_done) (gdb) 85 } (gdb) upcri_stack_check (si=0x822fe0, mythreadid=0, filename=0x5afa1a "/root/trace-mod/src/aux.c", linenum=31) at /root/install/berkeley_upc-2.8.0/upcr_threads.c:53 53 if (&x < si->hot) { (gdb) 54 uintptr_t size = si->cold - &x; (gdb) 56 si->hot = &x; (gdb) 57 if (size > upcri_stacksz_threshhold && !already_warned) { (gdb) 74 } (gdb) gaspu_dump_shared (ptr_to_ptr_to_shared=0x7fff1b082170, addrfield=0x7fff1b081fa0, thread=0x7fff1b081f9c, phase=0x7fff1b081f98) at /root/trace-mod/src/aux.c:32 32 shared void *pts = *(shared void **)ptr_to_ptr_to_shared; (gdb) 34 *addrfield = upc_addrfield(pts); (gdb) upcr_addrfield_shared (sptr=40) at /opt/bupc-runtime-2.8.0-gasp/dbg_inst/include/upcr_sptr.h:565 565 return UPCRI_ADDR_OF(sptr); (gdb) 569 } (gdb) gaspu_dump_shared (ptr_to_ptr_to_shared=0x7fff1b082170, addrfield=0x7fff1b081fa0, thread=0x7fff1b081f9c, phase=0x7fff1b081f98) at /root/trace-mod/src/aux.c:35 35 *thread = upc_threadof(pts); (gdb) upcr_threadof_shared (sptr=40) at /opt/bupc-runtime-2.8.0-gasp/dbg_inst/include/upcr_sptr.h:513 513 return UPCRI_THREAD_OF(sptr); (gdb) 517 } (gdb) gaspu_dump_shared (ptr_to_ptr_to_shared=0x7fff1b082170, addrfield=0x7fff1b081fa0, thread=0x7fff1b081f9c, phase=0x7fff1b081f98) at /root/trace-mod/src/aux.c:36 36 *phase = upc_phaseof(pts); (gdb) upcr_phaseof_shared (sptr=40) at /opt/bupc-runtime-2.8.0-gasp/dbg_inst/include/upcr_sptr.h:541 541 return UPCRI_PHASE_OF(sptr); (gdb) 545 } (gdb) gaspu_dump_shared (ptr_to_ptr_to_shared=0x7fff1b082170, addrfield=0x7fff1b081fa0, thread=0x7fff1b081f9c, phase=0x7fff1b081f98) at /root/trace-mod/src/aux.c:39 Line number 39 out of range; /root/trace-mod/src/aux.c has 37 lines. (gdb) You can see that line numbering is out of range. Correct me if I'm wrong. During compilation UPC translator substitute UPC code with some C instructions and then feeds transformed code to the GCC. So basically we would like to see transformed code in GDB. But I do not. I'm knowledgable about -save-temps flag and foo.trans.c files. But it doesn't work from a box. Do I need to substitute my foo.c code by contents of foo.trans.c code or invoke some kind of GDB command to load proper line numbering information? Because if I do nothing then as you can see GDB shows my initial UPC code. Nikita