guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Segfault when using readline and dynamically linked code


From: ralf
Subject: Segfault when using readline and dynamically linked code
Date: Wed, 3 Oct 2001 19:13:17 +0200
User-agent: Mutt/1.0.1i

Hello everyone,

i just encountered a strange problem:
i  wrote some small wrapper code that creates guile bindings
for some external library. Everything works fine (thank's for
the nice documentation) _unless_ i activate readline support.
As soon as i use the tab key guile segfaults. 
Using readline without my custom module works without any
problems, so i assume the segfault is caused by my code. As a
starting point i compiled guile and my module with debuging
support, but the backtraces i get aren't very helpfull: 

bash-2.05$ gdb guile
GNU gdb 19990928
Copyright 1998 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 "i686-pc-linux-gnu"...
(gdb) r
Starting program: /usr/local/bin/guile
guile> (load "test.scm")guile> (load "test.scm")
guile> d
Program received signal SIGSEGV, Segmentation fault.
0x400569ec in scm_gc_mark (p=0x0) at gc.c:1223
1223      if (SCM_GCMARKP (ptr))
(gdb) bt
#0  0x400569ec in scm_gc_mark (p=0x0) at gc.c:1223
#1  0x40056d2c in scm_gc_mark (p=0x40332320) at gc.c:1239
#2  0x40056f31 in scm_gc_mark (p=0x40281a30) at gc.c:1323
  [...]
#11 0x40056d2c in scm_gc_mark (p=0x403627e0) at gc.c:1239
#12 0x40057e9a in scm_mark_locations (x=0xbfffcd08, n=3000) at gc.c:1571
#13 0x400567e9 in scm_igc (what=0x400ce3cc "cells") at gc.c:1099
#14 0x400565ea in scm_gc_for_newcell (master=0x400d68a0, freelist=0x400d6898)
    at gc.c:979
#15 0x400835e8 in scm_cons2 (w=0x40334c98, x=0x403627f8, y=0x2974)
    at pairs.c:98
#16 0x4004fe35 in scm_deval (x=0x4029e960, env=0x403627e0) at eval.c:2938
#17 0x4004b6f5 in scm_deval (x=0x4029e958, env=0x403627e0) at eval.c:1945
#18 0x4004c5c2 in scm_deval (x=0x4029e920, env=0x403627e0) at eval.c:2110
#19 0x40051972 in scm_dapply (proc=0x40335318, arg1=0x2974, args=0x40362790)
    at eval.c:3605
#20 0x40048eef in scm_apply (proc=0x40336cc8, arg1=0x805bb70, args=0x40362760)
    at eval.c:3407
#21 0x40048c3b in scm_call_3 (proc=0x40336cc8, arg1=0x805bb70, arg2=0x80696d8,
    arg3=0x40361f08) at eval.c:3281
#22 0x400699f0 in fold_proc (proc=0x40336cc8, key=0x805bb70, data=0x80696d8,
    value=0x40361f08) at hashtab.c:515
#23 0x40069bac in scm_internal_hash_fold (fn=0x400699c8 <fold_proc>,
    closure=0x40336cc8, init=0x40336ac0, table=0x804a040) at hashtab.c:551
#24 0x40069aae in scm_hash_fold (proc=0x40336cc8, init=0x40336ac0,
    table=0x804a040) at hashtab.c:532
#25 0x4005086b in scm_deval (x=0x4029e7a0, env=0x40336ce0) at eval.c:3060
#26 0x4004f3d8 in scm_deval (x=0x4029d708, env=0x40336ba0) at eval.c:2771
#27 0x4004c429 in scm_deval (x=0x40335090, env=0x40336ba0) at eval.c:2098
#28 0x4004c429 in scm_deval (x=0x40335090, env=0x403350d0) at eval.c:2098
#29 0x4004fdc8 in scm_deval (x=0x4028e330, env=0x40334720) at eval.c:2921
#30 0x4004cd22 in scm_deval (x=0x4028e328, env=0x40334720) at eval.c:2208
#31 0x40051894 in scm_dapply (proc=0x4028e058, arg1=0x4028e228,
    args=0x40334720) at eval.c:3602
#32 0x40048eef in scm_apply (proc=0x4028e038, arg1=0x40334700, args=0x2974)
    at eval.c:3407
#33 0x400e12c5 in completion_function (text=0x80b6550 "d", continuep=0)
    at readline.c:411
#34 0x402c66e7 in rl_completion_matches () from /lib/libreadline.so.4
#35 0x402c57e6 in rl_insert_completions () from /lib/libreadline.so.4
#36 0x402c6481 in rl_complete_internal () from /lib/libreadline.so.4
#37 0x402c506c in rl_complete () from /lib/libreadline.so.4
#38 0x402bfc14 in _rl_dispatch () from /lib/libreadline.so.4
#39 0x402bf930 in readline_internal_char () from /lib/libreadline.so.4
#40 0x402bfa1b in readline_internal_char () from /lib/libreadline.so.4
#41 0x402bfa4d in readline_internal_char () from /lib/libreadline.so.4
#42 0x402bf609 in readline () from /lib/libreadline.so.4
#43 0x400e0be1 in internal_readline (text=0x40281ea8) at readline.c:261
#44 0x400a38e2 in scm_internal_catch (tag=0x2374,
    body=0x400e0b5c <internal_readline>, body_data=0x40281ea8,
    handler=0x400e0ad8 <handle_error>, handler_data=0x0) at throw.c:205
#45 0x400e0a33 in scm_readline (text=0x40281ea8, inp=0x806fe70,
    outp=0x806fe90, read_hook=0x402951b0) at readline.c:207
#46 0x40066ca5 in scm_gsubr_apply (args=0x2974) at gsubr.c:247
#47 0x4005152a in scm_dapply (proc=0x804a318, arg1=0x40278730, args=0x403346b0)
    at eval.c:3530
#48 0x400502e3 in scm_deval (x=0x4027d9d8, env=0x40334670) at eval.c:2967
#49 0x4004ca09 in scm_deval (x=0x4031e420, env=0x40334670) at eval.c:2161
#50 0x4004ca09 in scm_deval (x=0x4031e3a8, env=0x40334648) at eval.c:2161
#51 0x4004cd22 in scm_deval (x=0x4027e508, env=0x403345c0) at eval.c:2208
#52 0x4004b9b4 in scm_deval (x=0x4027e500, env=0x403345c0) at eval.c:1999
#53 0x40051972 in scm_dapply (proc=0x40294d38, arg1=0x2974, args=0x40334570)
---Type <return> to continue, or q <return> to quit---q
 at Quit
(gdb) q
The program is running.  Exit anyway? (y or n) y

So, to me it looks like completion_function triggers a garbage collection
(correct me if i'm wrong) which causes the segfault. I tried this with both
the snapschot (V. 1.5.4) as well a last weeks CVS version (1.7.0).
In the above trace i just load "test.scm" , this program only uses
my module and binds some symbols to smobs. The readline function should
 complete 'doc1', a symbol bould to one of my smobs. Any pointers to where
i might start looking?

 Ralf Mattes






reply via email to

[Prev in Thread] Current Thread [Next in Thread]