I have a big, long string that I want to capture to a file. I can use logging to get most of the way there:
set logging on set logging file gdb.log
…but if I use p
or x/s
to print the string, quotes and junk are all escaped. How can I get the string as-is?
For a really large string you can also use:
(gdb) set variable $s = MY_STRING
(gdb) dump binary memory FILE $s $s + (size_t)strlen($s)
which can be easily adapted to handle buffers with null bytes. Also the content of FILE would never contain anything other than the string.
Ah, I totally forgot about printf
:
printf "%s\n", some_string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With