[Dwarf-Discuss] _dwarf_p_error(): Does it correctly handle negative error values?

David Anderson davea42@earthlink.net
Fri Jan 21 18:30:24 GMT 2011

On 01/21/2011 07:57 AM, Ron Louzon wrote:
> Sorry, somehow the original question became garbled.  Here is the same post in 
> ungarbled form:
...[ Thanks, that helps, deleted here to save space]
> If the supplied "errval" is negative, the conversion code "-errval-1" is used to
> convert "errval" to a positive index.
> Assume that "errval" had a value of -5.  This conversion generates an index of 4
> which is then used to retrieve a string from the _dwarf_errmsgs table.  Was it 
> intended to have an index which is off by 1 or should the conversion be using 
> the positive equivalent of "errval" as an index into the _dwarf_errmsgs table? 

I do not recall any intent to support negative numbers as error values, 
it is possible that an early version of libdwarf had negatives as error 
Indeed I vaguely recall that libdwarf error numbers had negative values 
very early on
(meaning 1991-1994).     But now negative error values should not  be 

I cannot remember why  that libdwarf-internal function treats negatives 
as it does,
but it seems unimportant (unless there is something I am missing here).
Perhaps a comment in the source about the intent would be a good idea.

David Anderson

Maybe it's in the basement, let me go up stairs and check . --  M. C. Escher 

More information about the Dwarf-discuss mailing list