Bill Allombert on Mon, 14 Mar 2011 15:10:06 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: debugging a program that uses libpari


On Mon, Mar 14, 2011 at 01:38:06PM +0900, Daniel Allcock wrote:
> Hi all,
> 
> I am debugging a program that uses lipari, and am having trouble debugging
> because pari seems to hide or demolish the stack trace.  I set a breakpoint
> in gdb on pari_err, and it does break there when an error arises.  But there
> is no useful stack information, so I can't figure out which part of my code
> is causing the problem.
> 
> Below is an example of what I have run into.  
> 
> I compiled my own code using gcc -O0 to disable things like omitting the stack pointer.
> 
> I built the debug version of pari.  (I just redid the install to make sure; I
> used /Configure -a and chose debugging when offered it.)
> 
> I'd appreciate any help about what I am doing wrong.  Am not sure what info
> might be useful so have just given the overview.  If it matters, I am using
> the gmp kernel and am programming in C++, using g++.  (Though the library was
> compiled with gcc.)

Are you sure the run-time linker pick up the right libpari ?

As a first step, you can try the following:
./Configure -g
make gp.dbg
gdb gp.dbg
br pari_err
run
1/0 

You should get
Breakpoint 1, pari_err (numerr=27) at ../src/language/init.c:974
974       va_start(ap,numerr);

Cheers,
Bill.