Stan Math Library with a Debugger

I have some code built on top of the Stan/math library with unit tests in gtest that I need to run a debugger on.

I’m wondering if anyone’s figured out how to use GDB with google test on top of the stan math library?

Thanks.

./runTests.py -m /pathway/

and add -g flag to make/local, and run gdb with gdb /pathway/file.o.

Have to run gdb on the shared object file, which requires some additional flags, -fPIC and -o, which are added at the end of my make/standalone, with this block of code pulled from github:

##
# Shared library target
##
CXXFLAGS += -fPIC

%.so: %.o
	$(CXX) -shared $< -o $@

And then gdb works.

1 Like