This is the mail archive of the gdb@sources.redhat.com 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]

a small bug in the arm simulator


Hi everybody!

Some time ago I have complained, that the arm simulator does not know software
traps. I am able to simulate them now with the following steps:

1.) Step until the "swi" instruction, but do not execute it
(grap the register window from insight)
2.) Set mode bits in cpsr to b00011
for example 0x800000d0 -> 0x800000d3
3.) Set pc to 0x8
4.) stepi
5.) (we should now be in the swi_wrapper) set lr to the value from the swi +4
6.) if somewhere the spsr should be read into a gp reg, adjust this value to
     the old cpsr

This should work fine.

I use the same way to simlulate interrupts. If I compile my project for the
simulator, I load the address of the interrupt wrapper directly instead
obtaining it from the AIC.

It looks the following

1.) Run prog to an arbitry location and grap the reg window from insight
2.) Set mode bits in cpsr to b00010
3.) Set pc to 0x18
4.) stepi
5.) (we should now be in the tc0_interrupt_handler) set lr to the value from the
    last instruction + 4 
6.) if somewhere the spsr should be read into a gp reg, adjust this
     value to the old cpsr

This work fine so far. The assembler interrupt handler sets lr to
interrupt_end_os_schedule_0 in my case and jumps to the approriate 
C++ function. When this function is done it jumps to the value of lr. This
looks the following:

- 0x201aa80 <interrupt_end_os_schedule_0>:	 ldmia sp!, {r1, r2, r3, r12,lr} 
- 0x201aa84 <interrupt_end_os_schedule_0+4>:	 mrs	r0,CPSR 
- 0x201aa88 <interrupt_end_os_schedule_0+8>:	 bic r0,r0, #31; 0x1f 
- 0x201aa8c <interrupt_end_os_schedule_0+12>: 	 orr r0, r0, #146	; 0x92
- 0x201aa90 <interrupt_end_os_schedule_0+16>:	 msr	CPSR_fc, r0

The bug is located in 0x201aa90. It is not writing anything at all to the cpsr.

Can anybody explain my, how to compile gdb with debug symbols turned on?

Regards,

Jens-Christian

-- 


Jens-Christian Lache
Technische Universitaet Hamburg-Harburg
www.tu-harburg.de/~sejl1601
Mail:
lache@tu-harburg.de
lache@ngi.de
Tel.:
+0491759610756


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