Quote:
Originally Posted by xoran99
I've been writing a lot of code that uses The GNU Multiple Precision Arithmetic Library, and I would like to be able to use gdb on these programs. The issue is being able to print the values of gmp variables. The documentation suggests using this .gdbinit, but if I try I tend to get segfaults.
So, I have two questions. - How would I use the .gdbinit file to print the value of a gmp variable?
- I could try to call gmp_printf (which is in the gmp library) to print out the values, but these functions are unavailable to me (no symbol "gmp_printf" in the current context). How would I use these functions?
Thanks in advance.
|
Well, first I read Paul's answer - I am not sure what segfaults occur - in the program or in 'gdb' itself - I'm afraid the latter, but I am not sure.
A couple of thoughts not directly addressing your problem:
1) if your 'gdb' is not the newest (7.1) and it crashes, build the newest one from source - I've just done it using
Code:
./configure CC=/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.4.4/binsh/gcc CFLAGS=-I/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/include LDFLAGS=-L/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/lib
make
commands - 'gdb' needs 'ncurses' (even though the documentation doesn't mention it), so you'll need development headers. Hopefully your stock gcc + ncurses will be good enough.
2) gmp-5.0.0 might be "odd", even though I didn't look inside. I mean that gmp-5.0.1 + mpfr-3.0.0 used to build gcc-4.4.4, which are all then used to build sbcl-1.0.39, cause build failure of the latter.
OTOH, gmp-4.3.2 + mpfr-2.4.2 used to build gcc-4.4.4, which are all then used to build sbcl-1.0.39, produce normal build.
I didn't dig deeper.