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 2/3] Displaced stepping for 16-bit Thumb instructions


Yao Qi wrote:

> Yes.  If I understand you correctly, modinsn is a 'unsigned long' array.
>   * ARM instruction occupies one slot with flag `ARM',
>   * Thumb 16 bit instruction occupies one slot with flag `Thumb'
>   * Thumb 32-bit instruction occupies *two* slots with flag `Thumb',
> That works, I think.

Yes, that's what I suggested.

> I just recall one extra benefit of my original approach is about sharing
> some copy_* routines for Thumb 32-bit instructions and ARM instructions.
>  In ARM manual, I noticed that some encodings of 32-bit Thumb-2
> instructions are the same ARM counterparts (such as preload preload_reg,
> and svc_copro), so that their copy routines can be shared.

Huh.  Sharing copy routines seems a bit dangerous, because it only works
if the copy routine only looks at those bits that are identical between
the ARM and Thumb encoding (e.g. even for all the NEON instuctions, the
position of the U bit is different), *and* the copy routine always only
copies instructions in the correct format into the output buffer.

While this may happen to work in certain cases (e.g. if we look only at
a couple of bits and then do copy_unmodified), it seems a bit fragile
as errors may be easily introduced by future changes.

Having clearly separate copy routines for ARM and Thumb seems preferable
to me, therefore; even if it leads to small amount of duplication.  (If
we're talking *large* amounts of duplicated code here, it might be
possible to factor out some commonalities into helpers ...)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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