OpenCSW Bug Tracker


Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004967 [gdb] regular use major always 2012-06-26 16:23 2012-07-27 18:55
Reporter tjyang View Status public  
Assigned To pfelecan
Priority normal Resolution fixed  
Status closed  
Summary 0004967: Can't use gdb to list out source code from gccgo compiled binary with -g option
Description The test helloworld.go was compiled and ran ok by gccgo 4.7.1as shown below.
But when doing a debugging session to list out source code, it failed.

$ cat helloworld.go
package main

import "fmt"

func main() {
        fmt.Println("Hello, World")
}
$ ./hellow
Hello, World
$

Additional Information $ /opt/csw/bin/gccgo -v
Reading specs from /opt/csw/lib/gcc/sparc-sun-solaris2.10/4.7.1/specs
COLLECT_GCC=/opt/csw/bin/gccgo
COLLECT_LTO_WRAPPER=/opt/csw/libexec/gcc/sparc-sun-solaris2.10/4.7.1/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with: /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/g\
cc-4.7.1/configure --prefix=/opt/csw --exec_prefix=/opt/csw --bindir=/opt/csw/bin --sbindir=/opt/csw/\
sbin --libexecdir=/opt/csw/libexec --datadir=/opt/csw/share --sysconfdir=/etc/opt/csw --sharedstatedi\
r=/opt/csw/share --localstatedir=/var/opt/csw --libdir=/opt/csw/lib --infodir=/opt/csw/share/info --i\
ncludedir=/opt/csw/include --mandir=/opt/csw/share/man --enable-cloog-backend=isl --enable-java-awt=x\
lib --enable-languages=ada,c,c++,fortran,go,java,objc --enable-libada --enable-libssp --enable-nls --\
enable-objc-gc --enable-threads=posix --program-suffix=-4.7 --with-as=/opt/csw/bin/gas --with-cloog=/\
opt/csw --with-gmp=/opt/csw --with-gnu-as --with-included-gettext --with-ld=/usr/ccs/bin/ld --without\
-gnu-ld --with-libiconv-prefix=/opt/csw --with-mpfr=/opt/csw --with-ppl=/opt/csw --with-system-zlib=/\
opt/csw
Thread model: posix
gcc version 4.7.1 (GCC)
$ /opt/csw/bin/gccgo -g -o hellow helloworld.go
$ /opt/csw/bin/gdb ./hellow

GNU gdb (GDB) 7.2
Copyright (C) 2010 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 "sparc-sun-solaris2.10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>... [^]
Reading symbols from /opt/moto/hobbitserver42/ext/oscount/gccgo/hellow...done.
(gdb) l
34 /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/\
libgo/runtime/go-main.c: No such file or directory.
        in /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7\
.1/libgo/runtime/go-main.c
(gdb)
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0009983)
maciej (reporter)
2012-06-26 16:33

Is this Solaris specific? For instance, does it work on other platforms?
(0009984)
dam (administrator)
2012-06-26 16:51

Works like charm on the buildfarm:

unstable10s% /opt/csw/bin/gccgo -g -o hellow helloworld.go
unstable10s% /opt/csw/bin/gdb ./hellow
GNU gdb (GDB) 7.2
Copyright (C) 2010 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 "sparc-sun-solaris2.10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>... [^]
Reading symbols from /home/dam/tmp/hellow...done.
(gdb) l
34
35 extern void runtime_main (void);
36 static void mainstart (void *);
37
38 /* The main function. */
39
40 int
41 main (int argc, char **argv)
42 {
43 runtime_check ();
(gdb)


It looks like buildfarm-pathes have crept into the binary:

unstable10s% truss -f /opt/csw/bin/gdb ./hellow 2>&1 | grep maciej
8173: stat("/home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/libgo/runtime/go-main.c", 0xFFFFFFFF7FFFE700) = 0
8173: open("/home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/libgo/runtime/go-main.c", O_RDONLY) = 6
8173: resolvepath("/home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/libgo/runtime/", "/home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/libgo/runtime", 1024) = 106
(0009993)
maciej (reporter)
2012-07-01 13:45

I'm wondering why on earth is gdb trying to access libgo/runtime/go-main.c. This file is not installed as part of "make install", so what's the story there?
(0009994)
tjyang (reporter)
2012-07-01 16:50

argh, I now remember gdb 7.2 on windows has similar problem.
the advice from go team was to use gdb 7.4+.

if our case here, "l" failed. But if we do a "l main.main", the source code will be listed like following.

bash-3.00$ /opt/csw/bin/gdb helloworld.go.exe
GNU gdb (GDB) 7.2
Copyright (C) 2010 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 "sparc-sun-solaris2.10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>... [^]
Reading symbols from /opt/moto/hobbitserver42/ext/oscount/gccgo/helloworld.go.exe...done.
(gdb) l
34 /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/libgo/runtime/go-main.c: No such file or directory.
        in /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/gcc-4.7.1/libgo/runtime/go-main.c
(gdb) l main.main
1 package main
2
3 import "fmt"
4
5 func main() {
6 fmt.Println("Hello, World")
7 }(gdb)
Line number 8 out of range; helloworld.go has 7 lines.
(gdb)

So, I guess when CSW's gdb version is upgraded to 7.4+, this problem will be resolved.

BTW, I did another test gdb helloworld.c, CSW gdb 7.2 works fine on listing source of helloworld c binary.
(0010055)
pfelecan (manager)
2012-07-25 09:01

The freshly released package of gdb 7.41 should solve this issue.
(0010060)
tjyang (reporter)
2012-07-27 18:36

Thanks, gdb-4.1 works ok to list out source code if I do a "list main.main".

Except following message

   /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-i386/build-isa-pentium_pro/gcc-4.7.1/libgo/runtime/proc.c: No such file or directory.


-bash-4.1$ gccgo -g -o hello.bin helloworld.go
-bash-4.1$ gdb hello.bin
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 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 "i386-pc-solaris2.10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>... [^]
Reading symbols from /export/home/gobuild/hello.bin...done.
(gdb) l
34 /home/maciej/src/opencsw/pkg/gcc4/trunk/work/solaris10-i386/build-isa-pentium_pro/gcc-4.7.1/libgo/runtime/go-main.c: No such file or directory.
(gdb) l main.main
1 package main
2
3 import "fmt"
4
5 func main() {
6 fmt.Println("Hello, World")
7 }
(gdb) q
-bash-4.1$ uname -a
SunOS b-solaris11-amd64 5.11 11.0 i86pc i386 i86pc
-bash-4.1$ date
Friday, July 27, 2012 11:31:46 AM CDT
-bash-4.1$
(0010061)
pfelecan (manager)
2012-07-27 18:55

I'm afraid that this is an issue with gccgo packaging. Tickling that package maintainer is an option... Bring up this issue on the maintainers list.


Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker