From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jan.kratochvil@redhat.com
Cc: msnyder@vmware.com, gdb-patches@sourceware.org
Subject: Re: [RFA] i386-tdep.c, check target_read_memory for error.
Date: Sun, 06 Mar 2011 17:00:00 -0000 [thread overview]
Message-ID: <201103061455.p26Etppr028003@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <20110306141515.GA1895@host1.jankratochvil.net> (message from Jan Kratochvil on Sun, 6 Mar 2011 15:15:16 +0100)
> Date: Sun, 6 Mar 2011 15:15:16 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> On Fri, 04 Mar 2011 22:37:52 +0100, Michael Snyder wrote:
> > Call error if target_read_memory fails.
> [...]
> > - target_read_memory (pc, &op, 1);
> > + if (target_read_memory (pc, &op, 1))
> > + error (_("Couldn't read memory at pc (%s)"),
> > + paddress (gdbarch, pc));
>
> There is the function `read_memory' for such purpose.
But read_memory() will throw an exception if reading fails. That is
not necessarily what we want here. In fact, most of these reads
should silently fail. They are part of the prologue analysis code,
which to some of extent is based on heuristics. And one of the
heristics here is that if we fail to read an instruction at a certain
address, we're no longer looking at a function prologue. Higher level
code will try an alternative strategy or issue an error message.
Spamming the user with more error messages isn't going to be terribly
helpful.
But Michael is right that there is an issue here. The code is relying
on uninitialized stack variables not matching the specific opcodes we
check against. I think most of the:
target_read_memory(pc, &op, 1);
statements, should be replaced with
if (target_read_memory(pc, &op, 1))
return pc;
Cheers,
Mark
next prev parent reply other threads:[~2011-03-06 14:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 21:38 Michael Snyder
2011-03-06 14:56 ` Jan Kratochvil
2011-03-06 17:00 ` Mark Kettenis [this message]
2011-03-06 22:34 ` Michael Snyder
2011-03-08 2:35 ` Mark Kettenis
2011-03-08 18:47 ` Michael Snyder
2011-03-08 18:59 ` Mark Kettenis
2011-03-08 19:27 ` Pedro Alves
2011-03-08 19:41 ` Mark Kettenis
2011-03-08 19:50 ` Pedro Alves
2011-03-09 1:32 ` Michael Snyder
2011-03-06 18:48 ` Michael Snyder
2011-03-06 19:00 ` Jan Kratochvil
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=201103061455.p26Etppr028003@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=msnyder@vmware.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