Step backwards in time in your program to view registers and memory with UDB
“I used UDB to examine registers to find the address of an object. Without UDB, it would have taken me twice as long to debug the problem. I would have ended up running the code over and over with full debug compile to catch the problem. With UDB, I can just back up to the root cause.”
Christian Schafmeister, Founder of ThirdLaw Technologies and Professor of the Chemistry Dept at Temple University
Clasp is a new Common Lisp implementation that seamlessly interoperates with C++ libraries and programs using LLVM for compilation to native code. This allows Clap to take advantage of a vast array of preexisting libraries and programs used in the scientific computing ecosystem.
I was working on improving the Clasp programming experience when I hit a bug.
I decided to use UDB to debug the incorporation of a precise garbage collection mode for the Boehm-Demers-Weiser Garbage Collector into Clasp.
It is incredibly useful to be able to step backwards in time in fully optimized code and examine registers to find and examine objects in memory. Even when local variable debug information has been optimized away, I can use UDB to step to the first instruction of a function and then examine the registers to obtain the arguments passed to a function in the %rdi, %rsi etc registers.
From a usability perspective, the emacs interoperation with UDB is excellent. It is very helpful to have the source code, disassembly, local variables, and registers all up on the screen at the same time.
Without UDB, I would have ended up running the code over and over with full debug compile to catch the problem. It would be a very slow process. With UDB, I can just back up to the root cause.
Learn more about bringing Common List and C++ together on the clasp Github web page.
This article is a guest post by Christian Schafmeister, Founder of ThirdLaw Technologies LLC and Professor of the Chemistry Dept at Temple University, Pennsylvania.