-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
'regs' does not show selected frame registers. #1838
Comments
@klauspost This is not problem of dlv.
I test it. It is because cpu execute
|
In pratice most frames won't have any registers except the stack and frame pointers. This frame would be an exception because of the context pushed on the stack for the signal handler, but we don't parse that at the moment. |
@aarzilli That is probably what I was expecting. All other debuggers I have worked with will display registers at any given frame. Obviously, this makes assembly debugging quite hard since registers will have been overwritten with random data.
That sentence doesn't make sense to me. Most Go code uses registers.
@chainhelen Yes, that is my point. If it doesn't fail, just increase 2000000. My point is also that this is still reported wrong above, and you don't address the main issue. |
Go doesn't track where registers are saved on the stack (besides the stack pointer) so most frames will not have any registers. |
@aarzilli Ah, now I get what you mean. I do still think it is quite important to reliably see what registers were when a crash occurs. |
Example:
I have a crash, but I am unable to see the values in the registers at the time of the crash. So I basically have no information available. Also the crash is actually at the line below (CMPL) |
I'd think this would be generally useful for panics, especially in optimized binaries with location lists. I think @aarzilli pointed to this, but to be explicit: It should be possible to recover the registers in at least some circumstances. On Linux it'd be the ctxt argument to sigtrampgo: https://github.com/golang/go/blob/67f0f83216930e053441500e2b28c3fa2b667581/src/runtime/signal_unix.go#L403 On Windows it looks like https://github.com/golang/go/blob/6dbcc8b8651909442ff823231daba096f447a163/src/runtime/signal_windows.go#L104 messes with things badly enough that it would be hard to do. It seems easy enough to add a sigctxt field somewhere (maybe the m?) and have all the OS handlers fill that in with whatever the platform-specific context structure is. Please feel free to file an issue if that'd help. |
A significant amount of time is spent generating the string representation for the proc.Registers object of each thread, since this field is rarely used (only when the Registers API is called) it should be generated on demand. Also by changing the internal representation of proc.Register to be closer to that of op.DwarfRegister it will help us implement go-delve#1838 (when Delve will need to be able to display the registers of an internal frame, which we currently represent using op.DwarfRegister objects). Benchmark before: BenchmarkConditionalBreakpoints-4 1 22292554301 ns/op Benchmark after: BenchmarkConditionalBreakpoints-4 1 17326345671 ns/op Reduces conditional breakpoint latency from 2.2ms to 1.7ms. Updates go-delve#1549, go-delve#1838
A significant amount of time is spent generating the string representation for the proc.Registers object of each thread, since this field is rarely used (only when the Registers API is called) it should be generated on demand. Also by changing the internal representation of proc.Register to be closer to that of op.DwarfRegister it will help us implement go-delve#1838 (when Delve will need to be able to display the registers of an internal frame, which we currently represent using op.DwarfRegister objects). Benchmark before: BenchmarkConditionalBreakpoints-4 1 22292554301 ns/op Benchmark after: BenchmarkConditionalBreakpoints-4 1 17326345671 ns/op Reduces conditional breakpoint latency from 2.2ms to 1.7ms. Updates go-delve#1549, go-delve#1838
A significant amount of time is spent generating the string representation for the proc.Registers object of each thread, since this field is rarely used (only when the Registers API is called) it should be generated on demand. Also by changing the internal representation of proc.Register to be closer to that of op.DwarfRegister it will help us implement #1838 (when Delve will need to be able to display the registers of an internal frame, which we currently represent using op.DwarfRegister objects). Benchmark before: BenchmarkConditionalBreakpoints-4 1 22292554301 ns/op Benchmark after: BenchmarkConditionalBreakpoints-4 1 17326345671 ns/op Reduces conditional breakpoint latency from 2.2ms to 1.7ms. Updates #1549, #1838
Adds an optional scope prefix to the `regs` command which allows printing registers for any stack frame (as long as they were somehow saved). Issue go-delve#1838 is not yet to be closed since we are still not recovering the registers of a segfaulting frame. Updates go-delve#1838
A significant amount of time is spent generating the string representation for the proc.Registers object of each thread, since this field is rarely used (only when the Registers API is called) it should be generated on demand. Also by changing the internal representation of proc.Register to be closer to that of op.DwarfRegister it will help us implement go-delve#1838 (when Delve will need to be able to display the registers of an internal frame, which we currently represent using op.DwarfRegister objects). Benchmark before: BenchmarkConditionalBreakpoints-4 1 22292554301 ns/op Benchmark after: BenchmarkConditionalBreakpoints-4 1 17326345671 ns/op Reduces conditional breakpoint latency from 2.2ms to 1.7ms. Updates go-delve#1549, go-delve#1838
…#1875) Adds an optional scope prefix to the `regs` command which allows printing registers for any stack frame (as long as they were somehow saved). Issue go-delve#1838 is not yet to be closed since we are still not recovering the registers of a segfaulting frame. Updates go-delve#1838
A significant amount of time is spent generating the string representation for the proc.Registers object of each thread, since this field is rarely used (only when the Registers API is called) it should be generated on demand. Also by changing the internal representation of proc.Register to be closer to that of op.DwarfRegister it will help us implement go-delve#1838 (when Delve will need to be able to display the registers of an internal frame, which we currently represent using op.DwarfRegister objects). Benchmark before: BenchmarkConditionalBreakpoints-4 1 22292554301 ns/op Benchmark after: BenchmarkConditionalBreakpoints-4 1 17326345671 ns/op Reduces conditional breakpoint latency from 2.2ms to 1.7ms. Updates go-delve#1549, go-delve#1838
…#1875) Adds an optional scope prefix to the `regs` command which allows printing registers for any stack frame (as long as they were somehow saved). Issue go-delve#1838 is not yet to be closed since we are still not recovering the registers of a segfaulting frame. Updates go-delve#1838
Please answer the following before submitting your issue:
Note: Please include any substantial examples (debug session output,
stacktraces, etc) as linked gists.
dlv version
)?Latest master.
go version
)?go version go1.13.6 windows/amd64
windows/amd64
Reproduction sample: repro.zip
Run the sample. Crash occurs. We switch to the frame causing the crash (3). Print registers.
RAX to be 0. Note the
XORQ AX, AX
before the crash was invoked.Also the instruction pointed to is wrong. There is AFAIK no way for
LEAQ
to fail.RAX shows the registers at frame 0 as far as I can tell.
Thanks for a great tool!
The text was updated successfully, but these errors were encountered: