About me | pbdR Tech | HPSC | Phyloclustering | R_note |

R_note -- The Exploration of Statistical Software R (統計軟體 R 深度歷險)
About R_note
Reference
MS Windows

Batch jobs
Function
Data/MySQL
Plot
String/Parse

Remark Lines
Classes/S3
S4 Methods
Batch more
Environment

Good Coding
Fast Loop
LAM/MPI/Rmpi
Recursion

PHP Call R
Basic C
R Call Fortran/C
R Call GSL
C Call R API
C Call R Objects
Standalone

Make Packages
C Pointer
Debug




Section: Debug

I only list few functions and commands that I use them to find bugs in R and C. I will come back to explain them when I have time.

Debug in R

  • Rdebug.pdf -- I lost the original of this file. Please tell me where this good slide came from if you knew.
  • R-debug-tools.pdf -- Roger D. Peng, UCLA, Department of Statistics.
Debug in C
  • ddd
  • Linux command: nm, ld, gprof.
  • valgrind
    Quick Example:
    SHELL> gcc -g -o a.out *.c
    SHELL> valgrind --show-reachable=yes --leak-check=full a.out
    SHELL> valgrind --track-origins=yes ./a.out
    SHELL> gcc -pg -o a.out *.c
    SHELL> ./a.out
    SHELL> gprof > a.prof
    
Debug in R call C
  • valgrind
    Quick Example:
    SHELL> gcc -shared -g -o a.so *.c
    SHELL> R -d "valgrind --show-reachable=yes --tool=memcheck --leak-check=full" \
             --vanilla < a.r
    SHELL> R -d "valgrind --track-origins=yes" --vanilla < a.r
    
    Here, "a.r" should load "a.so" at the first.
  • Debugging with GDB
Debug in MPI for R call C
  • valgrind
    Quick Example:
    SHELL> gcc -shared -g -o a.so *.c
    SHELL> mpiexec -np 2 R -d \
           "valgrind --show-reachable=yes --tool=memcheck --leak-check=full --log-file=a.log" \
           --vanilla -f a.r
    SHELL> mpiexec -np 2 R -d \
           "valgrind --track-origins=yes --log-file=a.log" \
           --vanilla -f a.r
    
    Here, "a.so" is a MPI application, "a.r" should load "a.so" at the first, and the output file "a.log" has the tracing results.
[ Go to top ]

Maintained: Wei-Chen Chen
E-Mail: wccsnow @ gmail.com
Last Revised: Dec 12 2016, 09:44 (CST Taipei, Taiwan)
Created: Oct 06 2003
free counters Best Resolution
IE6.0
1280x1024
small font