Bug 20150

Summary: [msp430-elf] Disassembly of interrupt vectors
Product: binutils Reporter: Orlando Arias <orlandoarias>
Component: binutilsAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: nickc, orlandoarias
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Orlando Arias 2016-05-26 18:34:08 UTC
Greetings,

As per mailing list discussion, opening a bug report for the issue presented in [1]. Applying the provided patch prevents reads from outside the vector, however the rendering of the objdump is still funny looking:

Disassembly of section __interrupt_vector_47:

0000ffdc <__interrupt_vector_47>:
    ffdc:       d8 49           Address 0x000000000000ffde is out of bounds.
Address 0x000000000000ffde is out of bounds.
mov.b                   ;<memory read failed>, <memory read failed>

Disassembly of section __interrupt_vector_54:

0000ffea <__interrupt_vector_54>:
    ffea:       6e 49           interrupt service routine at 0x496e

Disassembly of section .lowtext:

000044a8 <__crt0_start>:


It would be nice to have all vectors render like __interrupt_vector_54 in the above disassembly. As for the hardware rebooting, as pointed out, this may be a separate issue and I will investigate it further as time allows.

Thank you.

Cheers,
Orlando.


[1] https://sourceware.org/ml/binutils/2016-04/msg00285.html
Comment 1 Sourceware Commits 2016-05-27 12:51:29 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=77d66e7b303f6fa65dd2ca4abce6393d6ea70a8f

commit 77d66e7b303f6fa65dd2ca4abce6393d6ea70a8f
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri May 27 13:49:58 2016 +0100

    Improve the MSP430 disassembler's handling of memory read errors.
    
    	PR target/20150
    	* msp430-dis.c (msp430dis_read_two_bytes): New function.
    	(msp430dis_opcode_unsigned): New function.
    	(msp430dis_opcode_signed): New function.
    	(msp430_singleoperand): Use the new opcode reading functions.
    	Only disassenmble bytes if they were successfully read.
    	(msp430_doubleoperand): Likewise.
    	(msp430_branchinstr): Likewise.
    	(msp430x_callx_instr): Likewise.
    	(print_insn_msp430): Check that it is safe to read bytes before
    	attempting disassembly.  Use the new opcode reading functions.
Comment 2 Nick Clifton 2016-05-27 12:55:39 UTC
Hi Orlando,

  I have checked in an extended version of my original patch.  With this applied the output now looks like this:

Disassembly of section __interrupt_vector_47:

0000ffdc <__interrupt_vector_47>:
    ffdc:	c4 45       	mov.b	r5		; Warning: disassembly unreliable - not enough bytes available

  So, there is still a warning message, but I think that it is more helpful.  Plus I have removed the "Addresss xxx out of bounds" message.

Cheers
  Nick