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]

m68k disassembler bug in error handling support


I noticed this while talking to Ben Elliston about PR 1298.

In the file opcodes/m68k-dis.c, in the function match_insn_m68k, there
is code to handle an error return from print_insn_m68k.  This prints an
error message and then exits with an error code.  However, we disabled
printing right before the print_insn_m68k call, so no error message will
ever be printed here.  We need to restore the print functions before we
try to print the error message.

This is trivial to demonstrate by modifying print_insn_arg to return -2
unconditionally, and then running the disassembler on some m68k code. 
Unpatched and patched results are attached.

I tested this with a x86_64-x-m68k-elf cross binutils.  There were no
regressions.  I went ahead and checked in the bug fix patch.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com

Attachment: result.unpatched
Description: Text document

Attachment: result.patched
Description: Text document

Index: m68k-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/m68k-dis.c,v
retrieving revision 1.21
diff -p -p -r1.21 m68k-dis.c
*** m68k-dis.c	7 Feb 2006 19:01:10 -0000	1.21
--- m68k-dis.c	29 Apr 2006 02:58:02 -0000
*************** print_insn_arg (const char *d,
*** 584,589 ****
--- 584,591 ----
    bfd_signed_vma disp;
    unsigned int uval;
  
+   return -2;
+ 
    switch (*d)
      {
      case 'c':		/* Cache identifier.  */

Attachment: patch.print.error
Description: Text document


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