From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5685 invoked by alias); 12 Oct 2011 08:35:33 -0000 Received: (qmail 5364 invoked by uid 22791); 12 Oct 2011 08:35:31 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp-vbr18.xs4all.nl (HELO smtp-vbr18.xs4all.nl) (194.109.24.38) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 08:35:15 +0000 Received: from cnoc.nl.alt001.com (oostvogels.xs4all.nl [83.163.197.192]) by smtp-vbr18.xs4all.nl (8.13.8/8.13.8) with ESMTP id p9C8ZDJm089660 for ; Wed, 12 Oct 2011 10:35:14 +0200 (CEST) (envelope-from joost@cnoc.nl) Received: from localhost (localhost.localdomain [127.0.0.1]) by cnoc.nl.alt001.com (Postfix) with ESMTP id C2834BF62 for ; Wed, 12 Oct 2011 10:35:13 +0200 (CEST) Received: from cnoc.nl.alt001.com ([127.0.0.1]) by localhost (cnoc.nl.alt001.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vcr9GaEtXkg0 for ; Wed, 12 Oct 2011 10:35:12 +0200 (CEST) Received: from [192.168.3.116] (host116.cnoc.intern [192.168.3.116]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by cnoc.nl.alt001.com (Postfix) with ESMTPS id BF1A1BF0B for ; Wed, 12 Oct 2011 10:35:12 +0200 (CEST) Subject: Patch to fix crash on mingw and nil-typenames. From: Joost van der Sluis To: gdb-patches@sourceware.org Date: Wed, 12 Oct 2011 08:35:00 -0000 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Message-ID: <1318408512.25241.30.camel@feddie.cnoc.lan> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00343.txt.bz2 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 * gdbtypes.h Added TYPE_SAFE_NAME macro to get the name of a type or " 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) : _("")) + /* 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;