Bill Allombert on Tue, 7 Jan 2003 22:35:07 +0100


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

Re: gp: gcd(0) error message unhelpful


On Tue, Jan 07, 2003 at 03:14:54PM -0500, Michael Somos wrote:
> pari-dev,
> 
> Perhaps I was not explicit enough, so I will explain further.

I think the problem is what you ask is harder to do that what you expect.
For example gcd(0) call gasso_proto which find the problem but has
no idea about the name of the GP function involved (gcd).

> When I first encountered the error message "incorrect type in association."
> I had no idea which of the functions that my program had called was
> the source of the error. The word "association" has no connection to
> to any name of a GP function. I am sure that others will encounter
> the same problem when they see this error message. That was also
> the problem with the tan() error message. The information that there
> was a division by zero was distinctly unhelpful since I had not done
> any explicit division by zero (I checked for that in my code). I had
> to guess which gp function that I called had done the division by zero.
> It seems to me a very important consideration that an error message
> give a clear indication of which function triggered the error.

Unfortunately this is difficult to implement without a full backtrace
capability. In fact it would be less work to implement a full
backtrace capability, and more useful and maintainable is the long
term that trying to propagate sufficient informations in the C code
to be able to know what GP function is responsible. Also we have plan
to implement a full backtrace capability, using the GP2C parser and
a simple call stack.

> Of
> course, if there was a backtrace capability, that would be even more
> helpful by giving the stack of function calls. In an ideal world, no
> program will have any errors, but this is not an ideal world. All I
> ask is some more or less explicit indication of where the error came
> from. Adding a few more words to an error message seems like a very
> minor thing to ask in order to save a lot of frustration in debugging
> erroneous code. I suppose I could just use "gdb" and get a backtrace
> that way if all else fails. Shalom, Michael

There is a tool in gp2c called gp2c-dbg that is helpful if you 
are adventurous.

Cheers,
Bill.