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: RFA: [ARM] "svc" insn check at irrelevant address in ARM unwind info sniffer


Joel Brobecker <brobecker@adacore.com> writes:

Hi Joel,

>        /* We also assume exception information is valid if we're currently
>  	 blocked in a system call.  The system library is supposed to
> -	 ensure this, so that e.g. pthread cancellation works.  */
> -      if (arm_frame_is_thumb (this_frame))
> -	{
> -	  LONGEST insn;
> +	 ensure this, so that e.g. pthread cancellation works.
>  
> -	  if (safe_read_memory_integer (get_frame_pc (this_frame) - 2, 2,
> -					byte_order_for_code, &insn)
> -	      && (insn & 0xff00) == 0xdf00 /* svc */)
> -	    exc_valid = 1;
> -	}
> -      else
> +	 But before verifying the instruction at the point of call, make
> +	 sure this_frame is actually making a call (or, said differently,
> +	 that it is not the innermost frame).  For that, we compare
> +	 this_frame's PC vs this_frame's addr_in_block. If equal, it means
> +	 there is no call (otherwise, the PC would be the return address,
> +	 which is the instruction after the call).  */
> +
> +      if (get_frame_pc (this_frame) != addr_in_block)
>  	{

I don't think the innermost-ness of THIS_FRAME matters here.  The root
cause of this problem, IMO, is that get_frame_pc (this_frame) is
the *first* instruction of the function, so get_frame_pc (this_frame) - 2
can be anything, instruction of other functions, or non-instruction at
all (your case).  So instead, we may need the check like this?
 
 if (get_frame_pc (this_frame) > func_start)

-- 
Yao (éå)


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