From: "Andrew Burgess" <aburgess@broadcom.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] [2/2] Don't raise an error for optimized out sub-fields.
Date: Thu, 11 Jul 2013 14:35:00 -0000 [thread overview]
Message-ID: <51DEC299.8040109@broadcom.com> (raw)
When performing a lazy fetch of a sub-bitfield, we raise an error
if the bits have been optimized-out from the parent value. This
is odd, as in most other cases we report the value as "<optimized out>".
This patch marks the result of the lazy fetch as optimized out,
and then returns rather than raising an error. No regressions,
and the one test I see that hits this now seems more consistent.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-07-11 Andrew Burgess <aburgess@broadcom.com>
* value.c (value_fetch_lazy): Mark optimized out values as such
rather than raising an error.
gdb/testsuite/ChangeLog
2013-07-11 Andrew Burgess <aburgess@broadcom.com>
* gdb.dwarf2/pieces-optimized-out.exp: Expect "<optimized out>"
rather than an error.
diff --git a/gdb/value.c b/gdb/value.c
index 8e0f8c4..8d635c7 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3439,9 +3439,8 @@ value_fetch_lazy (struct value *val)
if (!value_bits_valid (parent,
TARGET_CHAR_BIT * offset + value_bitpos (val),
value_bitsize (val)))
- error (_("value has been optimized out"));
-
- if (!unpack_value_bits_as_long (value_type (val),
+ set_value_optimized_out (val, 1);
+ else if (!unpack_value_bits_as_long (value_type (val),
value_contents_for_printing (parent),
offset,
value_bitpos (val),
diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
index 2e4d028..8376235 100644
--- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
+++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp
@@ -44,6 +44,6 @@ gdb_test "p s" \
"print s"
gdb_test "p s.a" " = 5" "print s.a"
gdb_test "p s.b" " = <optimized out>" "print s.b"
-gdb_test "p s.c" "value has been optimized out" "print s.c"
-gdb_test "p s.d" "value has been optimized out" "print s.d"
+gdb_test "p s.c" " = <optimized out>" "print s.c"
+gdb_test "p s.d" " = <optimized out>" "print s.d"
next reply other threads:[~2013-07-11 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 14:35 Andrew Burgess [this message]
2013-07-30 14:53 ` Pedro Alves
2013-07-30 15:38 ` Andrew Burgess
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=51DEC299.8040109@broadcom.com \
--to=aburgess@broadcom.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