Support select ARM+THUMB mode when setting breakpoints

Fei Ding <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAGmPkfLrtRQZqs1W82+mfiS72OC8W-pPvwyBH_-7URNZ1+3y8Q@mail.gmail.com>
Hi, there:

I've found a problem when setting breakpoints on ARM+THUMB code when
there is no symbol for object file (stripped).

For example, assume now I am at an ARM instruction (CPSR.T=0), and
going to set a breakpoint at a THUMB instruction, because there is no
symbol, GDB will make a 4-byte-long instruction (SVC maybe) wrongly,
which should be a 2-byte-long THUMB breakpoint instruction instead.
After continue the target, a SIGILL/SIGSEGV/SIGBUS error will appear.

This is not a bug of GDB I think, but may confuse the programmer when
debugging, especially SIGSEGV. Here is an issue reported on AOSP:
http://code.google.com/p/android/issues/detail?id=56962, which is
mostly the same problem, but it was closed without any solution.

Personally, I've made a workaround for this problem: let the user
specify the kind of breakpoint. For example, `b *0x12345 mode
arm/thumb'. The command of `mode arm/thumb' is not required, but
optional. Do you want a patch for this? Or maybe you can fix this as
your way, key function here is `int arm_pc_is_thumb (struct gdbarch
*gdbarch, CORE_ADDR memaddr)' of arm-tdep.c

Thanks && BRs.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.