Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/debug: setting debug breakpoints by file/line broken #25715

Closed
fabxc opened this issue Jun 4, 2018 · 5 comments
Closed

x/debug: setting debug breakpoints by file/line broken #25715

fabxc opened this issue Jun 4, 2018 · 5 comments
Labels
Debugging FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@fabxc
Copy link

fabxc commented Jun 4, 2018

  • go1.10.2
  • linux/amd64

I tried to setup the GCP cloud debugger for a Go application but it fails to set breakpoints with: error setting breakpoint at scrape/scrape.go:818: couldn't find file "scrape/scrape.go".

I reproduced this locally by loading a compiled Go program with golang.org/x/debug/local.New. Calling Program.BreakpointAtLine("scrape/scrape.go", 818) fails with the same error. Using more specific paths (e.g. full file path at compile time) does not change anything.
Setting a breakpoint directly through symbol name with Program.BreakpointAtFunction works.

When re-compiling the debugged program with go1.9, BreakpointAtLine works without issues again.
In both cases the binary was compiled with -gcflags='-N -l' and CGO_ENABLED=0.

This blog post reported a similar problem some time ago. I could not find a matching issue though.

@heschi
Copy link
Contributor

heschi commented Jun 4, 2018

I thought this might be the change to DW_AT_comp_dir in CL 74790 but looking at the code for LineToBreakpointPCs that's giving the error, it seems like it should be resilient to that.

https://github.com/golang/debug/blob/cb5e6d581c5b9d2e229187cecb199106564df20e/dwarf/line.go#L47-L94

So I'm not sure offhand. @fabxc, can you put your repro somewhere I can try it?

cc @zombiezen

@heschi heschi changed the title Setting debug breakpoints by file/line broken x/debug: setting debug breakpoints by file/line broken Jun 4, 2018
@gopherbot gopherbot added this to the Unreleased milestone Jun 4, 2018
@fabxc
Copy link
Author

fabxc commented Jun 4, 2018

Thanks for looking into this. The following gist shows a minimal example: https://gist.github.com/fabxc/99c9f81adafda4969deafad94ed14224

@heschi
Copy link
Contributor

heschi commented Jun 4, 2018

Ouch. x/debug/dwarf (this code doesn't exist in pkg/debug/dwarf) assumes that there's only one CU:
https://github.com/golang/debug/blob/cb5e6d581c5b9d2e229187cecb199106564df20e/dwarf/cache.go#L146
and we switched to CU-per-package in 1.10.

Fixing it probably isn't too hard but requires more than a couple minutes of thought to do right.

@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 5, 2018
@fabxc
Copy link
Author

fabxc commented Jul 25, 2018

Seems like any related code was purged from x/debug. So this can probably be closed?

The Go cloud debugger agent vendored the former x/debug and took the bug with it. Any recommendations on how to address the issue there?

@jba
Copy link
Contributor

jba commented Jul 26, 2018

Moving to googleapis/google-cloud-go#1079.

@jba jba closed this as completed Jul 26, 2018
@golang golang locked and limited conversation to collaborators Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Debugging FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants