From: Joost van der Sluis <joost@cnoc.nl>
To: gdb-patches@sourceware.org
Subject: Patch to fix crash on mingw and nil-typenames.
Date: Wed, 12 Oct 2011 08:35:00 -0000 [thread overview]
Message-ID: <1318408512.25241.30.camel@feddie.cnoc.lan> (raw)
Hi all,
This patch resolves crashes of gdb on mingw, because fprintf on mingw
does not substitute nil-string parameters.
2011-10-12 Joost van der Sluis <joost@cnoc.nl>
* gdbtypes.h Added TYPE_SAFE_NAME macro to get the name of a
type or "<unnamed type"> when there is no name assigned.
* gnu-v3-abi.c (gnuv3_rtti_type): Use TYPE_SAFE_NAME macro to
avoid a sigint when no name is assigned.
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1220,6 +1220,11 @@ extern void allocate_gnat_aux_type (struct type *);
|| TYPE_NFN_FIELDS (thistype) == 0) \
&& (TYPE_STUB (thistype) || !TYPE_STUB_SUPPORTED (thistype)))
+/* A helper macro that returns the name of a type or "unnamed type" if the type
+ has no name. */
+#define TYPE_SAFE_NAME(type) \
+ (TYPE_NAME (type) ? TYPE_NAME (type) : _("<unnamed type>"))
+
/* A helper macro that returns the name of an error type. If the type
has a name, it is used; otherwise, a default is used. */
#define TYPE_ERROR_NAME(type) \
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -319,7 +319,7 @@ gnuv3_rtti_type (struct value *value,
|| strncmp (vtable_symbol_name, "vtable for ", 11))
{
warning (_("can't find linker symbol for virtual table for `%s' value"),
- TYPE_NAME (values_type));
+ TYPE_SAFE_NAME (values_type));
if (vtable_symbol_name)
warning (_(" found `%s' instead"), vtable_symbol_name);
return NULL;
next reply other threads:[~2011-10-12 8:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-12 8:35 Joost van der Sluis [this message]
2011-10-12 13:45 ` Tom Tromey
2011-10-12 14:42 ` Yao Qi
2011-10-12 15:51 ` Joost van der Sluis
2011-10-14 19:53 ` 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=1318408512.25241.30.camel@feddie.cnoc.lan \
--to=joost@cnoc.nl \
--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