gdb/2103: Bug stepping into Thumb function from ARM code

dave.bryan@gmail.com dave.bryan@gmail.com
Sat Mar 25 20:18:00 GMT 2006


>Number:         2103
>Category:       gdb
>Synopsis:       Bug stepping into Thumb function from ARM code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 25 20:18:01 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Dave Bryan
>Release:        unknown-1.0
>Organization:
>Environment:
Environment
===========
CYGWIN_NT-5.1 samsung 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin

GCC
===
Target: arm-elf
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
GDB
===
GNU gdb 6.4.50.20060325
Configured as "--host=i686-pc-cygwin --target=arm-elf".
>Description:
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':
 
109                     DecodeCommand();
(gdb) s
infrun: proceed (addr=0xffffffff, signal=144, step=1)
infrun: resume (step=1, signal=0)
infrun: wait_for_inferior
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x81004d2c
infrun: stepped into subroutine
infrun: resume (step=0, signal=0)
infrun: prepare_to_wait
infrun: infwait_normal_state
infrun: TARGET_WAITKIND_STOPPED
infrun: stop_pc = 0x81001c2c
infrun: BPSTATE_WHAT_STEP_RESUME
infrun: stepped to a different line
infrun: stop_stepping
110                     printf( "%s\n", szCmdOut);
(gdb)

A check for Thumb function containing debug information:

(gdb) info function DecodeCommand
All functions matching regular expression "DecodeCommand":

File Commands.c:
BOOL DecodeCommand();

Non-debugging symbols:
0x81004d2c  __DecodeCommand_from_arm
(gdb)
>How-To-Repeat:
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().
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gdb-prs mailing list