Jouni Helske
2012-May-10 14:03 UTC
[R] Using valgrind to debug R, extracting column of a mts object causes valgrind to crash
Dear all, I'm trying to debug my R package with valgrind, but I cannot get past the point where I load make the data, as valgrind crashes when trying to extract a single time series object of a multivariate mts object. I'm using R 2.15.0 with platform x86_64-redhat-linux-gnu (64-bit). The valgrind.R contains code data(Seatbelts) y<-Seatbelts[,"VanKilled"] And I run valgrind with R -d "valgrind --tool=memcheck --leak-check=yes" --no-save < valgrind.R Results look like this:> data(Seatbelts) > y<-Seatbelts[,"VanKilled"]vex amd64->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xB 0xC0 0xC ==31160== valgrind: Unrecognised instruction at address 0x399fe26990. ==31160== Your program just tried to execute an instruction that Valgrind ==31160== did not recognise. There are two possible reasons for this. ==31160== 1. Your program has a bug and erroneously jumped to a non-code ==31160== location. If you are running Memcheck and you just saw a ==31160== warning about a bad jump, it's probably your program's fault. ==31160== 2. The instruction is legitimate but Valgrind doesn't handle it, ==31160== i.e. it's Valgrind's fault. If you think this is the case or ==31160== you are not sure, please let us know and we'll try to fix it. ==31160== Either way, Valgrind will now raise a SIGILL signal which will ==31160== probably kill your program. *** caught illegal operation *** address 0x399fe26990, cause 'illegal opcode' Traceback: 1: ts(y, start = start(x), frequency = frequency(x)) 2: `[.ts`(Seatbelts, , "VanKilled") 3: Seatbelts[, "VanKilled"] aborting ... ==31160===31160== HEAP SUMMARY: ==31160== in use at exit: 29,782,377 bytes in 12,590 blocks ==31160== total heap usage: 30,275 allocs, 17,685 frees, 57,159,124 bytes allocated ==31160===31160== LEAK SUMMARY: ==31160== definitely lost: 0 bytes in 0 blocks ==31160== indirectly lost: 0 bytes in 0 blocks ==31160== possibly lost: 0 bytes in 0 blocks ==31160== still reachable: 29,782,377 bytes in 12,590 blocks ==31160== suppressed: 0 bytes in 0 blocks ==31160== Reachable blocks (those to which a pointer was found) are not shown. ==31160== To see them, rerun with: --leak-check=full --show-reachable=yes ==31160===31160== For counts of detected and suppressed errors, rerun with: -v ==31160== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2) Illegal instruction (core dumped) It seems that the crash is caused by the fact that the rows of the Seatbelts are not defined in assignment, but if I use command y<-Seatbelts[1:192,"VanKilled"] the resulting object is not a time series object anymore. Is there some better way to do this? best regards, Jouni [[alternative HTML version deleted]]