gdb/2103: Bug stepping into Thumb function from ARM code
>Synopsis: Bug stepping into Thumb function from ARM code
>Arrival-Date: Sat Mar 25 20:18:01 GMT 2006
>Originator: Dave Bryan
Configured with: ../gcc-4.0.2/configure --target=arm-elf --prefix=/g/gnuarm-4.0.2 --enable-interwork
--enable-multilib --with-float=soft --with-newlib --with-headers=../newlib-1.14.0/newlib/libc/include --enable-languages=c,c++ Thread model: single gcc version 4.0.2
GNU gdb 188.8.131.5260325
Configured as "--host=i686-pc-cygwin --target=arm-elf".
Target is Philips LPC2214 (ARM7TDMI-S) running a simple interpreter program downloaded to target's external RAM. Debugging is done using JTAG adapter connected to GDB via OpenOCD as a remote target on localhost:3333.
When single stepping a function compiled for ARM no problem. When stepping *into* a function compiled for Thumb from a function compiled for ARM, GDB steps over rather than into the function. A non-GDB debugger with exactly the same target + elf file allows functions compiled for thumb to be stepped into correctly.
The following is the GDB output where a function compiled for Thumb, DecodeCommand(), is about to be stepped into (typing 's') from a function, main(), which was compiled for ARM. The result is the same as typing 'next':
infrun: proceed (addr=0xffffffff, signal=144, step=1)
infrun: resume (step=1, signal=0)
infrun: stop_pc = 0x81004d2c
infrun: stepped into subroutine
infrun: resume (step=0, signal=0)
infrun: stop_pc = 0x81001c2c
infrun: stepped to a different line
110 printf( "%s\n", szCmdOut);
A check for Thumb function containing debug information:
(gdb) info function DecodeCommand
All functions matching regular expression "DecodeCommand":
Compile a simple 2 function program (main & foo) for a ARM7 device (or maybe the simulator?). Compile main() for ARM and foo() for Thumb. Call foo() from main() then try to step into foo() - it will be the same as stepping over foo().
That's why - GDB doesn't know about the _from_arm stubs. It would have
to be taught that they should be skipped automatically. It thinks
you've stepped into a function that doesn't have any debugging
Thanks - I can't promise to fix this right away, but this was an
excellent bug report, so an interested hacker should be able to
fix it straightforwardly.