This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

[commit] s/extract_address/extract_unsigned_integer/ some


Hello,

This replaces many of the core GDB extract_address calls with the inlined equivalent - extract_unsigned_integer - adding comments as it goes.

committed,
Andrew
2003-05-22  Andrew Cagney  <cagney@redhat.com>

	* stack.c (frame_info): Inline extract_address, replacing it with
	extract_unsigned_integer.
	* findvar.c (unsigned_pointer_to_address): Ditto.
	* dwarf2loc.c (dwarf_expr_read_reg): Ditto.
	* dwarf2expr.c (dwarf2_read_address): Ditto.
	* frame.c (frame_pc_unwind): Update comment.
	* dummy-frame.c (deprecated_read_register_dummy): Update comment.

Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.22
diff -u -r1.22 dummy-frame.c
--- dummy-frame.c	15 May 2003 19:04:29 -0000	1.22
+++ dummy-frame.c	22 May 2003 18:34:43 -0000
@@ -183,7 +183,7 @@
       /* NOTE: cagney/2002-08-12: Replaced a call to
 	 regcache_raw_read_as_address() with a call to
 	 regcache_cooked_read_unsigned().  The old, ...as_address
-	 function was eventually calling extract_unsigned_integer (via
+	 function was eventually calling extract_unsigned_integer (nee
 	 extract_address) to unpack the registers value.  The below is
 	 doing an unsigned extract so that it is functionally
 	 equivalent.  The read needs to be cooked as, otherwise, it
Index: dwarf2expr.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2expr.c,v
retrieving revision 1.7
diff -u -r1.7 dwarf2expr.c
--- dwarf2expr.c	14 May 2003 22:45:41 -0000	1.7
+++ dwarf2expr.c	22 May 2003 18:34:44 -0000
@@ -178,7 +178,9 @@
     error ("dwarf2_read_address: Corrupted DWARF expression.");
 
   *bytes_read = TARGET_ADDR_BIT / TARGET_CHAR_BIT;
-  result = extract_address (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
+  /* NOTE: cagney/2003-05-22: This extract is assuming that a DWARF 2
+     address is always unsigned.  That may or may not be true.  */
+  result = extract_unsigned_integer (buf, TARGET_ADDR_BIT / TARGET_CHAR_BIT);
   return result;
 }
 
Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.8
diff -u -r1.8 dwarf2loc.c
--- dwarf2loc.c	18 May 2003 15:49:51 -0000	1.8
+++ dwarf2loc.c	22 May 2003 18:34:44 -0000
@@ -124,7 +124,9 @@
 
   frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr,
 		  &realnum, buf);
-  result = extract_address (buf, regsize);
+  /* NOTE: cagney/2003-05-22: This extract is assuming that a DWARF 2
+     address is always unsigned.  That may or may not be true.  */
+  result = extract_unsigned_integer (buf, regsize);
 
   return result;
 }
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.55
diff -u -r1.55 findvar.c
--- findvar.c	13 May 2003 19:27:27 -0000	1.55
+++ findvar.c	22 May 2003 18:34:45 -0000
@@ -333,7 +333,7 @@
 CORE_ADDR
 unsigned_pointer_to_address (struct type *type, const void *buf)
 {
-  return extract_address (buf, TYPE_LENGTH (type));
+  return extract_unsigned_integer (buf, TYPE_LENGTH (type));
 }
 
 CORE_ADDR
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.115
diff -u -r1.115 frame.c
--- frame.c	15 May 2003 19:04:29 -0000	1.115
+++ frame.c	22 May 2003 18:34:47 -0000
@@ -376,7 +376,7 @@
 	     implementation is no more than:
 	   
 	     frame_unwind_register (this_frame, ISA_PC_REGNUM, buf);
-	     return extract_address (buf, size of ISA_PC_REGNUM);
+	     return extract_unsigned_integer (buf, size of ISA_PC_REGNUM);
 
 	     Note: this method is very heavily dependent on a correct
 	     register-unwind implementation, it pays to fix that
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.76
diff -u -r1.76 stack.c
--- stack.c	14 May 2003 17:43:18 -0000	1.76
+++ stack.c	22 May 2003 18:34:50 -0000
@@ -818,7 +818,10 @@
 	    CORE_ADDR sp;
 	    frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
 				   &realnum, value);
-	    sp = extract_address (value, REGISTER_RAW_SIZE (SP_REGNUM));
+	    /* NOTE: cagney/2003-05-22: This is assuming that the
+               stack pointer was packed as an unsigned integer.  That
+               may or may not be valid.  */
+	    sp = extract_unsigned_integer (value, REGISTER_RAW_SIZE (SP_REGNUM));
 	    printf_filtered (" Previous frame's sp is ");
 	    print_address_numeric (sp, 1, gdb_stdout);
 	    printf_filtered ("\n");

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