
On Mon, 2012-07-23 at 23:26 +1000, Russell Coker wrote:
I have a multi-threaded program that has just SEGV'd. I want to extract a chunk of data from the program to run in a test program to try and reproduce the problem.
Is there a way of telling gdb to dump a chunk of data to a file?
The data in question is a regular C string. I tried using p fopen() but it seems that you can't do that sort of thing in a multi-threaded program. p open() fails and I can't work out why.
(gdb) help set logging Set logging options List of set logging subcommands: set logging file -- Set the current logfile set logging off -- Disable logging set logging on -- Enable logging set logging overwrite -- Set whether logging overwrites or appends to the log file set logging redirect -- Set the logging output mode (gdb) set logging file junk.gdb (gdb) set logging on Copying output to junk.gdb. (gdb) print "1234" $1 = "1234" (gdb) q $ cat junk.gdb $1 = "1234" See also help dump in gdb Current gdb can also use python to examine internal state