From: Joel Brobecker <brobecker@adacore.com>
To: Andreas Schwab <schwab@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] fix "ptype $pc" internal-error
Date: Fri, 04 Jan 2008 10:50:00 -0000 [thread overview]
Message-ID: <20080104104943.GA5975@adacore.com> (raw)
In-Reply-To: <jek5mpc1yk.fsf@sykes.suse.de>
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
> Indentation is off here.
>
> if (noside == EVAL_AVOID_SIDE_EFFECTS
> && regno < (gdbarch_num_regs (current_gdbarch)
> + gdbarch_num_pseudo_regs (current_gdbarch)))
Oops, you are right, of course. Thanks!
Fixed in the attached patch.
2008-01-04 Joel Brobecker <brobecker@adacore.com>
* eval.c (evaluate_subexp_standard): Add handling of user
registers when in EVAL_AVOID_SIDE_EFFECTS mode.
2008-01-04 Joel Brobecker <brobecker@adacore.com>
* gdb.base/ptype.exp: Add testing of "ptype $pc".
--
Joel
[-- Attachment #2: ptype.diff --]
[-- Type: text/plain, Size: 1418 bytes --]
Index: eval.c
===================================================================
--- eval.c (revision 65)
+++ eval.c (revision 68)
@@ -512,7 +512,15 @@ evaluate_subexp_standard (struct type *e
name, strlen (name));
if (regno == -1)
error (_("Register $%s not available."), name);
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
+
+ /* In EVAL_AVOID_SIDE_EFFECTS mode, we only need to return
+ a value with the appropriate register type. Unfortunately,
+ we don't have easy access to the type of user registers.
+ So for these registers, we fetch the register value regardless
+ of the evaluation mode. */
+ if (noside == EVAL_AVOID_SIDE_EFFECTS
+ && regno < (gdbarch_num_regs (current_gdbarch)
+ + gdbarch_num_pseudo_regs (current_gdbarch)))
val = value_zero (register_type (current_gdbarch, regno), not_lval);
else
val = value_of_register (regno, get_selected_frame (NULL));
Index: testsuite/gdb.base/ptype.exp
===================================================================
--- testsuite/gdb.base/ptype.exp (revision 65)
+++ testsuite/gdb.base/ptype.exp (revision 68)
@@ -639,4 +639,7 @@ if [runto_main] then {
gdb_test "ptype {{0,1,2},{3,4,5}}" "type = int \\\[2\\\]\\\[3\\\]"
gdb_test "ptype {4,5,6}\[2\]" "type = int"
gdb_test "ptype *&{4,5,6}\[1\]" "type = int"
+
+ # Test ptype of user register
+ gdb_test "ptype \$pc" "void \\(\\*\\)\\(\\)" "ptype \$pc"
}
next prev parent reply other threads:[~2008-01-04 10:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-04 9:43 Joel Brobecker
2008-01-04 10:36 ` Andreas Schwab
2008-01-04 10:50 ` Joel Brobecker [this message]
2008-01-29 17:47 ` Daniel Jacobowitz
2008-01-30 17:31 ` Mark Kettenis
2008-01-30 19:01 ` Joel Brobecker
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=20080104104943.GA5975@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=schwab@suse.de \
/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