Bug 206813

Summary: GDB crashes on calling GUILE functions
Product: [Fedora] Fedora Reporter: Han-Wen Nienhuys <hanwen>
Component: gdbAssignee: Alexandre Oliva <aoliva>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: aoliva, cagney, jan.kratochvil
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 6.5-15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-12-17 22:35:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
C++ file to debug.
none
gdb core file.
none
bla binary. none

Description Han-Wen Nienhuys 2006-09-16 22:21:45 UTC
Hi Alexandre!

gdb-6.5-8.fc6

see attached C++ file. Compile as 

  g++ -g -Wall bla.cc -lguile 

and note how GDB crashes in the following session.

[lilydev@haring tmp]$ g++ -g -obla -Wall bla.cc -lguile 
[lilydev@haring tmp]$ gdb bla
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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-redhat-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) b inner_main
Breakpoint 1 at 0x804855a: file bla.cc, line 9.
(gdb) r
[Thread debugging using libthread_db enabled]
[New Thread -1208211760 (LWP 864)]
[Switching to Thread -1208211760 (LWP 864)]

Breakpoint 1, inner_main (closure=0x0, argc=1, argv=0xbf9a8404) at bla.cc:9
9         scm_shell (argc, argv);
(gdb) print scm_display(0x404, scm_current_output_port ())
Segmentation fault

Comment 1 Han-Wen Nienhuys 2006-09-16 22:21:45 UTC
Created attachment 136451 [details]
C++ file to debug.

Comment 2 Han-Wen Nienhuys 2006-09-16 22:23:26 UTC
note that this has been a problem ever since I upgraded to FC6 test1. Reverting
to GDB 6.3 (FC5) solves the problem.

Comment 3 Jan Kratochvil 2006-09-20 16:02:31 UTC
Not reproducible for me on i686 both RawHide gdb-6.5-8.fc6.i386 and on FC6test1 
gdb-6.3.0.0-1.131.FC6.i386:
(gdb) print scm_display(0x404, scm_current_output_port ())
()$1 = 1284
Could you please provide a core file for gdb?
(ulimit -c unlimited;gdb ./bla;ls -l core*)


Comment 4 Han-Wen Nienhuys 2006-09-20 17:32:35 UTC
[lilydev@haring tmp]$ gdb gdb
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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-redhat-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) r /tmp/bla
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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-redhat-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) b inner_main
Breakpoint 1 at 0x804855a: file bla.cc, line 9.
(gdb) r
[Thread debugging using libthread_db enabled]
[New Thread -1208121648 (LWP 4655)]
[Switching to Thread -1208121648 (LWP 4655)]
Breakpoint 1, inner_main (closure=0x0, argc=1, argv=0xbf91f374) at bla.cc:9
9         scm_shell (argc, argv);
(gdb) print scm_display(0x404, scm_current_output_port ())

Program received signal SIGSEGV, Segmentation fault.
0x0016d313 in strlen () from /lib/libc.so.6
(gdb) bt
#0  0x0016d313 in strlen () from /lib/libc.so.6
#1  0x081b4066 in cp_demangled_name_to_comp (demangled_name=0x0, memory=0xbfc252c0, 
    errmsg=0x0) at cp-name-parser.y:1991
#2  0x081a8ee3 in cp_func_name (full_name=0x0) at gdb/cp-support.c:331
#3  0x080f56f3 in find_overload_match (arg_types=0xbfc25360, nargs=0, name=0x0,
method=0, 
    lax=0, objp=0x0, fsym=0x8e9c184, valp=0x0, symp=0xbfc2551c, staticp=0x0)
    at gdb/valops.c:1850
#4  0x080f10c1 in evaluate_subexp_standard (expect_type=0x8e8658c, exp=0x8b55570, 
    pos=0xbfc259c4, noside=EVAL_NORMAL) at gdb/eval.c:1209
#5  0x080ed976 in evaluate_subexp (expect_type=0x0, exp=0x0, pos=0x0,
noside=EVAL_NORMAL)
    at gdb/eval.c:72
#6  0x080f15ad in evaluate_subexp_standard (expect_type=0x0, exp=0x8b55570, 
    pos=0xbfc259c4, noside=EVAL_NORMAL) at gdb/eval.c:1118
#7  0x080ed976 in evaluate_subexp (expect_type=0x0, exp=0x0, pos=0x0,
noside=EVAL_NORMAL)
    at gdb/eval.c:72
#8  0x080ed9a1 in evaluate_expression (exp=0x8b55570) at gdb/eval.c:162
#9  0x080ff97d in print_command_1 (
    exp=0x895e8b6 "scm_display(0x404, scm_current_output_port ())", inspect=0, 
    voidprint=1) at gdb/printcmd.c:916
#10 0x08085593 in execute_command (p=0x895e8e3 ")", from_tty=0) at gdb/top.c:452
#11 0x081254ef in command_handler (
    command=0x895e8b0 "print scm_display(0x404, scm_current_output_port ())")
    at gdb/event-top.c:512
#12 0x08126262 in command_line_handler (
    rl=0x8a37f18 "print scm_display(0x404, scm_current_output_port ())")
    at gdb/event-top.c:797
#13 0x081d3484 in rl_callback_read_char () at readline/callback.c:204
#14 0x081256bb in rl_callback_read_char_wrapper (client_data=0x0) at
gdb/event-top.c:178
#15 0x0812503e in handle_file_event (event_file_desc=0) at gdb/event-loop.c:730
#16 0x081244f9 in process_event () at gdb/event-loop.c:343
#17 0x08124cc8 in gdb_do_one_event (data=0x0) at gdb/event-loop.c:380
#18 0x08121a73 in catch_errors (func=0x8124bb0 <gdb_do_one_event>, func_args=0x0, 
    errstring=0x824b30a "", mask=6) at gdb/exceptions.c:515
#19 0x080c9357 in tui_command_loop (data=0x0) at gdb/tui/tui-interp.c:151
#20 0x081220cf in current_interp_command_loop () at gdb/interps.c:278
#21 0x0807e57b in captured_command_loop (data=0x0) at gdb/main.c:101
#22 0x08121a73 in catch_errors (func=0x807e570 <captured_command_loop>,
func_args=0x0, 
    errstring=0x824b30a "", mask=6) at gdb/exceptions.c:515
#23 0x0807ed94 in captured_main (data=0xbfc25dc4) at gdb/main.c:835
#24 0x08121a73 in catch_errors (func=0x807e5b0 <captured_main>,
func_args=0xbfc25dc4, 
    errstring=0x824b30a "", mask=6) at gdb/exceptions.c:515
#25 0x0807e561 in gdb_main (args=0xbfc25dc4) at gdb/main.c:844
#26 0x0807e525 in main (argc=Cannot access memory at address 0x0
) at gdb/gdb.c:35
(gdb) 




Comment 5 Han-Wen Nienhuys 2006-09-20 17:38:04 UTC
Created attachment 136760 [details]
gdb core file.

Comment 6 Han-Wen Nienhuys 2006-09-20 17:39:08 UTC
Created attachment 136762 [details]
bla binary.

Comment 7 Jan Kratochvil 2006-09-20 20:11:11 UTC
Thanks, test .rpm available at:
  http://www.jankratochvil.net/priv/pr206813/
It is only trivia NULL check but I hope it will work - unrested though as it is
not reproducible for me. Do you run on the current fully-RawHide system?


Comment 8 Han-Wen Nienhuys 2006-09-20 22:52:05 UTC
works over here. Thanks!

I'm upgraded from FC5 to FC6t2 (I believe), and now run from the devel
repository, with FC5 stuff (extras, livna, greysector)



Comment 9 Alexandre Oliva 2006-09-22 06:53:59 UTC
Hi, Han-Wen, thanks for the bug report!

Jan, the patch looks good to me, thanks, great work!

Comment 10 Jan Kratochvil 2006-09-23 14:55:16 UTC
To be fixed in RawHide gdb-6.5-9.fc6.


Comment 11 Fedora Update System 2006-10-26 17:46:04 UTC
gdb-6.5-13.fc6 has been pushed for fc6, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.