30.1.3.1. ARM Thumb encoding

Thumb examples are available at:

For both of them, we can check that we are in thumb from inside GDB with:

  • disassemble, and observe that some of the instructions are only 2 bytes long instead of always 4 as in ARM

  • print $cpsr & 0x20 which is 1 on thumb and 0 otherwise

You should contrast those examples with similar non-thumb ones of course.

We also note that thumbness of those sources is determined solely by the .thumb_func directive, which implies that there must be some metadata to allow the linker to decide how that code should be called: