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]

Re: Does GDB suports mixed ARM_code (ARM+Thumb) debugging?



Joel Brenner <joel.brenner@tchip.com> wrote:

> Yes, if I set break points at the begin of MainApp gdb stops correctly.
> It stops olso correctly in thumb_func(). Whi gdb dosen't step correctly
> ower bx command and calls between ARM-code and Thumb-code ?

In GDB 4.17, there is no support for the BX instruction in
arm_get_next_pc() and thumb_get_next_pc() (both is gdb/arm-tdep.c).  It is
apparently still missing in 5.0.

Here is the diff between my version of thumb_get_next_pc() (which supports
BX and
a couple of other missing instructions) and the original one (4.17):

@@ -1164,6 +1180,23 @@
       offset = (sbits (inst1, 0, 10) << 12) + (bits  (inst2, 0, 10) << 1);
       nextpc = pc_val + offset;
     }
+  else if ((inst1 & 0xff80) == 0x4700) /* branch and exchange */
+    {
+      unsigned dest_addr_reg = (inst1 >> 3) & 0xF;
+      nextpc = read_register(dest_addr_reg) & ~1;
+    }
+  else if ((inst1 & 0xff87) == 0x4687) /* mov rd,rn (high registers) */
+    {
+      unsigned dest_addr_reg = (inst1>>3) & 0xF;
+      nextpc = read_register(dest_addr_reg) & ~1;
+    }
+  else if ((inst1 & 0xff87) == 0x4487) /* add rd,rn (high registers) */
+    {
+      /* :FIXME: not tested because useless for EPOC */
+      unsigned dest_addr_reg = (inst1>>3) & 0xF;
+      nextpc = (pc_val + read_register(dest_addr_reg)) & ~1;
+      warning("unexpected thumb instruction (add rd,rn) while
single-stepping");
+    }

   return nextpc;
 }

Unfortunately I don't have the equivalent patch for arm_get_next_pc()
because I don't need it (the OS I'm using exports a ARM 32 bit
single-stepping API).

Hope this helps.


*******************************************************************************************************************
Symbian Limited (Co.No.3173352) Registered Office: Sentinel House, 16 Harcourt Street, London, W1H 4AD, UK.
This message is intended only for use by the named addressee and may contain privileged and/or confidential information. If you are not the named addressee you should not disseminate, copy or take any action in reliance on it. If you have received this message in error please notify postmaster@symbian.com and delete the message and any attachments accompanying it immediately. Symbian does not accept liability for any corruption, interception, amendment, tampering or viruses occuring to this message in transit or for any message sent by its employees which is not in compliance with Symbian corporate policy.
*******************************************************************************************************************

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