-
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
panic: runtime error: index out of range #215
Comments
Thanks, any chance I could get a copy of the source code you're debugging so I can try and reproduce locally? |
Unfortunately, I don't have right to make it public as my company owns this program, and it does not belong to me. Please let me know if you need further information. |
I can reproduce, but unfortunately can't share my code either. I modified delve to print out how big a slice it's asking for when diff --git a/proc/variables.go b/proc/variables.go
index 4cf87ab..0469999 100644
--- a/proc/variables.go
+++ b/proc/variables.go
@@ -593,6 +593,7 @@ func (thread *Thread) readString(addr uintptr) (string, error) {
return "", nil
}
+ fmt.Printf("Strlen: %s\n", strlen)
val, err = thread.readMemory(addr, strlen)
if err != nil {
return "", fmt.Errorf("could not read string at %#v due to %s", addr, err) When my program breaks, I run
happy to help debug more. |
Hi I was kind of bored so I did some investigation. as it turns out: Fortunately I could reproduce this bug with my sms gateway, github.com/haxpax/gosms/dashboard, I have pushed to delve branch there, use that for debugging if required. It won't be reproduced in master branch of that project since first line in main is not blocking. I also wrote a tiny debug program where I could not reproduce this, and later diff'ed with gosms as it turns out, its not guaranteed that the filename will always be the first part upto first 0x0 in debug_line section. I suppose we need to implement a deterministic approach to extract filename to solve this issue I'd be happy to do it but I'll need help, some pointers as to how to do it and some cross platform testing as I only have Ubuntu available at the moment. |
@Omie thanks for your work! I was able to reproduce this on a Linux VM with Go 1.5 using the Delve branch. I cannot reproduce on OSX, so seems to be an issue with ELF binaries. I'm going to investigate a bit more. |
Tracking it down a bit further it seems to be a problem with CGO binaries on Linux with Go 1.5. The Go 1.5 compiler on Linux when compiling a CGO binary seems to omit the file name table in the .debug_line section. |
spent some time more on this. Looks like it doesn't omit the file name table but prepends a lot of C stuff in header. It grew when I added stdio import. ref: https://github.com/Omie/delve_215/raw/master/c/hello.debuglines couldn't find any pattern to distinguish C related part in debug_line yet |
@Omie yeah you're right, there's multiple file directories in the elf .debug_line section, so with that in mind this is related to https://github.com/derekparker/delve/issues/143. Delves needs to be able to handle multiple file tables / directory tables. |
@derekparker okay. I have some time that I wouldn't mind spending on this, could you share what have you thought about splitting the package? we can switch to mail if needed, address is in profile :) |
@Omie just mailed you my thoughts on this. Thanks for your help! |
yup! will continue there. |
Thanks. I have verified the bug is gone by #218. |
Hi,
Delve crashes when I run it and execute 'next' on the breakpoint 'main.main'. My environments are as follows:
Here is the logs:
The text was updated successfully, but these errors were encountered: