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]

Re: 2.19 -enable-targets=all one error in m68k-dis.c due to longjmp, easily fixed with volatile


I've now checked this in as obvious.

Andreas.

2008-11-26  Andreas Schwab  <schwab@suse.de>

	* m68k-dis.c (NEXTBYTE, NEXTWORD, NEXTLONG, NEXTULONG, NEXTSINGLE)
	(NEXTDOUBLE, NEXTEXTEND, NEXTPACKED): Fix error handling.
	(save_printer, save_print_address): Remove.
	(fetch_data): Don't use them.
	(match_insn_m68k): Always restore printing functions.
	(print_insn_m68k): Don't save/restore printing functions.

--- opcodes/m68k-dis.c.~1.30.~	2008-11-26 11:19:07.000000000 +0100
+++ opcodes/m68k-dis.c	2008-11-26 11:22:19.000000000 +0100
@@ -64,7 +64,7 @@ static char *const reg_half_names[] =
   do						\
     {						\
       p += 2;					\
-      if (FETCH_DATA (info, p) < 0)		\
+      if (!FETCH_DATA (info, p))		\
 	return -3;				\
       val = COERCE_SIGNED_CHAR (p[-1]);		\
     }						\
@@ -77,7 +77,7 @@ static char *const reg_half_names[] =
   do						\
     {						\
       p += 2;					\
-      if (FETCH_DATA (info, p) < 0)		\
+      if (!FETCH_DATA (info, p))		\
 	return ret_val;				\
       val = COERCE16 ((p[-2] << 8) + p[-1]);	\
     }						\
@@ -90,7 +90,7 @@ static char *const reg_half_names[] =
   do									\
     {									\
       p += 4;								\
-      if (FETCH_DATA (info, p) < 0)					\
+      if (!FETCH_DATA (info, p))					\
 	return ret_val;							\
       val = COERCE32 ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
     }									\
@@ -101,7 +101,7 @@ static char *const reg_half_names[] =
   do									\
     {									\
       p += 4;								\
-      if (FETCH_DATA (info, p) < 0)					\
+      if (!FETCH_DATA (info, p))					\
 	return -3;							\
       val = (unsigned int) ((((((p[-4] << 8) + p[-3]) << 8) + p[-2]) << 8) + p[-1]); \
     }									\
@@ -112,7 +112,7 @@ static char *const reg_half_names[] =
   do								\
     {								\
       p += 4;							\
-      if (FETCH_DATA (info, p) < 0)				\
+      if (!FETCH_DATA (info, p))				\
 	return -3;						\
       floatformat_to_double (& floatformat_ieee_single_big,	\
 			     (char *) p - 4, & val);		\
@@ -124,7 +124,7 @@ static char *const reg_half_names[] =
   do								\
     {								\
       p += 8;							\
-      if (FETCH_DATA (info, p) , 0)				\
+      if (!FETCH_DATA (info, p))				\
 	return -3;						\
       floatformat_to_double (& floatformat_ieee_double_big,	\
 			     (char *) p - 8, & val);		\
@@ -136,7 +136,7 @@ static char *const reg_half_names[] =
   do							\
     {							\
       p += 12;						\
-      if (FETCH_DATA (info, p) < 0)			\
+      if (!FETCH_DATA (info, p))			\
 	return -3;					\
       floatformat_to_double (& floatformat_m68881_ext,	\
 			     (char *) p - 12, & val);	\
@@ -151,7 +151,7 @@ static char *const reg_half_names[] =
   do						\
     {						\
       p += 12;					\
-      if (FETCH_DATA (info, p) < 0)		\
+      if (!FETCH_DATA (info, p))		\
 	return -3;				\
       val = 0.0;				\
     }						\
@@ -171,9 +171,6 @@ struct private
   bfd_vma insn_start;
 };
 
-static fprintf_ftype save_printer;
-static void (* save_print_address) (bfd_vma, struct disassemble_info *);
-
 /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
    to ADDR (exclusive) are valid.  Returns 1 for success, 0 on error.  */
 #define FETCH_DATA(info, addr) \
@@ -194,8 +191,6 @@ fetch_data (struct disassemble_info *inf
   if (status != 0)
     {
       (*info->memory_error_func) (status, start, info);
-      info->fprintf_func = save_printer;
-      info->print_address_func = save_print_address;
       return 0;
     }
   else
@@ -1400,14 +1395,12 @@ match_insn_m68k (bfd_vma memaddr,
 
       if (eaten >= 0)
 	p += eaten;
-      else if (eaten == -1)
+      else if (eaten == -1 || eaten == -3)
 	{
 	  info->fprintf_func = save_printer;
 	  info->print_address_func = save_print_address;
 	  return 0;
 	}
-      else if (eaten == -3)
-	return 0;
       else
 	{
 	  /* We must restore the print functions before trying to print the
@@ -1574,19 +1567,12 @@ m68k_scan_mask (bfd_vma memaddr, disasse
 int
 print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
 {
-  fprintf_ftype save_printer;
-  void (* save_print_address) (bfd_vma, struct disassemble_info *);
   unsigned int arch_mask;
   struct private priv;
   int val;
 
   bfd_byte *buffer = priv.the_buffer;
 
-  /* Save these printing functions in case we need to restore them
-     later.  */
-  save_printer = info->fprintf_func;
-  save_print_address = info->print_address_func;
-
   info->private_data = & priv;
   /* Tell objdump to use two bytes per chunk
      and six bytes per line for displaying raw data.  */
@@ -1614,9 +1600,5 @@ print_insn_m68k (bfd_vma memaddr, disass
     /* Handle undefined instructions.  */
     info->fprintf_func (info->stream, "0%o", (buffer[0] << 8) + buffer[1]);
 
-  /* Restore print functions.  */
-  info->fprintf_func = save_printer;
-  info->print_address_func = save_print_address;
-
   return val ? val : 2;
 }

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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