This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: How to print the current source line number
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Rodrigo Dominguez <roddomi at hotmail dot com>
- Cc: gdb at sourceware dot org
- Date: Fri, 15 May 2009 18:19:42 +0200
- Subject: Re: How to print the current source line number
- References: <BAY109-DS599503F3B9065FC87CBA7B95F0@phx.gbl>
> How can I print the current source line number in gdb? I have tried the
> 'list' command and it shows the lines around the current line. However, this
> command has "memory" and doesn't show the same lines each time it is
> executed. Is there a better way to print the current line number? Or is
> there a way to "reset" the memory of the 'line' command so it will show the
> current line centered around the output?
If it's the contents of the current line that you're interested in,
have a look at "help list". Otherwise, "frame" or "info line" might
be what you're looking for. Hint: "$pc" is a convenience variable that
contains the current PC.
--
Joel