From: Stephan Rohr <stephan.rohr@intel.com>
To: gdb-patches@sourceware.org
Cc: stephan.rohr@intel.com, tom@tromey.com
Subject: [PATCH 0/1] Fix 'rw_pieced_value' for values casted to different type.
Date: Fri, 22 Apr 2022 16:44:19 +0200 [thread overview]
Message-ID: <20220422144420.3545190-1-stephan.rohr@intel.com> (raw)
From: "Rohr, Stephan" <stephan.rohr@intel.com>
This patch provides a fix for the issue when a user wants to print a pieced
value, as described by 'DW_OP_piece' or 'DW_OP_bit_piece', casted to a
different type, e.g. 'print (<type> []) <variable>).
If a lazy value is fetched, GDB allocates space based on the enclosing type's
length and typically reads the 'full' object. This is not implemented for
pieced values and causes an internal error if 'type' and 'enclosing_type' of
a value are not identical, which is the case if the user explicitly casts the
variable.
However, GDB can read the value based on its type. Thus, it should be
sufficient to check if the type's length (potentially shifted by
'embedded_offset') does not exceed the enclosing type's length which was
used for memory allocation.
Test-cases are added to 'gdb/testsuite/gdb.dwarf2/shortpiece.exp'.
The testsuite was run for the following targets:
* unix/-64
* native-gdbserver
* native-extended-gdbserver
* unix/-m32
Rohr, Stephan (1):
gdb/dwarf2: Fix 'rw_pieced_value' for values casted to different type.
gdb/dwarf2/expr.c | 6 ++----
gdb/testsuite/gdb.dwarf2/shortpiece.exp | 12 ++++++++++++
2 files changed, 14 insertions(+), 4 deletions(-)
--
2.25.1
next reply other threads:[~2022-04-22 14:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 14:44 Stephan Rohr [this message]
2022-04-22 14:44 ` [PATCH 1/1] gdb/dwarf2: " Stephan Rohr
2022-06-06 16:51 ` Bruno Larsen
2022-07-14 7:50 ` Rohr, Stephan
2022-07-21 12:21 ` Rohr, Stephan
2022-08-02 6:30 ` Rohr, Stephan
2022-08-11 7:09 ` Rohr, Stephan
2022-08-19 7:41 ` Rohr, Stephan
2022-08-19 16:39 ` Simon Marchi
2022-10-11 8:03 ` Rohr, Stephan
2022-10-21 17:06 ` Tom Tromey
2022-10-14 18:28 ` Tom Tromey
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=20220422144420.3545190-1-stephan.rohr@intel.com \
--to=stephan.rohr@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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).