From kargl@troutmask.apl.washington.edu  Fri May  4 05:29:34 2007
Return-Path: <kargl@troutmask.apl.washington.edu>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id C629A16A403
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  4 May 2007 05:29:34 +0000 (UTC)
	(envelope-from kargl@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105])
	by mx1.freebsd.org (Postfix) with ESMTP id A169413C44B
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  4 May 2007 05:29:34 +0000 (UTC)
	(envelope-from kargl@troutmask.apl.washington.edu)
Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1])
	by troutmask.apl.washington.edu (8.14.1/8.13.8) with ESMTP id l445RLxB054155
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 3 May 2007 22:27:21 -0700 (PDT)
	(envelope-from kargl@troutmask.apl.washington.edu)
Received: (from kargl@localhost)
	by troutmask.apl.washington.edu (8.14.1/8.13.8/Submit) id l445RHCw054154;
	Thu, 3 May 2007 22:27:17 -0700 (PDT)
	(envelope-from kargl)
Message-Id: <200705040527.l445RHCw054154@troutmask.apl.washington.edu>
Date: Thu, 3 May 2007 22:27:17 -0700 (PDT)
From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Reply-To: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: tcsh causes gdb to hang	
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         112408
>Category:       bin
>Synopsis:       [regression] tcsh(1): tcsh causes gdb to hang (regression in tcsh)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mp
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 04 05:30:05 GMT 2007
>Closed-Date:    
>Last-Modified:  Mon May 05 00:48:15 UTC 2008
>Originator:     Steven G. Kargl
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
APL/UW
>Environment:
 FreeBSD mobile.kargl.org 7.0-CURRENT FreeBSD 7.0-CURRENT #2: Sun Apr 29 10:49:22 PDT 2007     root@mobile.kargl.org:/usr/obj/usr/src/sys/MOBILE  i386
 
>Description:

tcsh causes gdb to hang.  I've compile gfortran 4.3 from gcc.gnu.org
svn repository.  Trying to debug a gfortran compiler bug via

mobile:kargl[254] gdb ~/work/4x/libexec/gcc/i386-unknown-freebsd7.0/4.3.0/f951
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) run b.f90
Starting program: ~/work/4x/libexec/gcc/i386-unknown-freebsd7.0/4.3.0/f951 b.f90

leads to

43 processes:  3 running, 38 sleeping, 1 stopped, 1 zombie
CPU states: 41.6% user,  0.0% nice, 57.6% system,  0.8% interrupt,  0.0% idle
Mem: 104M Active, 283M Inact, 78M Wired, 27M Cache, 60M Buf, 1776K Free
Swap: 712M Total, 712M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
97164 kargl         1 127    0 30364K 28192K RUN      0:30 66.97% gdb
97166 kargl         1 106    0  3240K  1580K STOP     0:10 23.67% tcsh

where tcsh sits in a stopped state.

If I do

mobile:kargl[253] setenv SHELL /bin/sh
mobile:kargl[254] gdb ~/work/4x/libexec/gcc/i386-unknown-freebsd7.0/4.3.0/f951
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) run b.f90
Starting program: ~/work/4x/libexec/gcc/i386-unknown-freebsd7.0/4.3.0/f951 b.f90
b.f90:1.16:

  character(len=2.3) :: s
               1
Error: Expression at (1) must be of INTEGER type
b.f90:1.16:

  character(len=2.3) :: s
               1
Error: Expression at (1) must be of INTEGER type

Program received signal SIGSEGV, Segmentation fault.
0x287c4cf1 in __gmpn_copyi () from /usr/local/lib/libgmp.so.7
(gdb) bt
(gdb) bt
#0  0x287c4cf1 in __gmpn_copyi () from /usr/local/lib/libgmp.so.7
#1  0x287b5413 in __gmpz_set () from /usr/local/lib/libgmp.so.7
#2  0x0809495b in gfc_simplify_len (e=0x28932260) at ../../gcc4x/gcc/fortran/simplify.c:2143
#3  0x0806ba1d in do_simplify (specific=0x28941b70, e=0x28932200)
    at ../../gcc4x/gcc/fortran/intrinsic.c:3134
#4  0x0806bde1 in gfc_intrinsic_func_interface (expr=0x28932200, error_flag=680567168)
    at ../../gcc4x/gcc/fortran/intrinsic.c:3395
#5  0x08089b91 in gfc_resolve_expr (e=0x28932200) at ../../gcc4x/gcc/fortran/resolve.c:1456
#6  0x0808bf4d in resolve_code (code=0x2892c9c0, ns=0x28938000)
    at ../../gcc4x/gcc/fortran/resolve.c:5091
#7  0x0808d7ee in gfc_resolve_blocks (b=0x2892ca00, ns=0x28938000)
    at ../../gcc4x/gcc/fortran/resolve.c:5024
#8  0x0808bf31 in resolve_code (code=0x2892ca80, ns=0x28938000)
    at ../../gcc4x/gcc/fortran/resolve.c:5083
#9  0x0808ee65 in resolve_codes (ns=0x28938000) at ../../gcc4x/gcc/fortran/resolve.c:7386
#10 0x0808ee93 in gfc_resolve (ns=0x28938000) at ../../gcc4x/gcc/fortran/resolve.c:7405
#11 0x08084032 in gfc_parse_file () at ../../gcc4x/gcc/fortran/parse.c:3248
#12 0x080a0b10 in gfc_be_parse_file (set_yydebug=0) at ../../gcc4x/gcc/fortran/f95-lang.c:305
#13 0x082b4bcd in toplev_main (argc=2, argv=0xbfbfe8a3) at ../../gcc4x/gcc/toplev.c:1051
#14 0x080d795b in main (argc=2, argv=0xbfbfe734) at ../../gcc4x/gcc/main.c:35

This is the expected backtrace.

>How-To-Repeat:

Use FreeBSD-i386 with the newest tcsh code.
Build gfortran from  GCC repository.
Try to debug this program
mobile:kargl[256] cat b.f90
  character(len=2.3) :: s
  print *, len(s)
  end

>Fix:

Revert the recent tcsh upgrade.

>Release-Note:
>Audit-Trail:

From: "Abdullah Ibn Hamad Al-Marri" <almarrie@gmail.com>
To: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/112408: tcsh causes gdb to hang
Date: Fri, 4 May 2007 04:46:14 -0300

 Maybe you need to check this port problem.
 
 http://www.freebsd.org/cgi/query-pr.cgi?pr=100067
 
 -- 
 Regards,
 
 -Abdullah Ibn Hamad Al-Marri
 Arab Portal
 http://www.WeArab.Net/

From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To: Abdullah Ibn Hamad Al-Marri <almarrie@gmail.com>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/112408: tcsh causes gdb to hang
Date: Fri, 4 May 2007 07:56:31 -0700 (PDT)

 Abdullah Ibn Hamad Al-Marri wrote:
 > On 5/4/07, Steven G. Kargl <kargl@troutmask.apl.washington.edu> wrote:
 > >
 > > >Number:         112408
 > > >Category:       bin
 > > >Synopsis:       tcsh causes gdb to hang
 > > >Confidential:   no
 > > >Severity:       critical
 > > >Priority:       high
 > > >Responsible:    freebsd-bugs
 > > >State:          open
 > >
 > > tcsh causes gdb to hang.  I've compile gfortran 4.3 from gcc.gnu.org
 > > svn repository.  Trying to debug a gfortran compiler bug via
 > >
 > 
 > Maybe you need to check this port problem.
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=100067
 > 
 
 That PR is irrelevant.  I see the same behavior with 
 gdb-6.5.tar.gz built from source retrieved from ftp.gnu.org.
 In addition, the gdb that I've reporting the problem
 against is the gdb in the *base system*.  Having a working
 debugger in -current base system would seem to be an essential
 tool.  In fact, gdb appears to work fine with /bin/sh.  So,
 *the problem* is the new tcsh code.  The recent tcsh import
 needs to be reverted.
 
 -- 
 Steve
 http://troutmask.apl.washington.edu/~kargl/
Responsible-Changed-From-To: freebsd-bugs->mp 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat May 5 23:01:09 UTC 2007 
Responsible-Changed-Why:  
Over to mp, who committed the recent tcsh update. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112408 

From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: bin/112408: tcsh causes gdb to hang
Date: Sat, 5 May 2007 17:19:41 -0700 (PDT)

 FreeBSD-gnats-submit@FreeBSD.org wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `bin/112408'.
 > The individual assigned to look at your
 > report is: freebsd-bugs. 
 > 
 > You can access the state of your problem report at any time
 > via this link:
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=112408
 > 
 > >Category:       bin
 > >Responsible:    freebsd-bugs
 > >Synopsis:       tcsh causes gdb to hang
 > >Arrival-Date:   Fri May 04 05:30:05 GMT 2007
 
 I've used 'ktrace -p PID' to attach to tcsh.  I have a 43MB
 file that contains nothing but
 
  56837 tcsh     PSIG  SIGCHLD caught handler=0x808375c mask=0x0 code=0x0
  56837 tcsh     CALL  sigreturn(0xbfbf1a60)
  56837 tcsh     RET   sigreturn JUSTRETURN
  56837 tcsh     PSIG  SIGCHLD caught handler=0x808375c mask=0x0 code=0x0
  56837 tcsh     CALL  sigreturn(0xbfbf1a60)
  56837 tcsh     RET   sigreturn JUSTRETURN
  56837 tcsh     PSIG  SIGCHLD caught handler=0x808375c mask=0x0 code=0x0
  56837 tcsh     CALL  sigreturn(0xbfbf1a60)
  56837 tcsh     RET   sigreturn JUSTRETURN
  56837 tcsh     PSIG  SIGCHLD caught handler=0x808375c mask=0x0 code=0x0
  56837 tcsh     CALL  sigreturn(0xbfbf1a60)
  56837 tcsh     RET   sigreturn JUSTRETURN
 
 This file will grow without bounds unless I do 'killall gdb'
 
 Please, revert the recent tcsh import.
 
 -- 
 Steve
 http://troutmask.apl.washington.edu/~kargl/

From: "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: bin/112408: tcsh causes gdb to hang
Date: Sun, 13 May 2007 12:14:38 -0700 (PDT)

 Here'a a backtrace of the gdb process.
 
 GNU gdb 6.1.1 [FreeBSD]
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you are
 welcome to change it and/or distribute copies of it under certain conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for details.
 This GDB was configured as "i386-marcel-freebsd"...
 Attaching to program: /usr/bin/gdb, process 58689
 Reading symbols from /lib/libm.so.4...done.
 Loaded symbols for /lib/libm.so.4
 Reading symbols from /lib/libreadline.so.6...done.
 Loaded symbols for /lib/libreadline.so.6
 Reading symbols from /lib/libncurses.so.6...done.
 Loaded symbols for /lib/libncurses.so.6
 Reading symbols from /usr/lib/libgnuregex.so.3...done.
 Loaded symbols for /usr/lib/libgnuregex.so.3
 Reading symbols from /lib/libc.so.7...done.
 Loaded symbols for /lib/libc.so.7
 Reading symbols from /usr/lib/libthread_db.so...done.
 Loaded symbols for /usr/lib/libthread_db.so
 Reading symbols from /libexec/ld-elf.so.1...done.
 Loaded symbols for /libexec/ld-elf.so.1
 0x2831d867 in ptrace () from /lib/libc.so.7
 (gdb) bt
 #0  0x2831d867 in ptrace () from /lib/libc.so.7
 #1  0x08152e90 in child_resume (ptid={pid = -1, lwp = 0, tid = 0}, step=0, signal=TARGET_SIGNAL_CHLD)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/i386fbsd-nat.c:77
 #2  0x081297a8 in resume (step=0, sig=TARGET_SIGNAL_CHLD)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/infrun.c:637
 #3  0x080cb940 in startup_inferior (ntraps=2)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/fork-child.c:440
 #4  0x080c9509 in ptrace_him (pid=58690)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/inftarg.c:345
 #5  0x080cb8dc in fork_inferior (exec_file_arg=0x0, allargs=0x28439120 "", env=0x28427110, 
     traceme_fun=0x80c94c8 <ptrace_me>, init_trace_fun=0x80c94e0 <ptrace_him>, pre_trace_fun=0, 
     shell_file_arg=0x0) at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/fork-child.c:390
 #6  0x080c9546 in child_create_inferior (exec_file=0x2849ac60 "/usr/home/kargl/tmp/z", 
     allargs=0x28439120 "", env=0x28427110)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/inftarg.c:364
 #7  0x0815592a in fbsd_thread_create_inferior (exec_file=0x2849ac60 "/usr/home/kargl/tmp/z", 
     allargs=0x28439120 "", env=0x28427110) at /usr/src/gnu/usr.bin/gdb/libgdb/fbsd-threads.c:1018
 #8  0x080dfaea in find_default_create_inferior (exec_file=0x2849ac60 "/usr/home/kargl/tmp/z", 
     allargs=0x28439120 "", env=0x28427110)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/target.c:1356
 #9  0x08072ad9 in run_command (args=0x0, from_tty=1)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/infcmd.c:475
 #10 0x080acd96 in do_cfunc (c=0x0, args=0x0, from_tty=1)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/cli/cli-decode.c:57
 #11 0x080ae8a0 in cmd_func (cmd=0x28466fd0, args=0x0, from_tty=1)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/cli/cli-decode.c:1541
 #12 0x080c778f in execute_command (p=0x28402084 "", from_tty=1)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:743
 #13 0x08089907 in command_handler (command=0x28402080 "")
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-top.c:500
 #14 0x0808a00a in command_line_handler (rl=0x28406770 "run ")
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-top.c:793
 #15 0x28283358 in rl_callback_read_char () from /lib/libreadline.so.6
 #16 0x080891df in rl_callback_read_char_wrapper (client_data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-top.c:166
 #17 0x080897c4 in stdin_event_handler (error=0, client_data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-top.c:416
 #18 0x0808abf1 in handle_file_event (event_file_desc=675187496)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-loop.c:721
 #19 0x0808a660 in process_event ()
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-loop.c:334
 #20 0x0808a6ac in gdb_do_one_event (data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/event-loop.c:371
 #21 0x080c741a in do_catch_errors (uiout=0x28431740, data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:523
 #22 0x080c7270 in catcher (func=0x80c740c <do_catch_errors>, func_uiout=0x28431740, 
     func_args=0xbfbfe370, func_val=0xbfbfe368, func_caught=0xbfbfe36c, errstring=0x0, gdberrmsg=0x0, 
     mask=6) at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:430
 #23 0x080c7452 in catch_errors (func=0, func_args=0x0, errstring=0x81de309 "", mask=6)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:535
 #24 0x081594bb in tui_command_loop (data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/tui/tui-interp.c:150
 #25 0x080721c8 in current_interp_command_loop ()
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/interps.c:277
 #26 0x0807114f in captured_command_loop (data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/main.c:97
 #27 0x080c741a in do_catch_errors (uiout=0x28431740, data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:523
 #28 0x080c7270 in catcher (func=0x80c740c <do_catch_errors>, func_uiout=0x28431740, 
     func_args=0xbfbfe4a0, func_val=0xbfbfe498, func_caught=0xbfbfe49c, errstring=0x0, gdberrmsg=0x0, 
     mask=6) at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:430
 #29 0x080c7452 in catch_errors (func=0, func_args=0x0, errstring=0x81de309 "", mask=6)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:535
 #30 0x08071d93 in captured_main (data=0xbfbfe730)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/main.c:805
 #31 0x080c741a in do_catch_errors (uiout=0x8220f60, data=0x0)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:523
 #32 0x080c7270 in catcher (func=0x80c740c <do_catch_errors>, func_uiout=0x8220f60, 
     func_args=0xbfbfe6e0, func_val=0xbfbfe6d8, func_caught=0xbfbfe6dc, errstring=0x0, gdberrmsg=0x0, 
     mask=6) at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:430
 #33 0x080c7452 in catch_errors (func=0, func_args=0x0, errstring=0x81de309 "", mask=6)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/top.c:535
 #34 0x08071dbb in gdb_main (args=0x283e8b28)
     at /usr/src/gnu/usr.bin/gdb/libgdb/../../../../contrib/gdb/gdb/main.c:814
 #35 0x0807113c in main (argc=0, argv=0x0)
     at /usr/src/gnu/usr.bin/gdb/gdb/../../../../contrib/gdb/gdb/gdb.c:35
 (gdb) quit
 The program is running.  Quit anyway (and detach it)? (y or n) Detaching from program: /usr/bin/gdb, process 58689
 -- 
 Steve
 http://troutmask.apl.washington.edu/~kargl/
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Tue Jul 10 15:49:57 UTC 2007 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112408 
State-Changed-From-To: closed->open 
State-Changed-By: linimon 
State-Changed-When: Wed Jul 11 22:21:56 UTC 2007 
State-Changed-Why:  
Re-open by request of maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=112408 

From: Doug White <dwhite@gumbysoft.com>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/112408: tcsh/gdb hang
Date: Fri, 13 Jul 2007 15:45:35 -0700 (PDT)

 Hello Steve,
 
 I attempted to reproduce your tcsh hang in gdb and was unable to using 
 your test case. The compiler reports the error messages shown but does not 
 segfault on exit nor does it cause the shell to hang in an unusual state. 
 I suppose that the segfault could have been fixed in GCC SVN since I 
 pulled the most recent trunk code yesterday and your problem report dates 
 from April.
 
 The source machine was 7.0-CURRENT i386 as of July 12, on a 1-processor 
 Parallels VM with a UP kernel.
 
 Since I've been mucking around in tcsh's signal handling I'm very 
 interested in fixing any signal-like bugs that are present before 
 7.0-RELEASE.  If you have another test case that hangs on recent -CURRENT 
 source I'd be happy to attempt to reproduce it.
 
 Thanks!
 
 -- 
 Doug White                    |  FreeBSD: The Power to Serve
 dwhite@gumbysoft.com          |  www.FreeBSD.org
>Unformatted:
