unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Anand Dixit <Anand.Dixit@Sun.COM>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-user@gnu.org
Subject: Re: seg fault with repeated function calls from C?
Date: Tue, 16 Dec 2008 16:23:39 -0800	[thread overview]
Message-ID: <1229473419.11638.13.camel@home-desktop> (raw)
In-Reply-To: <871vw7hoie.fsf@gnu.org>

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 <Anand.Dixit@Sun.COM> 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'.
> 
> 
> 





  reply	other threads:[~2008-12-17  0:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16  6:22 seg fault with repeated function calls from C? Anand Dixit
2008-12-16 17:17 ` Anand Dixit
2008-12-16 20:08   ` Ludovic Courtès
2008-12-17  0:23     ` Anand Dixit [this message]
2008-12-17 10:28       ` Neil Jerram
2008-12-16 22:23   ` Andy Wingo
2008-12-17  0:46     ` Anand Dixit
2008-12-17  2:46       ` Anand Dixit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229473419.11638.13.camel@home-desktop \
    --to=anand.dixit@sun.com \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).