PR tdep/9390: Fix typo on xstorxstormy16-tdep.c
authorSergio Durigan Junior <sergiodj@redhat.com>
Thu, 9 Oct 2014 17:45:09 +0000 (13:45 -0400)
committerSergio Durigan Junior <sergiodj@redhat.com>
Thu, 9 Oct 2014 17:45:09 +0000 (13:45 -0400)
This patch fixes the bug described in PR tdep/9390, which is about a
wrong check in the following code:

    ...

    /* optional copying of args in r2-r7 to r10-r13.  */
    /* Probably only in optimized case but legal action for prologue.  */
    else if ((inst & 0xff00) == 0x4600 /* 46SD   mov rD, rS */
     && (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070
     && (inst & 0x000f) >= 0x00a0 && (inst & 0x000f) <= 0x000d)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
    ...

This condition will never trigger, and the fix proposed in the bug
(which made sense to me) was to test against 0x000a.  I tried finding
documentation about this target, but couldn't find anything.  I don't
even know if it is still used, but decided to submit the fix anyway.

Tested on my x86_64 Fedora 20 GNU/Linux.

gdb/ChangeLog:
2014-09-16  Sergio Durigan Junior  <sergiodj@redhat.com>

PR tdep/9390
* xstorxstormy16-tdep.c (xstormy16_analyze_prologue): Fix possible
typo when using logical AND to determine instruction type.

gdb/ChangeLog
gdb/xstormy16-tdep.c

index ee82f1f..aeba430 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-09  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+       PR tdep/9390
+       * xstorxstormy16-tdep.c (xstormy16_analyze_prologue): Fix possible
+       typo when using logical AND to determine instruction type.
+
 2014-10-09  Yao Qi  <yao@codesourcery.com>
 
        * infrun.c (handle_signal_stop): Remove local variable
index af3ff32..9692742 100644 (file)
@@ -374,7 +374,7 @@ xstormy16_analyze_prologue (struct gdbarch *gdbarch,
       /* Probably only in optimized case but legal action for prologue.  */
       else if ((inst & 0xff00) == 0x4600       /* 46SD   mov rD, rS */
               && (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070
-              && (inst & 0x000f) >= 0x00a0 && (inst & 0x000f) <= 0x000d)
+              && (inst & 0x000f) >= 0x000a && (inst & 0x000f) <= 0x000d)
        ;
 
       /* Optional copying of args in r2-r7 to stack.  */