On Sat, Aug 11, 2012 at 21:34:35 -0700, Arun Sharma wrote:
On Fri, Aug 10, 2012 at 7:03 AM, Martin Milata
<mmilata(a)redhat.com> wrote:
>
> + /* Closer symbol was found (possibly truncated). */
> + if (ret_mdi == 0 || ret_mdi == -UNW_ENOMEM)
> + {
> + ret = ret_mdi;
> + }
> +
> + munmap (mdi.image, mdi.size);
If the second lookup fails with -UNW_ENOMEM, looks like you propagate
that error up the stack. Why not propagate the best known answer from
the first lookup?
The idea is that usually only the closest symbol is useful as it
corresponds to the procedure name. If the closest symbol is too large
and some other one that fits in the buffer is returned, it will most
likely be name of some unrelated procedure.
Also, such behaviour is consistent with what the original
unw_get_proc_name does - it returns the closest symbol regardless of
whether it's truncated or not. Or am I missing something?
Martin