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

cmd/asm: assembly language debugging with gdb broken in master tip #25191

Closed
billotosyr opened this issue Apr 30, 2018 · 6 comments
Closed

cmd/asm: assembly language debugging with gdb broken in master tip #25191

billotosyr opened this issue Apr 30, 2018 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@billotosyr
Copy link

Please answer these questions before submitting your issue. Thanks!

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

master tip

Does this issue reproduce with the latest release?

No -- I can debug assembly in 1.10.1 and earlier releases

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

Linux (Ubuntu 16.04)

What did you do?

Tried to debug assembly on both AMD64 and s390x

If possible, provide a recipe for reproducing the error.

cd /src/golang.org/x/crypto/curve25519
go test -c
gdb curve25519.test
break ladderstep_amd64.s:18

What did you expect to see?

break ladderstep_amd64.s:18
Breakpoint 1 at 0x4e6eaa: file
/src/golang.org/x/crypto/curve25519/ladderstep_amd64.s, line 18.

What did you see instead?

No source file named ladderstep_amd64.s

NOTES:
version of gdb:
gdb -v
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
(on both s390x and AMD64)

I also couldn't step into an assembly function from a go language file. Again, this works fine on go1.10.1 and earlier releases.

@randall77
Copy link
Contributor

@dr2chase

@dr2chase
Copy link
Contributor

dr2chase commented May 1, 2018

Will look, I wonder if this has something to do with inlining changes because I made a point of (in theory) not modifying the assembly language pass.

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 1, 2018
@andybons andybons added this to the Go1.11 milestone May 1, 2018
@gopherbot
Copy link

Change https://golang.org/cl/110816 mentions this issue: cmd/link: let writelines work when pcstmt symbol doesn't exist

gopherbot pushed a commit that referenced this issue May 2, 2018
The assembler does not produce pcstmt symbols, writeline should be able
to work even if no pcstmt symbol exists for a given function.

Fixes #25216, #25191

Change-Id: I41e16df1e7c8ca59d27e7514537609e309a51c51
Reviewed-on: https://go-review.googlesource.com/110816
Reviewed-by: David Chase <drchase@google.com>
@erifan
Copy link

erifan commented May 4, 2018

I have pulled the change https://golang.org/cl/110816, but I still can't make a breakpoint in an assembly file and see the assembly code.
What I did:
$cd math/big
$go test -c
$gdb ./big.test
(gdb) b arith_arm64.s : 34
(gdb) r -test.run ^$ -test.bench markAddVV
What I expected to see:
The program paused at arith_arm64.s line 34.
What I see instead:
[Inferior 1 (process 23459) exited normally]

If I make the breakpoints like this: b math/big.addVV, then the program will paused at the entry of function big.addVV, however I can't see the code of addVV but the Go code of the caller of big.addVV.
Besides, I use gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1

@dr2chase
Copy link
Contributor

dr2chase commented May 5, 2018

The bug is in link/internal/ld/dwarf.go, fixed here https://go-review.googlesource.com/c/go/+/102435/25/src/cmd/link/internal/ld/dwarf.go as part of a much larger CL. The code that thought it had to reset is_stmt to 1 after each function was wrong-headed, and thus would (I think, have not verified this exactly) disable the is_stmt flag for every second function in an asm file.

@ianlancetaylor
Copy link
Contributor

This seems to be working now, so closing. Please comment if you disagree.

@golang golang locked and limited conversation to collaborators Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants