This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 5/8] [AArch64] Teach stub unwinder to terminate gracefully


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]