From: "Rob Quill" <rob.quill@gmail.com>
To: gdb@sourceware.org
Subject: Re: step through entire file, saving each line to file?
Date: Fri, 23 Feb 2007 11:49:00 -0000 [thread overview]
Message-ID: <baf6008d0702221610j6853cc09g3a000d6052426603@mail.gmail.com> (raw)
In-Reply-To: <baf6008d0702221609k5ecce4e7vb9bdd6cb39581872@mail.gmail.com>
On 22/02/07, Dexter Riley <edbeaty@charter.net> wrote:
>
> hello! I'd like to step through an entire program, and dump each executed
> line fo file. I can do
> gdb myprogram > tee savefile
> (gdb)display/i $pc
> (gdb)start
> (gdb)si
>
> and it displays the currently executed line. I'd like the equivalent of
> typing si multiple times; trying
> (gdb) si 1000
> apparently steps through 1000 lines and shows me THAT line.
>
> Is there some nifty si or shell trick to do this? Sorry for the newbie
> question, but any help would be greatly appreciated.
You should be able to write a GDB command file to do it. I think this
should work:
myprogram > tee savefile
display/i $pc
start
# Loop while the program hasn't finished
while($_exitcode == (void *)0)
{
si
}
Although I haven't tested that, but if it is not that it is something
close. You can read up on command files in the manual, but basically,
write a file with the above in, then run GDB with the -x option.
eg: gdb myprogram -x myscript
Hopefully that will work. Appologies if I'm wrong, it's been a long
day of memory leak fixing :(
Rob
> Thanks very much,
> dexter
> --
> View this message in context: http://www.nabble.com/step-through-entire-file%2C-saving-each-line-to-file--tf3275680.html#a9109689
> Sent from the gdb - General mailing list archive at Nabble.com.
>
>
prev parent reply other threads:[~2007-02-23 0:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-23 7:05 Dexter Riley
[not found] ` <baf6008d0702221609k5ecce4e7vb9bdd6cb39581872@mail.gmail.com>
2007-02-23 11:49 ` Rob Quill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=baf6008d0702221610j6853cc09g3a000d6052426603@mail.gmail.com \
--to=rob.quill@gmail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox