-
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
Feature request: dump byte slice memory contents into file #3706
Labels
Comments
aarzilli
added a commit
to aarzilli/delve
that referenced
this issue
May 8, 2024
Change the examinemem command to have a new format 'raw' that just prints the raw memory bytes. Change the transcript command to add a new flag that disables prompt echo to the output file. Fixes go-delve#3706
aarzilli
added a commit
to aarzilli/delve
that referenced
this issue
May 13, 2024
Change the examinemem command to have a new format 'raw' that just prints the raw memory bytes. Change the transcript command to add a new flag that disables prompt echo to the output file. Fixes go-delve#3706
aarzilli
added a commit
to aarzilli/delve
that referenced
this issue
May 14, 2024
Change the examinemem command to have a new format 'raw' that just prints the raw memory bytes. Change the transcript command to add a new flag that disables prompt echo to the output file. Fixes go-delve#3706
aarzilli
added a commit
to aarzilli/delve
that referenced
this issue
May 15, 2024
Change the examinemem command to have a new format 'raw' that just prints the raw memory bytes. Change the transcript command to add a new flag that disables prompt echo to the output file. Fixes go-delve#3706
aarzilli
added a commit
to aarzilli/delve
that referenced
this issue
May 23, 2024
Change the examinemem command to have a new format 'raw' that just prints the raw memory bytes. Change the transcript command to add a new flag that disables prompt echo to the output file. Fixes go-delve#3706
aarzilli
added a commit
to aarzilli/delve
that referenced
this issue
Jun 20, 2024
Change the examinemem command to have a new format 'raw' that just prints the raw memory bytes. Change the transcript command to add a new flag that disables prompt echo to the output file. Fixes go-delve#3706
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[Using dlv 1.22.1]
Recently, I had to debug a number of failing Go batch pipelines. Because of how these pipelines are structured, it is prohibitively complicated to run them locally, so all I had was a core dump.
With a running program, I would expect
call os.WriteFile("/tmp/b.bin", b, 0600)
to write the contents of the byte sliceb
to/tmp/b.bin
. Unfortunately this didn’t actually work in my test, but that’s probably worth a separate issue:Anyway, because I only have a core dump, I needed to find another way to dump the contents.
Luckily, I found https://www.youtube.com/watch?v=sV5f1dF8ZU0, which explains how to display the Go slice header:
With the memory address and element count, we can try to display the slice contents:
I removed the 1000 bytes check from the code:
Now, dlv lets me print the memory contents, which I can redirect into a file using the
transcript
command:However, dlv’s current format is not compatible with
xxd -r
, so would require further work to turn from hex back to binary.I found it easier to modify dlv’s printing:
With this modification, dlv will print like so:
…and then I can use
xxd -r /tmp/b.hex > /tmp/b.bin
(after deleting the command itself from /tmp/b.hex).My feature request is for a command built into delve which can dump memory into a file. It would be tremendously useful and is rather hard to accomplish today (see above).
Thanks
The text was updated successfully, but these errors were encountered: