readelf dwarf dump fixes

Alan Modra amodra@bigpond.net.au
Sun Sep 12 05:52:00 GMT 2004


	* readelf.c (decode_location_expression): Sign extend value for
 	DW_OP_const1s, DW_OP_const2s, DW_OP_const4s, DW_OP_bra, DW_OP_skip.

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.251
diff -u -p -r1.251 readelf.c
--- binutils/readelf.c	2 Sep 2004 08:25:06 -0000	1.251
+++ binutils/readelf.c	12 Sep 2004 05:42:51 -0000
@@ -7670,14 +7670,14 @@ decode_location_expression (unsigned cha
 	  printf ("DW_OP_const1u: %lu", (unsigned long) byte_get (data++, 1));
 	  break;
 	case DW_OP_const1s:
-	  printf ("DW_OP_const1s: %ld", (long) byte_get (data++, 1));
+	  printf ("DW_OP_const1s: %ld", (long) byte_get_signed (data++, 1));
 	  break;
 	case DW_OP_const2u:
 	  printf ("DW_OP_const2u: %lu", (unsigned long) byte_get (data, 2));
 	  data += 2;
 	  break;
 	case DW_OP_const2s:
-	  printf ("DW_OP_const2s: %ld", (long) byte_get (data, 2));
+	  printf ("DW_OP_const2s: %ld", (long) byte_get_signed (data, 2));
 	  data += 2;
 	  break;
 	case DW_OP_const4u:
@@ -7685,7 +7685,7 @@ decode_location_expression (unsigned cha
 	  data += 4;
 	  break;
 	case DW_OP_const4s:
-	  printf ("DW_OP_const4s: %ld", (long) byte_get (data, 4));
+	  printf ("DW_OP_const4s: %ld", (long) byte_get_signed (data, 4));
 	  data += 4;
 	  break;
 	case DW_OP_const8u:
@@ -7775,7 +7775,7 @@ decode_location_expression (unsigned cha
 	  printf ("DW_OP_xor");
 	  break;
 	case DW_OP_bra:
-	  printf ("DW_OP_bra: %ld", (long) byte_get (data, 2));
+	  printf ("DW_OP_bra: %ld", (long) byte_get_signed (data, 2));
 	  data += 2;
 	  break;
 	case DW_OP_eq:
@@ -7797,7 +7797,7 @@ decode_location_expression (unsigned cha
 	  printf ("DW_OP_ne");
 	  break;
 	case DW_OP_skip:
-	  printf ("DW_OP_skip: %ld", (long) byte_get (data, 2));
+	  printf ("DW_OP_skip: %ld", (long) byte_get_signed (data, 2));
 	  data += 2;
 	  break;
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list