Hmm.  In the various lookup calls (some dwarf_* calls too), I don't think
"nothing found" is really an error.  Since the error codes are not defined
in the API, 0 is the only code specifically known to callers.  So I think
the status quo might be better, because it's the only way for a caller to
distinguish "just not found" vs "some unusual error". i.e.:

        int error = dwfl_errno (); // clears thread variable
        if (error)
                ... dwfl_errmsg (error) ...
        else
                no error, just no match

IMHO in dwfl_addrmodule I expect "just no match" to be a "normal"
situation, because you'd pass some random address to it to find out if it's
a code address vs a heap/stack/etc address.  If there is some error in the
DWARF, you want to barf with whatever dwfl_errmsg says.  If it is just a
heap/stack/etc address, you want to just know that there was no match.

I agree that this interface style is somewhat awkward, but it's what we've
got already in libdw.  In the long run, I think you'll instead be using
proper C++ interfaces that will only return values for match/no-match and
will instead throw exceptions for real errors.


Thanks,
Roland

_______________________________________________
elfutils-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/elfutils-devel

Reply via email to