Re: [PATCH 4/8] gdb/s390: Fill gen_return_address hook.

Marcin Kościelnicki
2016-03-13T09:53:11Z

On 11/03/16 16:31, Andreas Arnez wrote:
> On Fri, Mar 11 2016, Marcin KoÅ›cielnicki wrote:
>
>> We can always error() in there (and KFAIL the testcase in gdb.trace
>> that exercises it). However, returning garbage here doesn't result in
>> garbage backtrace - this only collects data, if the unwinder actually
>> doing the work later determines it should look for the return address
>> on the stack, it'll just ignore our collected $r14 and consider the
>> return address unavailable (unless another collect rule happened to
>> match it).
>
> Well, from that test case it appears that `$_ret' is generally not
> expected to work very reliably. Since r14 usually does work near
> function entry, this may be sufficient for now.
>
> So I'm OK with the patch. Please add a small comment stating that this
> is a best-can-do approach that usually works near function entry and may
> yield wrong results otherwise.
>

Thanks, pushed with this comment:

/* The "gen_return_address" gdbarch method. Since this is supposed to be
just a best-effort method, and we don't really have the means to run
the full unwinder here, just collect the link register. */