From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31205 invoked by alias); 9 Jan 2009 21:45:46 -0000 Received: (qmail 31037 invoked by uid 22791); 9 Jan 2009 21:45:45 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_MX,KAM_STOCKGEN,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Jan 2009 21:45:32 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n09LjM2g006749 for ; Fri, 9 Jan 2009 16:45:22 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n09LjLP3021338; Fri, 9 Jan 2009 16:45:21 -0500 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n09LjJio020574; Fri, 9 Jan 2009 16:45:21 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n09LjGNd010206; Fri, 9 Jan 2009 22:45:17 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.2/Submit) id n09LjDqd010200; Fri, 9 Jan 2009 22:45:13 +0100 Date: Fri, 09 Jan 2009 21:45:00 -0000 From: Jan Kratochvil To: Jim Meyering Cc: gdb-patches@sourceware.org, Corinna Vinschen Subject: Re: rawhide's gdb segfaults, w/patch Message-ID: <20090109214512.GA5851@host0.dyn.jankratochvil.net> References: <87abag9pi1.fsf@rho.meyering.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87abag9pi1.fsf@rho.meyering.net> User-Agent: Mutt/1.5.18 (2008-05-17) 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: 2009-01/txt/msg00213.txt.bz2 Hi Jim, thanks but your patch needed a second part. It is a regression from: http://sourceware.org/ml/gdb-cvs/2008-04/msg00136.html On Sun, 28 Dec 2008 18:30:14 +0100, Jim Meyering wrote: > Here's an untested and quite possibly-wrong patch. > I.e., if the warning should be given even when "thisfun" is NULL, > it would have to be different. I find it right as gdbarch_return_value_ftype even has a comment: FUNCTYPE may be NULL in which case the return convention is computed based only on VALTYPE. This new argument and functype|func_type is only used in sh-tdep.c http://sourceware.org/ml/gdb-patches/2008-04/msg00277.html and even there it can be safely NULL. This new argument and functype|func_type was added by http://sourceware.org/ml/gdb-patches/2008-04/msg00276.html I find just questionable whether the new testcase should be in gdb.base/nodebug.exp or gdb.base/return*.exp but may be any way is OK. Thanks, Jan gdb/ 2009-01-09 Jim Meyering Jan Kratochvil Avoid NULL dereference. * stack.c (return_command): Guard use of SYMBOL_TYPE (thisfun). New variable func_type. gdb/testsuite/ 2009-01-09 Jan Kratochvil * gdb.base/nodebug.exp (return from function with no debug info): New. --- gdb/stack.c 3 Jan 2009 05:57:53 -0000 1.183 +++ gdb/stack.c 9 Jan 2009 20:30:25 -0000 @@ -1823,7 +1823,8 @@ return_command (char *retval_exp, int fr is discarded, side effects such as "return i++" still occur. */ return_value = NULL; - else if (using_struct_return (SYMBOL_TYPE (thisfun), return_type)) + else if (thisfun != NULL + && using_struct_return (SYMBOL_TYPE (thisfun), return_type)) { query_prefix = "\ The location at which to store the function's return value is unknown.\n\ @@ -1856,10 +1857,12 @@ If you continue, the return value that y { struct type *return_type = value_type (return_value); struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ()); - gdb_assert (gdbarch_return_value (gdbarch, SYMBOL_TYPE (thisfun), - return_type, NULL, NULL, NULL) + struct type *func_type = thisfun == NULL ? NULL : SYMBOL_TYPE (thisfun); + + gdb_assert (gdbarch_return_value (gdbarch, func_type, return_type, NULL, + NULL, NULL) == RETURN_VALUE_REGISTER_CONVENTION); - gdbarch_return_value (gdbarch, SYMBOL_TYPE (thisfun), return_type, + gdbarch_return_value (gdbarch, func_type, return_type, get_current_regcache (), NULL /*read*/, value_contents (return_value) /*write*/); } --- gdb/testsuite/gdb.base/nodebug.exp 3 Jan 2009 05:58:03 -0000 1.10 +++ gdb/testsuite/gdb.base/nodebug.exp 9 Jan 2009 20:30:26 -0000 @@ -215,5 +215,12 @@ if [runto inner] then { if [runto middle] then { gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \ "backtrace from middle in nodebug.exp" + + # Test return from a function with no debug info (symbol; still it may + # have a minimal-symbol). In gdb.base/return*.exp we would need to + # build a separate executable with no "debug" option. + gdb_test "return 0" "#0 .* top \\(.*" \ + "return from function with no debug info" \ + "Make selected stack frame return now\\? \\(y or n\\) " "y" } }