This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch ARM] Prevent disassembler from aborting on an invalid Thumb2 instruction.


Hi, 

Ed Nevill discovered this and proposed the attached patch while debugging some code. The disassembler aborts when faced with an 
invalid instruction in Thumb2 state. 

The testcase is as simple as the following. 

        .cpu cortex-a8
        .syntax unified
        .thumb
        .global main
        .type main,%function
main:
        .inst.w 0xe81c0c20

Without this patch objdump aborts - with this patch objdump prints out something more sensible like : 

Disassembly of section .text:

00000000 <main>:
   0:   e81c 0c20       undefined instruction 0xe81c0c20

Tested cross with arm-none-eabi with no regressions. Ok to commit ? 

cheers
Ramana




2009-11-17  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

	2009-11-13  Edward Nevill  <edward.nevill@arm.com>
	* arm-dis.c (print_insn_thumb32): Handle undefined instruction.
Index: arm-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/arm-dis.c,v
retrieving revision 1.111
diff -a -u -r1.111 arm-dis.c
--- arm-dis.c	12 Nov 2009 14:49:45 -0000	1.111
+++ arm-dis.c	17 Nov 2009 10:20:30 -0000
@@ -3932,6 +3932,10 @@
 		      func (stream, "%c", c[(1 << width) - (int) val]);
 		      c += 1 << width;
 		      break;
+		      
+		    case 'x':
+		      func (stream, "0x%lx", val & 0xffffffffUL);
+		      break;
 
 		    default:
 		      abort ();

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