From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18759 invoked by alias); 16 Feb 2012 15:24:07 -0000 Received: (qmail 18741 invoked by uid 22791); 16 Feb 2012 15:24:05 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,TW_BJ,TW_VP X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Feb 2012 15:23:20 +0000 Received: from nat-dem.mentorg.com ([195.212.93.2] helo=eu2-mail.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Ry3B0-0001cv-ME from Thomas_Schwinge@mentor.com ; Thu, 16 Feb 2012 07:23:18 -0800 Received: from feldtkeller.schwinge.homeip.net ([172.30.64.128]) by eu2-mail.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 16 Feb 2012 16:23:17 +0100 From: Thomas Schwinge To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: [PATCH] [SH] GDB crash in sh_is_renesas_calling_convention, TYPE_CALLING_CONVENTION (was: Prologue skipping if there is none) In-Reply-To: <4F3BBA6F.4050209@redhat.com> References: <87pqdgciho.fsf@schwinge.name> <4F3BBA6F.4050209@redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Thu, 16 Feb 2012 15:27:00 -0000 Message-ID: <87aa4idcq4.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: 2012-02/txt/msg00329.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 4739 Hi! On Wed, 15 Feb 2012 14:00:15 +0000, Pedro Alves wrote: > On 02/15/2012 01:51 PM, Thomas Schwinge wrote: >=20 > > First, for SH GNU/Linux, when running the testsuite via gdbserver on > > pristine sources, I'm getting a large number of ERRORs, in the 350s. Is > > that normal or at least known? They're basically all of the kind > > ``ERROR: Process no longer exists'', and then follow-up errors until the > > end of the specific testcase. From a very quick glance, they all seem = to > > be happening after the testcase has instructed GDB to invoke a function, > > such as: > >=20 > > (gdb) PASS: gdb.cp/classes.exp: print g_D.p > > call class_param.Aptr_a (&g_A) > > ERROR: Process no longer exists > > UNRESOLVED: gdb.cp/classes.exp: call class_param.Aptr_a (&g_A) > > ERROR: Couldn't send call class_param.Aptr_x (&g_A) to GDB. > >=20 > > This probably suggests where to begin looking unless that's know alread= y. >=20 > This means that GDB crashed. Just run the test with >=20 > $ ulimit -c unlimited > $ make check RUNTESTFLAGS=3D"classes.exp" >=20 > so that the crash ends up creating a core, and you'll probably find that > all the ERRORs are caused by a single bug. Indeed: Core was generated by `sh-linux-gnu-gdb -nw -nx -data-directory /scratc= h/tschwing/FM_sh-linux-gnu/obj/'. Program terminated with signal 11, Segmentation fault. #0 0x0804c239 in sh_is_renesas_calling_convention (func_type=3D0xa07b1= 54) at /scratch/tschwing/FM_sh-linux-gnu/obj/gdb-src-mainline-0-sh-linux-gn= u-i686-pc-linux-gnu/gdb/sh-tdep.c:92 92 return ((func_type (gdb) print *func_type $1 =3D {pointer_type =3D 0x0, reference_type =3D 0x0, chain =3D 0xa07b1= 54, instance_flags =3D 0, length =3D 1, main_type =3D 0xa07b16c} (gdb) list 87 }; 88 89 static int 90 sh_is_renesas_calling_convention (struct type *func_type) 91 { 92 return ((func_type 93 && TYPE_CALLING_CONVENTION (func_type) =3D=3D DW_CC_= GNU_renesas_sh) 94 || sh_active_calling_convention =3D=3D sh_cc_renesas); 95 } 96 gdb/gdbtypes.h: #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->typ= e_specific.func_stuff->calling_convention (gdb) print *func_type->main_type $2 =3D {code =3D TYPE_CODE_METHOD, flag_unsigned =3D 0, flag_nosign =3D= 0, flag_stub =3D 0, flag_target_stub =3D 0, flag_static =3D 0, flag_protot= yped =3D 0, flag_incomplete =3D 0, flag_varargs =3D 0, flag_vector =3D 0, f= lag_stub_supported =3D 0, flag_gnu_ifunc =3D 0, flag_fixed_instance =3D 0, flag_objfile_owned = =3D 1, flag_declared_class =3D 0, flag_flag_enum =3D 0, type_specific_field= =3D TYPE_SPECIFIC_NONE, nfields =3D 1, vptr_fieldno =3D 0, name =3D 0x0, t= ag_name =3D 0x0, owner =3D { objfile =3D 0xa0673b8, gdbarch =3D 0xa0673b8}, target_type =3D 0xa0= 7a87c, flds_bnds =3D {fields =3D 0xa07b1dc, bounds =3D 0xa07b1dc}, vptr_bas= etype =3D 0xa06eea8, type_specific =3D {cplus_stuff =3D 0x0, gnat_stuff =3D= 0x0, floatformat =3D 0x0, func_stuff =3D 0x0}} (gdb) print func_type->main_type->type_specific.func_stuff $3 =3D (struct func_type *) 0x0 The cure is the same as has been applied before, . gdb/ 2012-02-16 Thomas Schwinge * sh-tdep.c (sh_is_renesas_calling_convention): Fix handling of TYPE_CALLING_CONVENTION annotation. Index: gdb/sh-tdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/sh-tdep.c,v retrieving revision 1.236 diff -u -p -r1.236 sh-tdep.c --- gdb/sh-tdep.c 28 Jan 2012 18:08:20 -0000 1.236 +++ gdb/sh-tdep.c 16 Feb 2012 15:13:53 -0000 @@ -89,9 +89,24 @@ struct sh_frame_cache static int sh_is_renesas_calling_convention (struct type *func_type) { - return ((func_type - && TYPE_CALLING_CONVENTION (func_type) =3D=3D DW_CC_GNU_renesas_sh) - || sh_active_calling_convention =3D=3D sh_cc_renesas); + int val =3D 0; + + if (func_type) + { + func_type =3D check_typedef (func_type); + + if (TYPE_CODE (func_type) =3D=3D TYPE_CODE_PTR) + func_type =3D check_typedef (TYPE_TARGET_TYPE (func_type)); + + if (TYPE_CODE (func_type) =3D=3D TYPE_CODE_FUNC + && TYPE_CALLING_CONVENTION (func_type) =3D=3D DW_CC_GNU_renesas_= sh) + val =3D 1; + } + + if (sh_active_calling_convention =3D=3D sh_cc_renesas) + val =3D 1; + + return val; } =20 static const char * Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJPPR9TAAoJENuKOtuXzphJL50H/RXBzWsjI0T23GRC1FpWuL4D T0hoTfFLKT01oDlAC5qB2IcxXwItLS1yBRSwq+RKLWKvzJ/h/hGWI8sqXCsQAOLh X4S2oHQXKtsgmHOb6Iw1jS2u8xrH9gvrugPEbHBAWU42r+BifWX9+b2qsBVTh1IM LBRGrB46apUGq+aTmasb4rbAy92tvFD5SraN1PjP6KECiqo8INb4QjD3Fzn+/PDi sq3b5LrD7h9cUyJXcrevdv3SwurOIADDu0nnVR5vdx4wlL6MRpXHI5E1SEjg5Nvw DE7WhhMJvfASBOoUJ2kGr+eERQlRRJ6UgfHq/kc9GMVgNYFJp6n+JI2VacSqZMg= =otLR -----END PGP SIGNATURE----- --=-=-=--