diff mbox

Crash regression(?) printing Fortran strings in bt [Re: [V2 00/23] Fortran dynamic array support]

Message ID 20140729183023.GA17443@host2.jankratochvil.net
State New
Headers show

Commit Message

Jan Kratochvil July 29, 2014, 6:30 p.m. UTC
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 <error: Cannot access memory at address 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 <error: Cannot access memory at address 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 <f_language_defn>) at valprint.c:813
#5  0x08338cd1 in common_val_print (val=0x9a29d10, stream=0x9b0e058, recurse=2, options=0xffffc520, language=0x8c25c00 <f_language_defn>) 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

Comments

Jan Kratochvil July 29, 2014, 8:27 p.m. UTC | #1
On Tue, 29 Jul 2014 20:30:23 +0200, Jan Kratochvil wrote:
> 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.

Verified it crashes also on Fedora 20 i686 (released distro) to make the
reproducibility easier.


Jan
Keven Boell Aug. 1, 2014, 7:20 a.m. UTC | #2
On 29.07.2014 22:27, Jan Kratochvil wrote:
> On Tue, 29 Jul 2014 20:30:23 +0200, Jan Kratochvil wrote:
>> 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.
> 
> Verified it crashes also on Fedora 20 i686 (released distro) to make the
> reproducibility easier.
> 
> 
> Jan
> 

Hi Jan,

I just tried it on Fedora 20 i686.  Applied the patch, you mentioned, on top of
the Fortran VLA series and executed your dynamic-other-frame test.  Everything
is working fine here, I cannot reproduce the crash.  Did you apply also other
patches on top? Was it a clean system where you tried the patches?

(gdb) bt
#0  0x080485ca in bar_ ()
#1  0x0804856b in foo (string='hello', _string=5) at ../../../gdb/testsuite/gdb.fortran/dynamic-other-frame.f90:27
#2  0x08048587 in test () at ../../../gdb/testsuite/gdb.fortran/dynamic-other-frame.f90:35
#3  0x080485bd in main (argc=1, argv=0xbfffec4e) at ../../../gdb/testsuite/gdb.fortran/dynamic-other-frame.f90:36
#4  0x4301ab83 in __libc_start_main () from /lib/libc.so.6
#5  0x08048471 in _start ()

- Keven
Jan Kratochvil Aug. 1, 2014, 7:22 a.m. UTC | #3
On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote:
> I just tried it on Fedora 20 i686.  Applied the patch, you mentioned, on top of
> the Fortran VLA series and executed your dynamic-other-frame test.  Everything
> is working fine here, I cannot reproduce the crash.  Did you apply also other
> patches on top? Was it a clean system where you tried the patches?

No. Yes.

OK, I will investigate it more.


Thanks,
Jan
diff mbox

Patch

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 <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+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 <jakub@redhat.com>.
+! Modified for the GDB testcase by Jan Kratochvil <jan.kratochvil@redhat.com>.
+
+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