From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] More suggestive displaced-stepping memory error message
Date: Tue, 10 Apr 2012 19:55:00 -0000 [thread overview]
Message-ID: <20120410191955.GB31331@host2.jankratochvil.net> (raw)
Hi,
with
gdbserver ld-linux-x86-64.so.2 /bin/prog
and
gdb /bin/prog
in non-stop mode during ld.so initialization happens an error as
displaced-stepping buffer at /bin/prog's _start is not yet available.
Also I think in single-threaded mode displaced-stepping is not useful.
But I understand turning off displaced-stepping if inferior has only one
thread would be too complicating all the troubleshooting.
With all the races and errors I would definitely find this message helpful.
It should at least state the error occured for the displaced-stepping buffer,
not just generic
Cannot access memory at address %s
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
I may check it in on my own without the "you may want .*" part.
Thanks,
Jan
gdb/
2012-04-10 Jan Kratochvil <jan.kratochvil@redhat.com>
Provide more specific displaced-stepping memory error message.
* infrun.c (displaced_step_prepare): New variable status. Call
target_read_memory instead of read_memory, provide more specific
error message.
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1296,6 +1296,7 @@ displaced_step_prepare (ptid_t ptid)
ULONGEST len;
struct displaced_step_closure *closure;
struct displaced_step_inferior_state *displaced;
+ int status;
/* We should never reach this function if the architecture does not
support displaced stepping. */
@@ -1356,7 +1357,13 @@ displaced_step_prepare (ptid_t ptid)
displaced->step_saved_copy = xmalloc (len);
ignore_cleanups = make_cleanup (free_current_contents,
&displaced->step_saved_copy);
- read_memory (copy, displaced->step_saved_copy, len);
+ status = target_read_memory (copy, displaced->step_saved_copy, len);
+ if (status != 0)
+ throw_error (MEMORY_ERROR,
+ _("Error accessing memory address %s (%s) for "
+ "displaced-stepping buffer, you may want to temporarily "
+ "turn it off if there is only one inferior thread."),
+ paddress (target_gdbarch, copy), safe_strerror (status));
if (debug_displaced)
{
fprintf_unfiltered (gdb_stdlog, "displaced: saved %s: ",
next reply other threads:[~2012-04-10 19:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-10 19:55 Jan Kratochvil [this message]
2012-04-10 23:48 ` Yao Qi
2012-04-11 8:45 ` Jan Kratochvil
2012-04-11 9:07 ` Yao Qi
2012-04-11 15:54 ` Pedro Alves
2012-04-11 18:11 ` [commit] " Jan Kratochvil
2012-04-11 16:45 ` Pedro Alves
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=20120410191955.GB31331@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--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