public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Martin Galvan <martin.galvan@tallertechnologies.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Python API: Add gdb.is_in_prologue and gdb.is_in_epilogue.
Date: Wed, 22 Oct 2014 19:23:00 -0000	[thread overview]
Message-ID: <21576.1088.684481.249056@ruffy.mtv.corp.google.com> (raw)
In-Reply-To: <1413986485-4673-1-git-send-email-martin.galvan@tallertechnologies.com>

Martin Galvan writes:
 > Added two new functions to the Python API: gdb.is_in_prologue and gdb.is_in_epilogue.
 > These expose the in_prologue and gdbarch_in_function_epilogue_p functions
 > respectively, which are useful for checking if the values of local variables are
 > valid when single-stepping through machine instructions.
 > 
 > Also added tests for gdb.is_in_prologue only. The reason of this is that
 > the tests work by checking the first instruction of a given function, as that's
 > conventionally part of the prologue. Testing gdb.is_in_epilogue seems to be
 > architecture-dependant (for instance, the last instruction of a function is
 > reported as part of an epilogue by gdbarch_in_function_epilogue_p for ARM,
 > but not always for x86_64), so I didn't include a test for it.

Hi.

We should have a test for is_in_epilogue anyway.
The canonical choice is to just make it amd64-linux specific.

API functions like these are problematic.
Users don't expect API functions to be heuristic-based,
and that is all these can ever be in the general case.
The patch does try to provide the user some guarantees
("however if the result is @code{False} you can be sure
@value{GDBN} is right."),
but it's not clear to me this will be true in the general case.
I may have missed something so I'm certainly willing to be
persuaded otherwise.
I might be ok with this patch if the functions were named something like
"maybe_is_in_prologue" and "maybe_is_in_epilogue".
That way they scream to the user (and future code readers) "Heads Up!"

  parent reply	other threads:[~2014-10-22 19:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 14:02 Martin Galvan
2014-10-22 15:10 ` Eli Zaretskii
2014-10-22 15:14   ` Martin Galvan
2014-10-22 17:33   ` Martin Galvan
2014-10-22 17:47     ` Eli Zaretskii
2014-10-22 18:06       ` Martin Galvan
2014-10-22 18:07       ` Eli Zaretskii
2014-10-22 18:32         ` Martin Galvan
2014-10-22 18:37           ` Eli Zaretskii
2014-10-22 19:23 ` Doug Evans [this message]
2014-10-22 21:34 ` Pedro Alves
2014-10-22 21:59   ` Pedro Alves
2014-10-23 17:36     ` Martin Galvan
2014-10-23 17:57       ` Ulrich Weigand
2014-10-23 18:09         ` Martin Galvan
2014-10-23 18:14           ` Daniel Gutson
2014-10-24  2:42             ` Doug Evans
2014-10-24 14:58         ` Pedro Alves
2014-10-24  4:57       ` Doug Evans
2014-10-24 15:02         ` Pedro Alves
2014-10-24 15:34           ` Ulrich Weigand
2014-10-24 15:47             ` Doug Evans
2014-10-24 14:57       ` Pedro Alves
2014-10-24 15:13         ` Ulrich Weigand
2014-11-07 14:45           ` [push] Revert old nexti prologue check and eliminate in_prologue Pedro Alves
2014-10-24 19:49         ` [PATCH] Python API: Add gdb.is_in_prologue and gdb.is_in_epilogue Martin Galvan
2014-10-24 20:09           ` Pedro Alves
2014-10-24 21:11             ` Martin Galvan
2014-10-24 22:34               ` Pedro Alves
2014-10-27 16:40                 ` Martin Galvan

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=21576.1088.684481.249056@ruffy.mtv.corp.google.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=martin.galvan@tallertechnologies.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).