OpenCores
Issue List
Bug in gdb disassemble (or32-dis.c) on 64-bit platform #13
Closed ocghost opened this issue about 17 years ago
ocghost commented about 17 years ago

I found that disassemble doesn't work properly for me using the host Linux 64 bit platform.

The problem is that function or32_extract() returns a signed-extended mask, which doesn't match the opcode of the instruction (in or32_opcode_match), which remains non-extended. IMO, the fix is to prevent sign extension by using '1L' rather than '1' in the following way:

diff -u gdb-5.3-old/opcodes/or32-dis.c gdb-5.3/opcodes/or32-dis.c --- gdb-5.3-old/opcodes/or32-dis.c 2007-01-23 13:29:26.000000000 +0200 +++ gdb-5.3/opcodes/or32-dis.c 2007-01-23 13:23:21.000000000 +0200 @@ -99,7 +99,7 @@ else if ((enc == '0') || (enc == '1')) { opc_pos--; if (param_ch == *enc)

  •                    ret |= 1 << opc_pos;
  •                    ret |= 1L << opc_pos;
                   enc++;
                 }
                 else if (*enc == param_ch) {
    ...

Regards, Vitaly

ocghost commented about 17 years ago

Found one more bug that breaks gdb on 64 bit. In or1k-dep.c in function in function or1k_frame_chain there are hard-coded shift operands. For example: int code = insn >> 26;

This doesn't work properly if insn (long) is 64 bit long. I decided to re-compile my gdb with -m32 flag. The problem disappeared but I cannot rely the end-users will always do so.

jeremybennett commented almost 13 years ago
<p> Transferred to OpenRISC Bugzilla. <a href="http://bugzilla.opencores.org/show_bug.cgi?id=1">Bug 1</a>. </p> <p> Marked as closed. </p>
jeremybennett was assigned almost 13 years ago
jeremybennett closed this almost 13 years ago

Assignee
jeremybennett
Labels
Bug