[Rcpp-devel] RCpp issue (SIGTRAP)

Amit Gupta amit.gupta at alpha-grep.com
Thu Dec 11 13:52:28 CET 2014


Hi Dirk , thanks for your reply.


When i run the sample 7 as a standalone program, (I mean executing
./rinside_sample7 ) , the assignment to C++ double works fine  *double d1 =
Rcpp::as< double >(R.parseEval(txt));* and I get the desired output.

But when I run the same set of commands


* txt = "m <- 1.23";        double d1 = Rcpp::as< double
>(R.parseEval(txt));        std::cout << "d1 " << d1 << std::endl;*



in my codebase , the execution gets stuck at the call of

*"double d1 = Rcpp::as< double >(R.parseEval(txt));"*



































*when i look further into this, this is the backtrace that I get "(gdb)
n345        std::string txt = "m <- 1.23;";(gdb) n349            double d1
= Rcpp::as< double >(R.parseEval(txt));(gdb) s0x0000003a088e8770 in
profil_counter () from /lib64/libc.so.6(gdb) sSingle stepping until exit
from function profil_counter,which has no line number
information.RInside::parseEval (this=0x7fffffffdb20, line="m <- 1.23;") at
RInside.cpp:379379    RInside.cpp: No such file or directory.    in
RInside.cpp(gdb) s381    in RInside.cpp(gdb) s379    in RInside.cpp(gdb)
s381    in RInside.cpp(gdb) s0x0000003a088e8770 in profil_counter () from
/lib64/libc.so.6(gdb) nSingle stepping until exit from function
profil_counter,which has no line number information.0x0000003a08009d40 in
_dl_lookup_symbol_x () from /lib64/ld-linux-x86-64.so.2(gdb) nSingle
stepping until exit from function _dl_lookup_symbol_x,which has no line
number information.Program received signal SIGTRAP, Trace/breakpoint
trap.0x0000003a08009342 in do_lookup_x () from /lib64/ld-linux-x86-64.so.2"*


*ThanksAmit*


On Thu, Dec 11, 2014 at 5:50 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 11 December 2014 at 12:02, Amit Gupta wrote:
> | Hi all,
> |
> | Can anyone please help me in this.
>
> [...]
>
> |     When I replace the above code with
> |
> |     std::string txt = "m <- c(1,2,3,4,5);"
> |                   "print(mean(m));";
> |                    R.parseEval(txt);
> |
> |     This code works perfectly printing the mean of the vector.
> |
> |     My guess is that the problem is coming somewhere in typecasting the
> output
> |     of R.parseEval to double etc.
> |
> |     Can someone please look into this. Thanks
>
> A quick glance into examples/standard/*.cpp reveals that files
>
>   sample7.cpp
>   sample10.cpp
>
> both assign to a double.  What happens if you run those?
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141211/b4a37703/attachment.html>


More information about the Rcpp-devel mailing list