-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: can't break on inlined function #28603
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
Comments
From my experience working with C compilers, one sees the same thing there when optimization is enabled. For example with this program:
if I compile with tip clang, there is no trace of "f" left in the DWARF. GCC does slightly better in that it generates a subprogram DIE for "f", but since there are no longer any instructions from "f", you can't set a breakpoint on it. At the moment the Go compiler is doing the same thing-- if there aren't any remaining instructions (defined in some loose sense) from the original inlined routine, it is not going to turn up in the DWARF. |
As far as I can tell, inlined functions that have instructions that end up in the binary, still don't work. For Go:
and C
There's a shl $8 instruction in both binaries, but I can't |
I tried the shift example with tip GCC and GDB 7.x and it works for me:
This is obviously not very helpful to you, however. With this sort of debug info generation (e.g. with other optimizations turned on) it's a very "best effort only" scenario. If things get optimized "too much" (whatever that is) then the DWARF disappears or gets degraded. |
Ah, I forgot the |
Note that although you can't break at the name, you can break at the line number. |
Change https://golang.org/cl/177697 mentions this issue: |
Update #28603 Change-Id: I8bdbea57b3661e15dcc760d27252b794daa476db Reviewed-on: https://go-review.googlesource.com/c/go/+/177697 Reviewed-by: Emmanuel Odeke <[email protected]>
Duplicate of #26206 |
What version of Go are you using (
go version
)?(latest master)
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Attempt to set a breakpoint on an inlined function.
E.g., paste https://play.golang.org/p/rDXmoTUZKJb in to
bp.go
and runWhat did you expect to see?
I expected to be able to set a breakpoint on
main.f
like I could onmain.main
. In C/C++, this would cause gdb to set a breakpoint on every location the function was inlined to.What did you see instead?
main.f
is completely missing from the debug info, so GDB is unable to set the breakpoint./cc @randall77 @thanm
The text was updated successfully, but these errors were encountered: