From: Martin Galvan <martin.galvan@tallertechnologies.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix gdb crash when trying to print the address of a synthetic pointer.
Date: Tue, 07 Apr 2015 14:09:00 -0000 [thread overview]
Message-ID: <1428415783-15199-1-git-send-email-martin.galvan@tallertechnologies.com> (raw)
Trying to print the address of a synthetic pointer (such as a C++ reference after O3 optimization) will cause gdb to crash with the following message:
../gdb/dwarf2loc.c:1625: internal-error: Should not be able to create a lazy value with an enclosing type
This patch fixes that by doing a check for synthetic pointers in value_addr and printing an error message.
I have a company-wide copyright assignment. I don't have commit access, though, so it would be great if anyone could commit this for me.
gdb/
2015-04-07 Martin Galvan <martin.galvan@tallertechnologies.com>
* valops.c (value_addr): Don't try to get the address of a synthetic pointer.
---
gdb/valops.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gdb/valops.c b/gdb/valops.c
index 66c63c1..66e2c9d 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1474,6 +1474,13 @@ value_addr (struct value *arg1)
struct value *arg2;
struct type *type = check_typedef (value_type (arg1));
+ if (value_bits_synthetic_pointer(arg1, value_embedded_offset (arg1),
+ TARGET_CHAR_BIT * TYPE_LENGTH (type)))
+ {
+ error (_("Attempt to take address of a synthetic pointer."));
+ return NULL;
+ }
+
if (TYPE_CODE (type) == TYPE_CODE_REF)
{
/* Copy the value, but change the type from (T&) to (T*). We
--
2.3.5
next reply other threads:[~2015-04-07 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 14:09 Martin Galvan [this message]
2015-04-07 14:33 ` Pedro Alves
2015-04-07 14:41 ` Martin Galvan
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=1428415783-15199-1-git-send-email-martin.galvan@tallertechnologies.com \
--to=martin.galvan@tallertechnologies.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).