[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: seg fault with repeated function calls from C?
From: |
Anand Dixit |
Subject: |
Re: seg fault with repeated function calls from C? |
Date: |
Tue, 16 Dec 2008 16:23:39 -0800 |
Hi Ludo,
Looks like it accepts a post to guile-user only when you are
registered. That would explain why the first post didn't show up.
Guile version is 1.8.3 running on Ubuntu 8.04. I tried the gdb
commands you mentioned and here is a portion of the output :
This GDB was configured as "x86_64-linux-gnu"...
(no debugging symbols found)
warning: core file may not match specified executable file.
(no debugging symbols found)
(no debugging symbols found)
Core was generated by `fdtd poisson.ctl'.
Program terminated with signal 11, Segmentation fault.
[New process 12395]
#0 0x00007f18eff3b49b in ?? ()
(gdb) bt full
#0 0x00007f18eff3b49b in ?? ()
No symbol table info available.
#1 0x00007f18eff3b3c7 in ?? ()
No symbol table info available.
#2 0x00007ffff83f19dc in ?? ()
This continues to #132 lines. My C++ code is compiled with -g option.
I am not sure if this is what you expected from gdb.
Thanks,
Anand
On Tue, 2008-12-16 at 21:08 +0100, Ludovic Courtès wrote:
> Hello,
>
> Anand Dixit <address@hidden> writes:
>
> > Resending to the group.My apologies if you receive it twice but I didn't
> > see the post in the archives.
>
> Apparently I did not receive it the first time.
>
> >> I am calling a guile function from my C code. Its a fairly straight
> >> forward implementation. However, as I keep calling this function a
> >> number of times, it breaks at some point with a segmentation fault. Here
> >> is the relevant portion :
> >>
> >> int tmp,count=10000;
> >> for (tmp=1;tmp<count;tmp++) {
> >> func_symbol = scm_c_lookup("EsourceFn");
> >> func = scm_variable_ref(func_symbol);
> >> ret=scm_call_4(func,scm_int2num(i),scm_int2num(j),scm_int2num(k),scm_double2num(currentTime));
> >> retValue = scm_num2double(ret,0,"fdtd");
> >> printf("Value from guile is tmp=%d %g\n",tmp,retValue);
> >> }
> >>
> >> The break point in one case was after 4000+ calls. I was able to
> >> localize the point of failure to the "scm_call_4" line. Any clue would
> >> be greatly appreciated.
>
> Could you provide a complete backtrace with GDB? To do that, run GDB as
> follows on the `core' file yielded by the segfault:
>
> $ gdb `which guile` core
> (gdb) bt full
>
> (If there's no `core' file, type "ulimit -c unlimited".)
>
> Could it be that the `EsourceFn' symbol becomes unbound at some point,
> or that it becomes bound to something that's not a procedure? Both
> errors should normally be caught gracefully, but it's worth
> investigating.
>
> Also, which version of Guile are you using?
>
> Thanks,
> Ludo'.
>
>
>