[bug-notifications] [gdb 0004967]: Can't use gdb to list out source code from gccgo compiled binary with -g option

Mantis Bug Tracker noreply at opencsw.org
Sun Jul 15 14:56:45 CEST 2012


The following issue has been ASSIGNED. 
====================================================================== 
https://www.opencsw.org/mantis/view.php?id=4967 
====================================================================== 
Reported By:                tjyang
Assigned To:                pfelecan
====================================================================== 
Project:                    gdb
Issue ID:                   4967
Category:                   regular use
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             2012-06-26 16:23 CEST
Last Modified:              2012-07-15 14:56 CEST
====================================================================== 
Summary:                    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
$


====================================================================== 

---------------------------------------------------------------------- 
 (0009994) tjyang (developer) - 2012-07-01 16:50
 https://www.opencsw.org/mantis/view.php?id=4967#c9994 
---------------------------------------------------------------------- 
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.



More information about the bug-notifications mailing list