-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
breakpoints inside multi-line var declaration are unsafe #83
Comments
Sure enough, thanks for reporting this. @epipho would you have any interest in looking into this? You've taken an interest in the variable evaluation side of things and had some great commits. If not, I'll start digging into it. The following snippet will reproduce this: func main() {
foo := `
i
am a
multiline
string
`
fmt.Println(foo)
} Setting a breakpoint right at |
I have run into this before. The bad news is I am not sure what we can do about it as I don't think there is any information in the binary. Instead of a location expression for the variable location I would expect a location list (http://www.dwarfstd.org/doc/dwarf-2.0.0.pdf section 2.4.6) that would give a set of instruction ranges that the variable is valid for but the binary does not contain a .debug_loc section. The same problem exists for code that shadows variables
This actually generates two variables, and there does not appear to be any way to disambiguate them.
Thoughts? |
@epipho that's unfortunate. I don't see a clear fix other than patching the linker(s) to emit the |
This weekend I will dig through the go issue tracker to see if this has been brought up. I wonder what the complexity of the change would be to add .debug_log to the linker. |
@epipho not sure, but I know there's a lot going on with the compiler / linker rewrites. I'll likely post something on golang-dev about this and another Dwarf tag I'd like the linker to emit in the .debug_info section. A cursory glance through the issue tracker didn't reveal any existing issues surrounding this, but if you dive deeper and find anything definitely let me know. |
Which additional tags are you hoping for? For our purposes it might be nice On Thu, Mar 12, 2015 at 2:51 PM, Derek Parker notifications@github.com
|
I don't know if this is related, but after continued testing I get erratic behavior similar to what I reported above, but also on completely valid source lines. For example, breaking in the following function at
However, by uncommenting the |
Btw, I get identical behavior in the above example on both darwin and linux (vbox image). |
@epipho DW_OP_form_tls_address would be nice for getting at the G(oroutine) in thread local storage, since @ivarg that's interesting... I'll try and play around with that example and check out the asm / debug info it generates, may be clues there. Not sure why a1 would be uninitialized in that example without that erroneous println call. |
Turns out I forgot to build with optimizations disabled. Building with |
@ivarg no worries, that makes sense. I'll still look into it a bit to see how feasible it would be for Delve to handle programs built without -N. FWIW |
Yes, when testing I just |
The new contents of api.Variable are documented in service/api/types.go. Additionally evaluating an ambiguous variable name will yeld the values of all variables that name (see issues Implements go-delve#243, Workaround for go-delve#186, go-delve#106, go-delve#83
The new contents of api.Variable are documented in service/api/types.go. Additionally evaluating an ambiguous variable name will yeld the values of all variables that name (see issues Implements go-delve#243, Workaround for go-delve#186, go-delve#106, go-delve#83
The new contents of api.Variable are documented in service/api/types.go. Additionally evaluating an ambiguous variable name will yeld the values of all variables that name (see issues go-delve#186, go-delve#106, go-delve#83) Implements go-delve#243, Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83 # Conflicts: # proc/eval.go # proc/proc_test.go
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83 # Conflicts: # proc/eval.go # proc/proc_test.go
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83 # Conflicts: # proc/eval.go # proc/proc_test.go
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83 # Conflicts: # proc/eval.go # proc/proc_test.go
Evaluating an ambiguous variable results in an empty variable being returned with all the possible definitions as children. To disambiguate between the definitions of a variable use 0(varname), 1(varname), etc Workaround for go-delve#186, go-delve#106, go-delve#83 # Conflicts: # proc/eval.go # proc/proc_test.go
As far as I can tell this is not unsafe anymore. |
It is possible to set a breakpoint in a multi-line variable declaration, at which point the variables have not yet been initialized. Calling
info locals
at that point will render undefined behavior and may result in a panic.The text was updated successfully, but these errors were encountered: