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] gas/config/tc-msp430.c: add debug info.


Fellows,

With the following patch assembler emits dwarf2 debug info as appropriate.

Dmitry.

2005-09-01  Dmitry Diky  <diwil@spec.ru>

        * config/tc-msp430.c (msp430_operands): Emit dwarf2_emit_insn()
        as appropriate. Change frag_variant() to frag_var() for relaxes.

Index: config/tc-msp430.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-msp430.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 tc-msp430.c
*** config/tc-msp430.c	12 Aug 2005 11:54:23 -0000	1.20
--- config/tc-msp430.c	1 Sep 2005 12:36:33 -0000
***************
*** 30,35 ****
--- 30,36 ----
  #include "subsegs.h"
  #include "opcode/msp430.h"
  #include "safe-ctype.h"
+ #include "dwarf2dbg.h"
  
  /*
     We will disable polymorphs by default because it is dangerous.
*************** static unsigned int
*** 1422,1428 ****
  msp430_operands (struct msp430_opcode_s * opcode, char * line)
  {
    int bin = opcode->bin_opcode;	/* Opcode mask.  */
!   int __is;
    char l1[MAX_OP_LEN], l2[MAX_OP_LEN];
    char *frag;
    int where;
--- 1423,1429 ----
  msp430_operands (struct msp430_opcode_s * opcode, char * line)
  {
    int bin = opcode->bin_opcode;	/* Opcode mask.  */
!   int __is = 0;
    char l1[MAX_OP_LEN], l2[MAX_OP_LEN];
    char *frag;
    int where;
*************** msp430_operands (struct msp430_opcode_s 
*** 1474,1479 ****
--- 1475,1481 ----
  	  __is = 2;
  	  frag = frag_more (__is);
  	  bfd_putl16 ((bfd_vma) bin, frag);
+ 	  dwarf2_emit_insn (__is);
  	  break;
  	case 1:
  	  /* Something which works with destination operand.  */
*************** msp430_operands (struct msp430_opcode_s 
*** 1487,1492 ****
--- 1489,1495 ----
  	  frag = frag_more (2 * __is);
  	  where = frag - frag_now->fr_literal;
  	  bfd_putl16 ((bfd_vma) bin, frag);
+ 	  dwarf2_emit_insn (2 * __is);
  
  	  if (op1.mode == OP_EXP)
  	    {
*************** msp430_operands (struct msp430_opcode_s 
*** 1520,1526 ****
  	    frag = frag_more (2 * __is);
  	    where = frag - frag_now->fr_literal;
  	    bfd_putl16 ((bfd_vma) bin, frag);
! 
  	    if (op1.mode == OP_EXP)
  	      {
  		where += 2;	/* Advance 'where' as we do not know _where_.  */
--- 1523,1530 ----
  	    frag = frag_more (2 * __is);
  	    where = frag - frag_now->fr_literal;
  	    bfd_putl16 ((bfd_vma) bin, frag);
! 	    dwarf2_emit_insn (2 * __is);
! 	    
  	    if (op1.mode == OP_EXP)
  	      {
  		where += 2;	/* Advance 'where' as we do not know _where_.  */
*************** msp430_operands (struct msp430_opcode_s 
*** 1564,1569 ****
--- 1568,1574 ----
  	  frag = frag_more (2 * __is);
  	  where = frag - frag_now->fr_literal;
  	  bfd_putl16 ((bfd_vma) bin, frag);
+ 	  dwarf2_emit_insn (2 * __is);
  
  	  if (op1.mode == OP_EXP)
  	    {
*************** msp430_operands (struct msp430_opcode_s 
*** 1596,1601 ****
--- 1601,1607 ----
        frag = frag_more (2 * __is);
        where = frag - frag_now->fr_literal;
        bfd_putl16 ((bfd_vma) bin, frag);
+       dwarf2_emit_insn (2 * __is);
  
        if (op1.mode == OP_EXP)
  	{
*************** msp430_operands (struct msp430_opcode_s 
*** 1630,1635 ****
--- 1636,1642 ----
  	  /* reti instruction.  */
  	  frag = frag_more (2);
  	  bfd_putl16 ((bfd_vma) bin, frag);
+ 	  dwarf2_emit_insn (2);
  	  break;
  	}
  
*************** msp430_operands (struct msp430_opcode_s 
*** 1643,1648 ****
--- 1650,1656 ----
        frag = frag_more (2 * __is);
        where = frag - frag_now->fr_literal;
        bfd_putl16 ((bfd_vma) bin, frag);
+       dwarf2_emit_insn (2 * __is);
  
        if (op1.mode == OP_EXP)
  	{
*************** msp430_operands (struct msp430_opcode_s 
*** 1727,1740 ****
  	  else if (*l1 == '$')
  	    {
  	      as_bad (_("instruction requires label sans '$'"));
- 	      break;
  	    }
  	  else
  	    {
  	      as_bad (_
  		      ("instruction requires label or value in range -511:512"));
- 	      break;
  	    }
  	}
        else
  	{
--- 1735,1748 ----
  	  else if (*l1 == '$')
  	    {
  	      as_bad (_("instruction requires label sans '$'"));
  	    }
  	  else
  	    {
  	      as_bad (_
  		      ("instruction requires label or value in range -511:512"));
  	    }
+ 	  dwarf2_emit_insn (2 * __is);
+ 	  break;
  	}
        else
  	{
*************** msp430_operands (struct msp430_opcode_s 
*** 1766,1778 ****
  	      /* Relaxation required.  */
  	      struct rcodes_s rc = msp430_rcodes[opcode->insn_opnumb];
  
! 	      frag = frag_more (8);
! 	      bfd_putl16 ((bfd_vma) rc.sop, frag);
! 	      frag = frag_variant (rs_machine_dependent, 8, 2,
  				   ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess.  */
  				   exp.X_add_symbol,
  				   0,	/* Offset is zero if jump dist less than 1K.  */
  				   (char *) frag);
  	      break;
  	    }
  	}
--- 1774,1791 ----
  	      /* Relaxation required.  */
  	      struct rcodes_s rc = msp430_rcodes[opcode->insn_opnumb];
  
! 	      /* The parameter to dwarf2_emit_insn is actually the offset to the 
start
! 		 of the insn from the fix piece of instruction that was emitted.
! 		 Since next fragments may have variable size we tie debug info
! 	         to the beginning of the instruction. */
! 	      frag = frag_more (0);
! 	      dwarf2_emit_insn (0);
! 	      frag = frag_var/*iant*/ (rs_machine_dependent, 8, 2,
  				   ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess.  */
  				   exp.X_add_symbol,
  				   0,	/* Offset is zero if jump dist less than 1K.  */
  				   (char *) frag);
+ 	      bfd_putl16 ((bfd_vma) rc.sop, frag);
  	      break;
  	    }
  	}
*************** msp430_operands (struct msp430_opcode_s 
*** 1802,1815 ****
  	      /* Relaxation required.  */
  	      struct hcodes_s hc = msp430_hcodes[opcode->insn_opnumb];
  
! 	      frag = frag_more (8);
! 	      bfd_putl16 ((bfd_vma) hc.op0, frag);
! 	      bfd_putl16 ((bfd_vma) hc.op1, frag+2);
! 	      frag = frag_variant (rs_machine_dependent, 8, 2,
  				   ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess.  */
  				   exp.X_add_symbol,
  				   0,	/* Offset is zero if jump dist less than 1K.  */
  				   (char *) frag);
  	      break;
  	    }
  	}
--- 1815,1829 ----
  	      /* Relaxation required.  */
  	      struct hcodes_s hc = msp430_hcodes[opcode->insn_opnumb];
  
! 	      frag = frag_more (0);
! 	      dwarf2_emit_insn (0);
! 	      frag = frag_var/*iant*/ (rs_machine_dependent, 8, 2,
  				   ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess.  */
  				   exp.X_add_symbol,
  				   0,	/* Offset is zero if jump dist less than 1K.  */
  				   (char *) frag);
+ 	      bfd_putl16 ((bfd_vma) hc.op0, frag);
+ 	      bfd_putl16 ((bfd_vma) hc.op1, frag+2);
  	      break;
  	    }
  	}


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