Skip to content

gdb: can't load debug symbols for cgo in 1.8 #18745

Closed
@JayNakrani

Description

@JayNakrani

What version of Go are you using (go version)?

go1.8rc2

What operating system and processor architecture are you using (go env)?

linux-amd64

What did you do?

Tried debugging a cgo binary compiled with 1.8rc2. gdb can't seem to load debug symbols for it, but works for pure go binary. gdb also works fine in 1.7 for both go and cgo. Here's full matrix.

Version Binary Type gdb works?
1.8rc2 cgo no
1.8rc2 go yes
1.7.3 cgo yes
1.7.3 go yes

dhananjay92/cgo_debug_info has the simple repro code.

$ cd $GOPATH/src/github.com/dhananjay92/cgo_debug_info
$ ./run.sh 	# compiles for all combinations

$ gdb cgo/1.8main
...
(gdb) list
1   go: No such file or directory.
(gdb) info source
No current source file.
(gdb) q

The same works in 1.7 compiled cgo binary.

$ gdb cgo/1.7main 
...
(gdb) list
2	package main
3	
4	import "C"
5	
6	import (
7		"fmt"
8		"github.com/dhananjay92/cgo_debug_info/a"
9	)
10	
11	func main() {
(gdb) info source
Current source file is .../src/github.com/dhananjay92/cgo_debug_info/cgo/main.go
Compilation directory is .../src/github.com/dhananjay92/cgo_debug_info/cgo
Located in .../src/github.com/dhananjay92/cgo_debug_info/cgo/main.go
Contains 13 lines.
Source language is unknown.
Compiled with (null) debugging format.
Does not include preprocessor macro info.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions