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 v2] xtensa: initialize call_abi in xtensa_tdep


On Thu, Aug 20, 2015 at 03:52:40PM +0300, Max Filippov wrote:
> Use XSHAL_ABI value provided by xtensa-config.h to correctly initialize
> xtensa_tdep.call_abi
> This fixes calls to functions from GDB that otherwise fail with the
> following assertion in call0 configuration:
> 
>   gdb/regcache.c:602: internal-error: regcache_raw_read: Assertion
>   `regnum >= 0 && regnum < regcache->descr->nr_raw_registers' failed.
> 
> gdb/
> 	* xtensa-tdep.h (XTENSA_GDBARCH_TDEP_INSTANTIATE): Initialize
> 	call_abi using XSHAL_ABI macro.

I think you missed or ignored one comment about the fact that
the code I am seeing in current xtensa-tdep.h is not what your patch
says. So it seems to me you are sending a patch that doesn't seem
to be applying to master.

I would also be beneficial to explore what I was trying to explain
regarding the fact that determining the proper ABI should be done
on the fly, rather than hardcoded. This is particularly true with
the fact that changing the hardcoded values involves adapting
the contents of a file, which is not user-friendly, and nearly
impossible for anyone but a knowledgeable GDB contributor.

> ---
> Changes v1 -> v2:
> - fix call_abi code formatting.
> 
>  gdb/xtensa-tdep.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
> index adacaf8..ff090f3 100644
> --- a/gdb/xtensa-tdep.h
> +++ b/gdb/xtensa-tdep.h
> @@ -246,7 +246,9 @@ struct gdbarch_tdep
>  	  .spill_location = -1,					\
>  	  .spill_size = (spillsz),				\
>  	  .unused = 0,						\
> -	  .call_abi = 0,					\
> +	  .call_abi = (XSHAL_ABI == XTHAL_ABI_CALL0		\
> +		       ? CallAbiCall0Only			\
> +		       : CallAbiDefault),			\
>  	  .debug_interrupt_level = XCHAL_DEBUGLEVEL,		\
>  	  .icache_line_bytes = XCHAL_ICACHE_LINESIZE,		\
>  	  .dcache_line_bytes = XCHAL_DCACHE_LINESIZE,		\
> -- 
> 1.8.1.4

-- 
Joel


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