[bug-notifications] [gcc4core 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 1 16:50:50 CEST 2012

A NOTE has been added to this issue. 
Reported By:                tjyang
Assigned To:                
Project:                    gcc4core
Issue ID:                   4967
Category:                   regular use
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
Date Submitted:             2012-06-26 16:23 CEST
Last Modified:              2012-07-01 16:50 CEST
Summary:                    Can't use gdb to list out source code from gccgo
compiled binary with -g option
The test helloworld.go was compiled and ran ok  by gccgo 4.7.1as shown
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
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
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:
Reading symbols from
(gdb) l
No such file or directory.
(gdb) l main.main
1       package main
3       import "fmt"
5       func main() {
6               fmt.Println("Hello, World")
7       }(gdb)
Line number 8 out of range; helloworld.go has 7 lines.

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