Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Omair Javaid <omair.javaid@linaro.org>
To: gdb-patches@sourceware.org
Cc: patches@linaro.org
Subject: [PATCH v2 2/7] Fix for bugs in push and ldm instructions decoding
Date: Fri, 03 Jan 2014 19:16:00 -0000	[thread overview]
Message-ID: <0f7fb3b570618db992dda74ac94b3bbc4cdd714b.1388709773.git.omair.javaid@linaro.org> (raw)
In-Reply-To: <cover.1388709773.git.omair.javaid@linaro.org>
In-Reply-To: <cover.1388709773.git.omair.javaid@linaro.org>

This patch corrects the register numbers and removes multiple loops in
recording procedure of instructions involving multiple registers.

gdb:

2014-01-03  Omair Javaid  <omair.javaid@linaro.org>

	* arm-tdep.c (thumb_record_misc): Update to correct logical error while
	recording ldm, ldmia and pop instructions.


---
 gdb/arm-tdep.c |   61 +++++++++++++++++---------------------------------------
 1 file changed, 18 insertions(+), 43 deletions(-)

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 223a7db..24bacf8 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -11786,26 +11786,15 @@ arm_record_ld_st_multiple (insn_decode_record *arm_insn_r)
       while (register_bits)
       {
         if (register_bits & 0x00000001)
-          register_list[register_count++] = 1;
+          record_buf[index++] = register_count;
         register_bits = register_bits >> 1;
+        register_count++;
       }
 
         /* Extra space for Base Register and CPSR; wihtout optimization.  */
-        record_buf[register_count] = reg_src1;
-        record_buf[register_count + 1] = ARM_PS_REGNUM;
-        arm_insn_r->reg_rec_count = register_count + 2;
-
-        for (register_count = 0; register_count < no_of_regs; register_count++)
-          {
-            if  (register_list[register_count])
-              {
-                /* Register_count gives total no of registers
-                and dually working as reg number.  */
-                record_buf[index] = register_count;
-                index++;
-              }
-          }
-
+        record_buf[index++] = reg_src1;
+        record_buf[index++] = ARM_PS_REGNUM;
+        arm_insn_r->reg_rec_count = index;
     }
   else
     {
@@ -12209,22 +12198,15 @@ thumb_record_misc (insn_decode_record *thumb_insn_r)
       /* POP.  */
       register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
       while (register_bits)
-        {
-          if (register_bits & 0x00000001)
-            register_list[register_count++] = 1;
-          register_bits = register_bits >> 1;
-        }
-      record_buf[register_count] = ARM_PS_REGNUM;
-      record_buf[register_count + 1] = ARM_SP_REGNUM;
-      thumb_insn_r->reg_rec_count = register_count + 2;
-      for (register_count = 0; register_count < 8; register_count++)
-        {
-          if  (register_list[register_count])
-            {
-              record_buf[index] = register_count;
-              index++;
-            }
-        }
+      {
+        if (register_bits & 0x00000001)
+          record_buf[index++] = register_count;
+        register_bits = register_bits >> 1;
+        register_count++;
+      }
+      record_buf[index++] = ARM_PS_REGNUM;
+      record_buf[index++] = ARM_SP_REGNUM;
+      thumb_insn_r->reg_rec_count = index;
     }
   else if (10 == opcode2)
     {
@@ -12321,19 +12303,12 @@ thumb_record_ldm_stm_swi (insn_decode_record *thumb_insn_r)
       while (register_bits)
         {
           if (register_bits & 0x00000001)
-            register_list[register_count++] = 1;
+            record_buf[index++] = register_count;
           register_bits = register_bits >> 1;
+          register_count++;
         }
-      record_buf[register_count] = reg_src1;
-      thumb_insn_r->reg_rec_count = register_count + 1;
-      for (register_count = 0; register_count < 8; register_count++)
-        {
-          if (register_list[register_count])
-            {
-              record_buf[index] = register_count;
-              index++;
-            }
-        }
+      record_buf[index++] = reg_src1;
+      thumb_insn_r->reg_rec_count = index;
     }
   else if (0 == opcode2)
     {
-- 
1.7.9.5


  parent reply	other threads:[~2014-01-03 19:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 19:16 [PATCH v2 0/7] ARM record/replay and reverse debugging improvements Omair Javaid
     [not found] ` <y@[87.69.4.28]>
     [not found]   ` <1385042577-5600-2-git-send-email-y@[87.69.4.28]>
2013-11-21 17:42     ` [PATCH 1/1] Documentation for MPX Eli Zaretskii
2014-01-03 19:16 ` Omair Javaid [this message]
2014-01-06 19:50   ` [PATCH v2 2/7] Fix for bugs in push and ldm instructions decoding Pedro Alves
2014-01-03 19:16 ` [PATCH v2 6/7] Updates configure.tgt and enables gdb.reverse testsuite Omair Javaid
2014-01-05 14:29   ` Yao Qi
2014-01-09 11:00     ` Omair Javaid
2014-01-09 11:25       ` Pedro Alves
2014-01-03 19:16 ` [PATCH v2 4/7] Adds support for recording system call instructions Omair Javaid
2014-01-06 19:52   ` Pedro Alves
2014-01-09 10:49     ` Omair Javaid
2014-01-09 17:14       ` Pedro Alves
2014-01-03 19:16 ` [PATCH v2 1/7] Fix for memory record corruption due to 64bit addresses Omair Javaid
2014-01-06 19:50   ` Pedro Alves
2014-01-09 10:35     ` Omair Javaid
2014-01-09 11:23       ` Pedro Alves
2014-01-03 19:16 ` [PATCH v2 7/7] Adds a NEWS entry for arm record/replay improvements Omair Javaid
2014-01-03 20:25   ` Eli Zaretskii
2014-01-09 11:25   ` Pedro Alves
2014-01-03 19:16 ` [PATCH v2 3/7] Fix for bug in pop instruction decoding Omair Javaid
2014-01-06 19:51   ` Pedro Alves
2014-01-03 19:16 ` [PATCH v2 5/7] Adds support for thumb32 instructions recording Omair Javaid
2014-01-06 19:52   ` Pedro Alves
2014-01-09 10:34     ` Omair Javaid
2014-01-09 11:23       ` Pedro Alves
2014-01-09 11:34         ` Omair Javaid
2014-01-15 17:27           ` Will Newton
2014-01-15 17:49             ` Tom Tromey
2014-01-06 19:54 ` [PATCH v2 0/7] ARM record/replay and reverse debugging improvements Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f7fb3b570618db992dda74ac94b3bbc4cdd714b.1388709773.git.omair.javaid@linaro.org \
    --to=omair.javaid@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=patches@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox