[PATCH] Tweak gdb.trace/tfile.c for thumb mode

Pedro Alves palves@redhat.com
Wed Jul 9 14:52:00 GMT 2014

On 06/30/2014 04:50 AM, Yao Qi wrote:
> +  /* Although the thumb functions are two-bytes aligned, ld sets the
> +     bit 0 of these function references.  Clear the bit 0.  */
> +#if defined(__thumb__) || defined(__thumb2__)
> +  func_addr &= ~1;
> +#endif

I suggest putting the comment within the #if block, and write:

#if defined(__thumb__) || defined(__thumb2__)
  /* Although Thumb functions are two-byte aligned, function
     pointers have the Thumb bit set.  Clear it.  */
  func_addr &= ~1;

(This bit is widely known as the "Thumb bit", so call it that,
and remove a few "the"'s that sound odd to me, and say
"two-byte aligned".)

Otherwise looks good.

Pedro Alves

More information about the Gdb-patches mailing list