From: Keith Seitz <keiths@cygnus.com>
To: Vishal Kulshrestha <vishal@sasken.com>
Cc: gdb@sources.redhat.com
Subject: Re: gdb usage help!
Date: Wed, 11 Apr 2001 06:52:00 -0000 [thread overview]
Message-ID: <Pine.SOL.3.91.1010411064704.14548D-100000@ryobi.cygnus.com> (raw)
In-Reply-To: <Pine.LNX.4.30.0104111555170.16695-100000@pck171.sasi.com>
On Wed, 11 Apr 2001, Vishal Kulshrestha wrote:
> Is there a way of letting gdb print all the source code lines as
> it executes!
Well, yes and no. You could step/next forever until the program exits or
you get a signal/exception. You would need to be careful about stepping
into shared libraries and system calls, etc, but it could be done with a
simple (overly simple?) gdb script:
$ cat test.c
#include <stdio.h>
int
main (int argc, char *argv[])
{
int i;
for (i = 0; i < 10; i++)
{
printf ("i = %d\n", i);
}
exit (0);
}
$ gdb -nw -q test
(gdb) b main
Breakpoint 1 at 0x8048492: file test.c, line 8.
(gdb) r
Starting program: /home/keiths/test
Breakpoint 1, main (argc=1, argv=0xbffffab4) at test.c:8
8 for (i = 0; i < 10; i++)
(gdb) while 1
>next
>f
>end
10 printf ("i = %d\n", i);
#0 main (argc=1, argv=0xbffffab4) at test.c:10
10 printf ("i = %d\n", i);
i = 0
8 for (i = 0; i < 10; i++)
#0 main (argc=1, argv=0xbffffab4) at test.c:8
8 for (i = 0; i < 10; i++)
10 printf ("i = %d\n", i);
#0 main (argc=1, argv=0xbffffab4) at test.c:10
10 printf ("i = %d\n", i);
i = 1
8 for (i = 0; i < 10; i++)
#0 main (argc=1, argv=0xbffffab4) at test.c:8
8 for (i = 0; i < 10; i++)
10 printf ("i = %d\n", i);
#0 main (argc=1, argv=0xbffffab4) at test.c:10
10 printf ("i = %d\n", i);
i = 2
8 for (i = 0; i < 10; i++)
#0 main (argc=1, argv=0xbffffab4) at test.c:8
8 for (i = 0; i < 10; i++)
10 printf ("i = %d\n", i);
#0 main (argc=1, argv=0xbffffab4) at test.c:10
10 printf ("i = %d\n", i);
i = 3
8 for (i = 0; i < 10; i++)
#0 main (argc=1, argv=0xbffffab4) at test.c:8
8 for (i = 0; i < 10; i++)
10 printf ("i = %d\n", i);
#0 main (argc=1, argv=0xbffffab4) at test.c:10
10 printf ("i = %d\n", i);
i = 4
8 for (i = 0; i < 10; i++)
#0 main (argc=1, argv=0xbffffab4) at test.c:8
8 for (i = 0; i < 10; i++)
10 printf ("i = %d\n", i);
---Type <return> to continue, or q <return> to quit---
and so on.
Keith
prev parent reply other threads:[~2001-04-11 6:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-11 4:05 Vishal Kulshrestha
2001-04-11 6:52 ` Keith Seitz [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=Pine.SOL.3.91.1010411064704.14548D-100000@ryobi.cygnus.com \
--to=keiths@cygnus.com \
--cc=gdb@sources.redhat.com \
--cc=vishal@sasken.com \
/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