From patchwork Tue Jul 29 18:30:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 2223 Received: (qmail 20299 invoked by alias); 29 Jul 2014 19:04:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20288 invoked by uid 89); 29 Jul 2014 19:04:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS, UNSUBSCRIBE_BODY autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 29 Jul 2014 19:04:18 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6TJ4GaO032517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Jul 2014 15:04:16 -0400 Received: from host2.jankratochvil.net (ovpn-116-29.ams2.redhat.com [10.36.116.29]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6TIUOtt022691 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 29 Jul 2014 14:30:27 -0400 Date: Tue, 29 Jul 2014 20:30:24 +0200 From: Jan Kratochvil To: Keven Boell Cc: gdb-patches@sourceware.org, sanimir.agovic@intel.com Subject: Crash regression(?) printing Fortran strings in bt [Re: [V2 00/23] Fortran dynamic array support] Message-ID: <20140729183023.GA17443@host2.jankratochvil.net> References: <1405070495-6948-1-git-send-email-keven.boell@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1405070495-6948-1-git-send-email-keven.boell@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi Keven, I hope you get it reproducible this time. With your patchset ( 511bff520372ffc10fa2ff569c176bdf1e6e475d ) and after applying IMO harmless patch: [patch] Display Fortran strings in backtraces https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html I get a crash on 32-bit host (not on x86_64 and neither on x86_64 debugging 32-bit target built with -m32). Tested Fedora 21pre and Fedora Rawhide. It happens only for the testcase gdb.fortran/dynamic-other-frame.exp which comes from the original archer/jankratochvil/vla branch, attaching it. Running gdb/testsuite/gdb.fortran/dynamic-other-frame.exp ... ERROR: Process no longer exists UNRESOLVED: gdb.fortran/dynamic-other-frame.exp: bt runtest gdb.fortran/dynamic-other-frame.exp gdb -ex r --args ../gdb gdb.fortran/dynamic-other-frame -ex 'b bar_' -ex r -ex bt ------------------------------------------------------------------------------ Breakpoint 1, 0x080485cf in bar_ () #0 0x080485cf in bar_ () Program received signal SIGSEGV, Segmentation fault. 0x0830d943 in extract_unsigned_integer (addr=0x1350a697 , len=1, byte_order=BFD_ENDIAN_LITTLE) at findvar.c:110 110 retval = (retval << 8) | *p; (gdb) bt #0 0x0830d943 in extract_unsigned_integer (addr=0x1350a697 , len=1, byte_order=BFD_ENDIAN_LITTLE) at findvar.c:110 #1 0x0833bc5a in generic_printstr (stream=0x9b0e058, type=0x98725c8, string=0x9a29d78 "", length=162400544, encoding=0x97a0c18 "UTF-8", force_ellipses=0, quote_char=34, c_style_terminator=1, options=0xffffc400) at valprint.c:2436 #2 0x0843ac0c in c_printstr (stream=0x9b0e058, type=0x98725c8, string=0x9a29d78 "", length=162400544, user_encoding=0x0, force_ellipses=0, options=0xffffc400) at c-lang.c:220 #3 0x0846bb3c in f_val_print (type=0x9ae0940, valaddr=0x9a29d78 "", embedded_offset=0, address=134514304, stream=0x9b0e058, recurse=2, original_value=0x9a29d10, options=0xffffc400) at f-valprint.c:238 #4 0x083389da in val_print (type=0x9ae0940, valaddr=0x9a29d78 "", embedded_offset=0, address=134514304, stream=0x9b0e058, recurse=2, val=0x9a29d10, options=0xffffc520, language=0x8c25c00 ) at valprint.c:813 #5 0x08338cd1 in common_val_print (val=0x9a29d10, stream=0x9b0e058, recurse=2, options=0xffffc520, language=0x8c25c00 ) at valprint.c:900 #6 0x08378647 in print_frame_arg (arg=0xffffc5d4) at stack.c:289 #7 0x0837916a in print_frame_args (func=0x9ae0a20, frame=0x97c307c, num=-1, stream=0x9839440) at stack.c:674 #8 0x0837a1fd in print_frame (frame=0x97c307c, print_level=1, print_what=LOCATION, print_args=1, sal=...) at stack.c:1205 #9 0x08379708 in print_frame_info (frame=0x97c307c, print_level=1, print_what=LOCATION, print_args=1, set_current_sal=0) at stack.c:857 #10 0x0837b935 in backtrace_command_1 (count_exp=0x0, show_locals=0, no_filters=0, from_tty=1) at stack.c:1817 #11 0x0837bcf7 in backtrace_command (arg=0x0, from_tty=1) at stack.c:1914 ------------------------------------------------------------------------------ It is a bit interesting this way no crash happens: ------------------------------------------------------------------------------ ../gdb gdb.fortran/dynamic-other-frame -ex 'b bar_' -ex r -ex up Breakpoint 1, 0x080485cf in bar_ () #1 0x08048566 in foo (string='hello', _string=5) at ./gdb.fortran/dynamic-other-frame.f90:27 27 call bar ! stop-here ------------------------------------------------------------------------------ Thanks, Jan Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame-stub.f90 2014-06-16 23:30:30.113940488 +0200 @@ -0,0 +1,24 @@ +! Copyright 2010 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 2 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program; if not, write to the Free Software +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +! +! Ihis file is the Fortran source file for dynamic.exp. +! Original file written by Jakub Jelinek . +! Modified for the GDB testcase by Jan Kratochvil . + +subroutine bar + real :: dummy + dummy = 1 +end subroutine bar Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.exp 2014-06-16 23:30:30.113940488 +0200 @@ -0,0 +1,37 @@ +# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set testfile "dynamic-other-frame" +set srcfile1 ${testfile}.f90 +set srcfile2 ${testfile}-stub.f90 +set objfile2 [standard_output_file ${testfile}-stub.o] +set executable ${testfile} +set binfile [standard_output_file ${executable}] + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${objfile2}" object {f90}] != "" + || [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${objfile2}" "${binfile}" executable {debug f90}] != "" } { + untested "Couldn't compile ${srcfile1} or ${srcfile2}" + return -1 +} + +clean_restart ${executable} + +if ![runto bar_] then { + perror "couldn't run to bar_" + continue +} + +gdb_test "bt" {foo \(string='hello'.*} Index: gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gdb-7.7.90.20140613/gdb/testsuite/gdb.fortran/dynamic-other-frame.f90 2014-06-16 23:30:30.113940488 +0200 @@ -0,0 +1,36 @@ +! Copyright 2010 Free Software Foundation, Inc. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 2 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program; if not, write to the Free Software +! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +! +! Ihis file is the Fortran source file for dynamic.exp. +! Original file written by Jakub Jelinek . +! Modified for the GDB testcase by Jan Kratochvil . + +subroutine foo (string) + interface + subroutine bar + end subroutine + end interface + character string*(*) + call bar ! stop-here +end subroutine foo +program test + interface + subroutine foo (string) + character string*(*) + end subroutine + end interface + call foo ('hello') +end