c++ - Debugging run time error of armadillo package -
i using armadillo c++ library developing rcpp package. finding debugging run time errors armadillo extremely cumbersome. have insert printout after every line fish out line @ errors coming. armadillo throw errors like:
error: subtraction: incompatible matrix dimensions: 756x1 , 26x1
and not tell information line number. using gdb not particularly helpful because error might coming after many iterations. there better line number of error occurring.
i not know rcpp integration, debug armadillo code using gdb.
just make sure never catch exceptions std::logic_error
in code. if run program within gdb, abort once error occurs , typing bt
nice trace shows line blame. , inspect variable values etc. in stack frame.
you not need step through code make use of advantages of debugger.
if rcpp not allow avoiding catch exception, should able write simple c++ test program code not block debugger.
Comments
Post a Comment