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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Dave Bryan

>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:
Reply | Threaded
Open this post in threaded view
|

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

Daniel Jacobowitz-2
The following reply was made to PR gdb/2103; it has been noted by GNATS.

From: Daniel Jacobowitz <[hidden email]>
To: [hidden email]
Cc: [hidden email]
Subject: Re: gdb/2103: Bug stepping into Thumb function from ARM code
Date: Sat, 25 Mar 2006 21:04:08 -0500

 On Sat, Mar 25, 2006 at 08:16:09PM -0000, [hidden email] wrote:
 > infrun: stop_pc = 0x81004d2c
 > infrun: stepped into subroutine
 
 > Non-debugging symbols:
 > 0x81004d2c  __DecodeCommand_from_arm
 
 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
 information.
 
 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.
 
 --
 Daniel Jacobowitz
 CodeSourcery