R packages: breakpoint setup for C function with gdb in Debian (Testing) -
i'd debug c function package of mine.
i check execution gdb
, although find difficulties set breakpoints.
following 4.4.1 finding entry points in dynamically loaded code writing r extensions:
1) call debugger on r executable, example r -d gdb.
l@np350v5c:~$ r -d gdb gnu gdb (debian 7.7.1+dfsg-5) 7.7.1 copyright (c) 2014 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law. type "show copying" , "show warranty" details. gdb configured "x86_64-linux-gnu". type "show configuration" configuration details. bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. find gdb manual , other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. help, type "help". type "apropos word" search commands related "word"... reading symbols /usr/lib/r/bin/exec/r...(no debugging symbols found)...done. (gdb)
2) start r.
(gdb) run starting program: /usr/lib/r/bin/exec/r --no-save --no-restore -q [thread debugging using libthread_db enabled] using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [new thread 0x7ffff338d700 (lwp 6171)] [new thread 0x7ffff2b8c700 (lwp 6172)] [new thread 0x7ffff038b700 (lwp 6173)] [new thread 0x7fffedb8a700 (lwp 6174)] [new thread 0x7fffeb389700 (lwp 6175)] [new thread 0x7fffe8b88700 (lwp 6176)] [new thread 0x7fffe6387700 (lwp 6177)] [thread 0x7ffff338d700 (lwp 6171) exited] [thread 0x7fffeb389700 (lwp 6175) exited] [thread 0x7ffff038b700 (lwp 6173) exited] [thread 0x7fffe6387700 (lwp 6177) exited] [thread 0x7ffff2b8c700 (lwp 6172) exited] [thread 0x7fffe8b88700 (lwp 6176) exited] [thread 0x7fffedb8a700 (lwp 6174) exited]
3) @ r prompt, use dyn.load or library load shared object.
> library(ifctools)
4) send interrupt signal. put debugger prompt.
> # <-- ctrl + c here program received signal sigint, interrupt. 0x00007ffff71202b3 in select () @ ../sysdeps/unix/syscall-template.s:81 81 ../sysdeps/unix/syscall-template.s: file o directory non esistente.
5) set breakpoints in code. c function need @ called reg_guess_fc
.
(gdb) b reg_guess_fc breakpoint 1 @ 0x7fffe0e8de50: file reg_guess_fc.c, line 13.
6) continue execution of r typing signal 0ret.
(gdb) signal 0 [enter] continuing no signal. [enter again] > #now believe i'm supposed call code breakpointed, > example(guess_fc) gss_fc> ## using fictious data gss_fc> surnames <- c("rossi", "bianchi") gss_fc> names <- c("mario", "giovanna") gss_fc> birthdates <- as.date(c("1960-01-01", "1970-01-01")) gss_fc> female <- c(false, true) gss_fc> comune_of_birth <- c("f205", # milan gss_fc "h501") # rome gss_fc> guess_fc(surnames, names, birthdates, female, comune_of_birth) [1] true true
in other words c function reg_guess_fc
, called r function guess_fc
not stopped @ line 1 hoped setting breakpoint above. missing?
if can help, package here.
guess_fc()
calls
rval <- .call("reg_wrong_fc", surname, name, year, month, day, female, codice_catastale, package = "ifctools")
so maybe not calling c code thought were? (i'd have entered c
(c)ontinue execution, rather signal 0
.)
Comments
Post a Comment