This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM Simulator Bug?

> Hi Richard,
> Thanks for the reply.
> >It's more likely to be the way you are trying to get into Thumb state.  Try
> >
> >	adr	r0, __start_of_thumb
> Should this line not be
> 	adr	r0, __start_of_thumb+1
> To set the LSB to tell the core we want to enter Thumb mode

Well, no.  If the bottom bit isn't being set automatically when the target 
is a thumb symbol then that's really a bug in the tools.

> >	bx	r0
> >	.code 16
> >	.global __start_of_thumb
> >	.thumb_func
> >__start_of_thumb:
> >
> >
> >This is really brokenness in the way gas implements ARM and Thumb code 
> >areas, but it's hard to fix properly until GAS starts using mapping 
> >symbols.
> If I use the +1 code above, and set a breakpoint at the adr command, I can single
> step successfully past the BX command and into my main.

It appears that GAS is broken:

$ cat test.s
	adr	r0, __thumb
	bx	r0
	.globl	__thumb

$ arm-elf-as test.s -o test.o
$ arm-elf-objdump -dr test.o

test.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <__thumb-0x8>:
   0:   e28f0000        add     r0, pc, #0      ; 0x0	####### Bzzt no!
   4:   e12fff10        bx      r0

00000008 <__thumb>:
   8:   46c0            nop                     (mov r8, r8)

Try using an 

	LDR r0, =__thumb

expression.  You'll need to squeeze the constant pool in somewhere.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]