Daniel Allcock on Tue, 15 Mar 2011 06:48:53 +0100


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

Re: debugging a program that uses libpari


Dear Bill,

Thank you for the tip.  It did lead me to the problem.  I had installed a debug version of the library successfully.  But when I installed it, I only installed the static version.  My linker's default is to link dynamically if possible, so it was still linking to the older non-debug dynamic version.  I just deleted the old dynamic version.

best,
Daniel


On Mar 14, 2011, at 11:08 PM, Bill Allombert wrote:

> 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.