This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 5/8] [AArch64] Teach stub unwinder to terminate gracefully
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Pierre Langlois <pierre dot langlois at arm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 08 Jul 2015 17:34:46 +0100
- Subject: Re: [PATCH 5/8] [AArch64] Teach stub unwinder to terminate gracefully
- Authentication-results: sourceware.org; auth=none
- References: <1436273518-5959-1-git-send-email-pierre dot langlois at arm dot com> <1436273518-5959-6-git-send-email-pierre dot langlois at arm dot com>
Pierre Langlois <pierre.langlois@arm.com> writes:
> The stub unwinder is used on AArch64 if the target's memory is not
> readable at the current PC. If we purposely kill the inferior before
The stub unwinder is used if the target memory is not readable, for
example, PC is 0x0. Many GDB ports use stub unwinder to handle this
case. This is not aarch64 specific. Please update your commit log to
reflect this.
> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
> index 87a6d61..57976b7 100644
> --- a/gdb/aarch64-tdep.c
> +++ b/gdb/aarch64-tdep.c
> @@ -1109,13 +1109,36 @@ aarch64_make_stub_cache (struct frame_info *this_frame, void **this_cache)
> cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
> *this_cache = cache;
>
> - cache->prev_sp
> - = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
> - cache->prev_pc = get_frame_pc (this_frame);
> + TRY
> + {
> + cache->prev_sp
> + = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
I feel this is a better way to indent the code,
cache->prev_sp = get_frame_register_unsigned (this_frame,
AARCH64_SP_REGNUM);
> + cache->prev_pc = get_frame_pc (this_frame);
> + cache->available_p = 1;
> + }
> + CATCH (ex, RETURN_MASK_ERROR)
> + {
> + if (ex.error != NOT_AVAILABLE_ERROR)
> + throw_exception (ex);
> + }
> + END_CATCH
>
> return cache;
> }
>
> +static enum unwind_stop_reason
> +aarch64_stub_frame_unwind_stop_reason (struct frame_info *this_frame,
> + void **this_cache)
> +{
We need comments to this function.
> + struct aarch64_prologue_cache *cache
> + = aarch64_make_stub_cache (this_frame, this_cache);
I realise that prologue cache is used for stub unwinder. If stub
unwinder doesn't use all the fields of prologue cache, probably, we can
create a stub cache. However, it can be a follow-up patch.
This patch is good to me with the change.
--
Yao (éå)