From: Siva Chandra <sivachandra@google.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] - Exposing find_pc_line through Python API
Date: Tue, 08 May 2012 02:35:00 -0000 [thread overview]
Message-ID: <CAGyQ6gzU1uRuWLJtAzJO9_ve1VZ5L0DC47X5cMYck66JzwuamA@mail.gmail.com> (raw)
In-Reply-To: <8362c73huz.fsf@gnu.org>
Siva> +The difference between @var{actual} being @code{True} or @code{False}
Siva> +can be illustrated with an example. Let a call to a function @code{func}
Siva> +be on line 20 in a C source file as
Siva> +
Siva> +@smallexample
Siva> +18 ...
Siva> +19
Siva> +20 func ();
Siva> +21
Siva> +22 return 0;
Siva> +23
Siva> +24 ...
Siva> +@end smallexample
Siva> +
Siva> +After executing @value{GDBN} commands @code{step} followed by @code{up}
Siva> +at line 20, the actual value of the @code{PC} register should correspond
Siva> +to the next code line at line 22. However, since the function
Siva> +@code{func} has not yet been executed, the user feels that the execution
Siva> +is still at line 20 (the call site) in the caller.
Eli> If I were that user, I would "feel" that the execution is at the first
Eli> line (or maybe in the prologue) of 'func', since PC is (in my mind)
Eli> unaffected by commands that walk the call stack. And if you are
Eli> talking about the value of PC saved in the frame of the caller of
Eli> 'func', then saying that line 22 is the "actual" location is again
Eli> confusing, because execution did not yet reach that point.
Not just the PC saved in the frame of the caller of 'func', even $pc
will have the same value. If after a 'step' and 'up' you do 'print /d
$pc', it will print the same value as
(gdb) python print gdb.selected_frame().pc()
Eli> So I have hard time understanding why we need the distinction. And
Eli> since you say that the current Symtab_and_line.line gives the second
Eli> alternatives, I'm confused even more.
I do not understand myself why the second alternative was selected to
reflect in Symtab_and_line.line.
Eli> It's possible that I'm the only confused person here, but in that
Eli> case, at least the example should be fixed to show and explain the
Eli> distinction more clearly and unequivocally, and also in which
Eli> situations the "actual" value is useful.
I am working on something for which I need to know the last function
call on a particular source line. The heuristic I am trying to use is
that, when we 'step' in and out (via 'up') of the last function call,
the PC should correspond to the next source line and not the call site
of the last function call.
Thanks,
Siva Chandra
next prev parent reply other threads:[~2012-05-08 2:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-07 18:11 Siva Chandra
2012-05-07 19:36 ` Eli Zaretskii
2012-05-08 2:35 ` Siva Chandra [this message]
2012-05-09 7:35 ` Siva Chandra
2012-05-09 20:05 ` Eli Zaretskii
2012-05-10 21:16 ` Doug Evans
2012-05-11 16:35 ` Siva Chandra
2012-05-11 18:14 ` Doug Evans
2012-05-13 11:37 ` Siva Chandra
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=CAGyQ6gzU1uRuWLJtAzJO9_ve1VZ5L0DC47X5cMYck66JzwuamA@mail.gmail.com \
--to=sivachandra@google.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@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