From wangtong at usc.edu  Sun May 13 06:21:00 2007
From: wangtong at usc.edu (Tong Wang)
Date: Sat, 12 May 2007 21:21:00 -0700
Subject: [Rd] Strange behavior of debugger
Message-ID: <dd6eb99f7435.46462fbc@usc.edu>

Hi, All:
    I had some trouble debugging C source dynamically loaded into R , when I issued N  in gdb(or insight) , the debugger, instead of moving downward step by step, jumped to strange positions (upward, downward, one step, a few steps away).

   To enter the debugger, I issued  gdb(insight) Rgui.exe in Cygwin and add this line :  asm("int $3");   to my C code.  After 
entering R, I did something like:  dyn.load("mypath/mycode.dll") , then  out <- .C("myfun", arg1=as.numeric(a),......) 
The C files are compiled with:    R CMD SHLIB -d myfile.c
   
   I am using Win XP + Cygwin, and I have a binary version and a cygwin compiled version of R-2.4.1 installed. This same 
behavior show up in both installations.  One thing is, even though I set the evn  DEBUG as T when built R from sourse in 
Cygwin,  the Rgui.exe I got doesn't seem to contain debug info.  (although R.exe does) , I am not sure if this means I did something wrong.  

   Appreciate any help.

tong



[Rd] Strange behavior of debugger
Tong Wang