* [patch rfc] Eliminate extract_address
@ 2003-05-14 12:10 Andrew Cagney
2003-05-14 16:42 ` Kevin Buettner
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-05-14 12:10 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 95 bytes --]
Hello,
This follows on from the elimination of store_address().
I'll commit tomorrow.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 43116 bytes --]
2003-05-13 Andrew Cagney <cagney@redhat.com>
* defs.h (extract_address): Delete declaration.
* findvar.c (extract_address): Delete function.
* xstormy16-tdep.c (xstormy16_extract_return_value):
(xstormy16_extract_struct_value_address): Ditto.
(xstormy16_pointer_to_address): Ditto.
* vax-tdep.c (vax_extract_struct_value_address): Ditto.
* v850-tdep.c (v850_push_arguments): Ditto.
(v850_extract_return_value): Ditto.
(v850_extract_struct_value_address): Ditto.
* stack.c (frame_info): Ditto.
* sparcnbsd-tdep.c (sparcnbsd_get_longjmp_target_32): Ditto.
(sparcnbsd_get_longjmp_target_64): Ditto.
* sparc-tdep.c (sparc_extract_struct_value_address): Ditto.
(sparc_frame_saved_pc): Ditto.
(get_longjmp_target): Ditto.
* solib-svr4.c (SOLIB_EXTRACT_ADDRESS): Ditto.
(LM_NEXT, LM_NAME): Ditto.
(IGNORE_FIRST_LINK_MAP_ENTRY): Ditto.
(first_link_map_member): Ditto.
(open_symbol_file_object): Ditto.
(svr4_fetch_objfile_link_map): Ditto.
* solib-sunos.c (SOLIB_EXTRACT_ADDRESS): Ditto.
(LM_NEXT, LM_NAME): Ditto.
* solib-irix.c (extract_mips_address): Ditto.
* sh-tdep.c (sh_extract_struct_value_address): Ditto.
(sh64_extract_struct_value_address): Ditto.
(sh_push_arguments): Ditto.
(sh64_push_arguments): Ditto.
* remote-vxsparc.c (vx_read_register): Ditto.
(vx_write_register): Ditto.
* ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Ditto.
* p-valprint.c (pascal_val_print): Ditto.
(pascal_val_print): Ditto.
* ns32k-tdep.c (ns32k_extract_struct_value_address): Ditto.
* mn10300-tdep.c (mn10300_extract_struct_value_address): Ditto.
* mipsv4-nat.c (get_longjmp_target): Ditto.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Ditto.
* mips-nat.c (get_longjmp_target): Ditto.
* mips-linux-tdep.c (mips_linux_get_longjmp_target): Ditto.
(mips64_linux_get_longjmp_target): Ditto.
* mcore-tdep.c (mcore_extract_struct_value_address): Ditto.
* m68k-tdep.c (m68k_get_longjmp_target): Ditto.
(m68k_get_longjmp_target): Ditto.
* m68hc11-tdep.c (m68hc11_extract_struct_value_address): Ditto.
* jv-valprint.c (java_value_print): Ditto.
(java_val_print): Ditto.
* irix5-nat.c (get_longjmp_target): Ditto.
* irix4-nat.c (get_longjmp_target): Ditto.
* ia64-tdep.c (generic_elf_find_global_pointer): Ditto.
(ia64_push_arguments): Ditto.
* hpux-thread.c (hpux_thread_store_registers): Ditto.
* hppa-tdep.c (hppa_extract_struct_value_address): Ditto.
* h8300-tdep.c (h8300_push_arguments): Ditto.
(h8300_store_return_value): Ditto.
(h8300_extract_struct_value_address): Ditto.
* frv-tdep.c (frv_extract_struct_value_address): Ditto.
(frv_push_arguments): Ditto.
* frame.c (frame_pc_unwind): Ditto.
* findvar.c (unsigned_pointer_to_address): Ditto.
* dwarf2loc.c (dwarf_expr_read_reg): Ditto.
* dwarf2expr.c (dwarf2_read_address): Ditto.
* dummy-frame.c (deprecated_read_register_dummy): Ditto.
* avr-tdep.c (avr_pointer_to_address): Ditto.
(avr_push_arguments): Ditto.
* arm-tdep.c (arm_push_dummy_call): Ditto.
(arm_push_dummy_call): Ditto.
(arm_get_longjmp_target): Ditto.
* arm-linux-tdep.c (arm_linux_push_arguments): Ditto.
* alpha-tdep.c (alpha_extract_struct_value_address): Ditto.
(alpha_get_longjmp_target): Ditto.
* ada-valprint.c (ada_val_print_1): Ditto.
* ada-lang.h (EXTRACT_ADDRESS): Ditto.
Index: ada-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.h,v
retrieving revision 1.4
diff -u -r1.4 ada-lang.h
--- ada-lang.h 12 Apr 2003 17:41:25 -0000 1.4
+++ ada-lang.h 14 May 2003 12:04:49 -0000
@@ -29,7 +29,10 @@
/* A macro to reorder the bytes of an address depending on the endiannes
of the target */
-#define EXTRACT_ADDRESS(x) ((void *) extract_address (&(x), sizeof (x)))
+/* NOTE: cagney/2003-05-13: This is bogus. It's assuming that the
+ object to be extracted is in some sort of host defined size - that
+ is invariably not true. */
+#define EXTRACT_ADDRESS(x) ((void *) extract_unsigned_address (&(x), sizeof (x)))
/* A macro to reorder the bytes of an int depending on the endiannes
of the target */
#define EXTRACT_INT(x) ((int) extract_signed_integer (&(x), sizeof (x)))
Index: ada-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-valprint.c,v
retrieving revision 1.7
diff -u -r1.7 ada-valprint.c
--- ada-valprint.c 21 Apr 2003 16:48:37 -0000 1.7
+++ ada-valprint.c 14 May 2003 12:04:49 -0000
@@ -746,8 +746,9 @@
{
fprintf_filtered (stream, "@");
print_address_numeric
- (extract_address (valaddr,
- TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
+ (extract_unsigned_integer (valaddr,
+ TARGET_PTR_BIT / HOST_CHAR_BIT),
+ 1, stream);
if (deref_ref)
fputs_filtered (": ", stream);
}
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.83
diff -u -r1.83 alpha-tdep.c
--- alpha-tdep.c 13 May 2003 19:27:27 -0000 1.83
+++ alpha-tdep.c 14 May 2003 12:04:51 -0000
@@ -1617,8 +1617,8 @@
static CORE_ADDR
alpha_extract_struct_value_address (char *regbuf)
{
- return (extract_address (regbuf + REGISTER_BYTE (ALPHA_V0_REGNUM),
- REGISTER_RAW_SIZE (ALPHA_V0_REGNUM)));
+ return (extract_unsigned_integer (regbuf + REGISTER_BYTE (ALPHA_V0_REGNUM),
+ REGISTER_RAW_SIZE (ALPHA_V0_REGNUM)));
}
/* Figure out where the longjmp will land.
@@ -1639,7 +1639,7 @@
raw_buffer, tdep->jb_elt_size))
return 0;
- *pc = extract_address (raw_buffer, tdep->jb_elt_size);
+ *pc = extract_unsigned_integer (raw_buffer, tdep->jb_elt_size);
return 1;
}
Index: arm-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-tdep.c,v
retrieving revision 1.32
diff -u -r1.32 arm-linux-tdep.c
--- arm-linux-tdep.c 13 May 2003 19:27:27 -0000 1.32
+++ arm-linux-tdep.c 14 May 2003 12:04:51 -0000
@@ -193,7 +193,7 @@
&& NULL != target_type
&& TYPE_CODE_FUNC == TYPE_CODE (target_type))
{
- CORE_ADDR regval = extract_address (val, len);
+ CORE_ADDR regval = extract_unsigned_integer (val, len);
if (arm_pc_is_thumb (regval))
store_unsigned_integer (val, len, MAKE_THUMB_ADDR (regval));
}
@@ -208,7 +208,7 @@
if (argreg <= ARM_LAST_ARG_REGNUM)
{
/* It's an argument being passed in a general register. */
- regval = extract_address (val, partial_len);
+ regval = extract_unsigned_integer (val, partial_len);
write_register (argreg++, regval);
}
else
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.133
diff -u -r1.133 arm-tdep.c
--- arm-tdep.c 13 May 2003 19:27:27 -0000 1.133
+++ arm-tdep.c 14 May 2003 12:04:59 -0000
@@ -1464,7 +1464,7 @@
&& target_type != NULL
&& TYPE_CODE_FUNC == TYPE_CODE (target_type))
{
- CORE_ADDR regval = extract_address (val, len);
+ CORE_ADDR regval = extract_unsigned_integer (val, len);
if (arm_pc_is_thumb (regval))
{
val = alloca (len);
@@ -1483,7 +1483,7 @@
{
/* The argument is being passed in a general purpose
register. */
- CORE_ADDR regval = extract_address (val, partial_len);
+ CORE_ADDR regval = extract_unsigned_integer (val, partial_len);
if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n",
argnum, REGISTER_NAME (argreg),
@@ -2493,7 +2493,7 @@
INT_REGISTER_RAW_SIZE))
return 0;
- *pc = extract_address (buf, INT_REGISTER_RAW_SIZE);
+ *pc = extract_unsigned_integer (buf, INT_REGISTER_RAW_SIZE);
return 1;
}
Index: avr-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/avr-tdep.c,v
retrieving revision 1.46
diff -u -r1.46 avr-tdep.c
--- avr-tdep.c 8 May 2003 03:48:03 -0000 1.46
+++ avr-tdep.c 14 May 2003 12:05:00 -0000
@@ -324,7 +324,7 @@
static CORE_ADDR
avr_pointer_to_address (struct type *type, const void *buf)
{
- CORE_ADDR addr = extract_address (buf, TYPE_LENGTH (type));
+ CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
if (TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
{
@@ -1084,7 +1084,7 @@
while (len > 0)
{ /* there's room in registers */
len -= wordsize;
- regval = extract_address (val + len, wordsize);
+ regval = extract_unsigned_integer (val + len, wordsize);
write_register (argreg--, regval);
}
}
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.122
diff -u -r1.122 defs.h
--- defs.h 13 May 2003 19:27:27 -0000 1.122
+++ defs.h 14 May 2003 12:05:04 -0000
@@ -1126,8 +1126,6 @@
extern int extract_long_unsigned_integer (const void *, int, LONGEST *);
-extern CORE_ADDR extract_address (const void *, int);
-
extern CORE_ADDR extract_typed_address (const void *buf, struct type *type);
extern void store_signed_integer (void *, int, LONGEST);
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.21
diff -u -r1.21 dummy-frame.c
--- dummy-frame.c 5 May 2003 18:33:10 -0000 1.21
+++ dummy-frame.c 14 May 2003 12:05:05 -0000
@@ -184,11 +184,11 @@
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
- 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
- will never correctly return the value of a register in the
- [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS) range. */
+ the now deleted 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 will never correctly return the value of a
+ register in the [NUM_REGS .. NUM_REGS+NUM_PSEUDO_REGS) range. */
ULONGEST val;
regcache_cooked_read_unsigned (dummy_regs, regno, &val);
return val;
Index: dwarf2expr.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2expr.c,v
retrieving revision 1.6
diff -u -r1.6 dwarf2expr.c
--- dwarf2expr.c 13 Apr 2003 15:53:44 -0000 1.6
+++ dwarf2expr.c 14 May 2003 12:05:06 -0000
@@ -179,7 +179,7 @@
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);
+ 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.7
diff -u -r1.7 dwarf2loc.c
--- dwarf2loc.c 22 Apr 2003 23:18:26 -0000 1.7
+++ dwarf2loc.c 14 May 2003 12:05:06 -0000
@@ -124,7 +124,7 @@
frame_register (debaton->frame, regnum, &optimized, &lval_type, &save_addr,
&realnum, buf);
- result = extract_address (buf, regsize);
+ 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 14 May 2003 12:05:06 -0000
@@ -161,28 +161,6 @@
}
-/* Treat the LEN bytes at ADDR as a target-format address, and return
- that address. ADDR is a buffer in the GDB process, not in the
- inferior.
-
- This function should only be used by target-specific code. It
- assumes that a pointer has the same representation as that thing's
- address represented as an integer. Some machines use word
- addresses, or similarly munged things, for certain types of
- pointers, so that assumption doesn't hold everywhere.
-
- Common code should use extract_typed_address instead, or something
- else based on POINTER_TO_ADDRESS. */
-
-CORE_ADDR
-extract_address (const void *addr, int len)
-{
- /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
- whether we want this to be true eventually. */
- return (CORE_ADDR) extract_unsigned_integer (addr, len);
-}
-
-
/* Treat the bytes at BUF as a pointer of type TYPE, and return the
address it represents. */
CORE_ADDR
@@ -333,7 +311,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.114
diff -u -r1.114 frame.c
--- frame.c 13 May 2003 19:27:27 -0000 1.114
+++ frame.c 14 May 2003 12:05:08 -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: frv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/frv-tdep.c,v
retrieving revision 1.36
diff -u -r1.36 frv-tdep.c
--- frv-tdep.c 13 May 2003 19:27:28 -0000 1.36
+++ frv-tdep.c 14 May 2003 12:05:08 -0000
@@ -762,8 +762,9 @@
static CORE_ADDR
frv_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf + frv_register_byte (struct_return_regnum),
- 4);
+ return extract_unsigned_integer (regbuf
+ + frv_register_byte (struct_return_regnum),
+ 4);
}
static void
@@ -859,7 +860,7 @@
if (argreg < 14)
{
- regval = extract_address (val, partial_len);
+ regval = extract_unsigned_integer (val, partial_len);
#if 0
printf(" Argnum %d data %x -> reg %d\n",
argnum, (int) regval, argreg);
Index: h8300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
retrieving revision 1.58
diff -u -r1.58 h8300-tdep.c
--- h8300-tdep.c 5 May 2003 17:56:55 -0000 1.58
+++ h8300-tdep.c 14 May 2003 12:05:10 -0000
@@ -706,7 +706,7 @@
for (offset = 0; offset < padded_len; offset += wordsize)
{
- ULONGEST word = extract_address (padded + offset, wordsize);
+ ULONGEST word = extract_unsigned_integer (padded + offset, wordsize);
write_register (reg++, word);
}
}
@@ -830,11 +830,11 @@
{
case 1: /* char */
case 2: /* short, int */
- regval = extract_address (valbuf, len);
+ regval = extract_unsigned_integer (valbuf, len);
write_register (0, regval);
break;
case 4: /* long, float */
- regval = extract_address (valbuf, len);
+ regval = extract_unsigned_integer (valbuf, len);
if (wordsize == 4)
{
write_register (0, regval);
@@ -1032,8 +1032,8 @@
static CORE_ADDR
h8300_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf + h8300_register_byte (E_ARG0_REGNUM),
- h8300_register_raw_size (E_ARG0_REGNUM));
+ return extract_unsigned_integer (regbuf + h8300_register_byte (E_ARG0_REGNUM),
+ h8300_register_raw_size (E_ARG0_REGNUM));
}
const static unsigned char *
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.75
diff -u -r1.75 hppa-tdep.c
--- hppa-tdep.c 8 May 2003 22:33:14 -0000 1.75
+++ hppa-tdep.c 14 May 2003 12:05:14 -0000
@@ -4899,12 +4899,12 @@
/* Extract from an array REGBUF containing the (raw) register state
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
- /* FIXME: brobecker 2002-12-26.
- The current implementation is historical, but we should eventually
- implement it in a more robust manner as it relies on the fact that
- the address size is equal to the size of an int* _on the host_...
- One possible implementation that crossed my mind is to use
- extract_address. */
+ /* FIXME: brobecker 2002-12-26. The current implementation is
+ historical, but we should eventually implement it in a more
+ robust manner as it relies on the fact that the address size is
+ equal to the size of an int* _on the host_... One possible
+ implementation that crossed my mind is to use
+ extract_unsigned_integer. */
return (*(int *)(regbuf + REGISTER_BYTE (28)));
}
Index: hpux-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpux-thread.c,v
retrieving revision 1.17
diff -u -r1.17 hpux-thread.c
--- hpux-thread.c 13 May 2003 19:27:28 -0000 1.17
+++ hpux-thread.c 14 May 2003 12:05:14 -0000
@@ -360,8 +360,8 @@
&deprecated_registers[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE (regno));
tcb_ptr->static_ctx.sp = (cma__t_hppa_regs *)
- (extract_address (&deprecated_registers[REGISTER_BYTE (regno)],
- REGISTER_RAW_SIZE (regno)) + 160);
+ (extract_unsigned_integer (&deprecated_registers[REGISTER_BYTE (regno)],
+ REGISTER_RAW_SIZE (regno)) + 160);
}
else if (regno == PC_REGNUM)
write_memory (sp - 20,
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.76
diff -u -r1.76 ia64-tdep.c
--- ia64-tdep.c 13 May 2003 19:27:28 -0000 1.76
+++ ia64-tdep.c 14 May 2003 12:05:16 -0000
@@ -1681,7 +1681,7 @@
status = target_read_memory (addr + 8, buf, sizeof (buf));
if (status != 0)
break;
- global_pointer = extract_address (buf, sizeof (buf));
+ global_pointer = extract_unsigned_integer (buf, sizeof (buf));
/* The payoff... */
return global_pointer;
@@ -1863,7 +1863,7 @@
char val_buf[8];
store_unsigned_integer (val_buf, 8,
- find_func_descr (extract_address (VALUE_CONTENTS (arg), 8),
+ find_func_descr (extract_unsigned_integer (VALUE_CONTENTS (arg), 8),
&funcdescaddr));
if (slotnum < rseslots)
write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
Index: irix4-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix4-nat.c,v
retrieving revision 1.11
diff -u -r1.11 irix4-nat.c
--- irix4-nat.c 8 May 2003 22:33:14 -0000 1.11
+++ irix4-nat.c 14 May 2003 12:05:17 -0000
@@ -156,7 +156,7 @@
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
Index: irix5-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/irix5-nat.c,v
retrieving revision 1.21
diff -u -r1.21 irix5-nat.c
--- irix5-nat.c 14 Nov 2002 20:37:28 -0000 1.21
+++ irix5-nat.c 14 May 2003 12:05:17 -0000
@@ -174,7 +174,7 @@
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
Index: jv-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-valprint.c,v
retrieving revision 1.12
diff -u -r1.12 jv-valprint.c
--- jv-valprint.c 21 Feb 2003 02:49:12 -0000 1.12
+++ jv-valprint.c 14 May 2003 12:05:17 -0000
@@ -110,14 +110,14 @@
{
read_memory (address, buf, sizeof (buf));
address += TARGET_PTR_BIT / HOST_CHAR_BIT;
- element = extract_address (buf, sizeof (buf));
+ element = extract_unsigned_integer (buf, sizeof (buf));
}
for (reps = 1; i + reps < length; reps++)
{
read_memory (address, buf, sizeof (buf));
address += TARGET_PTR_BIT / HOST_CHAR_BIT;
- next_element = extract_address (buf, sizeof (buf));
+ next_element = extract_unsigned_integer (buf, sizeof (buf));
if (next_element != element)
break;
}
@@ -469,7 +469,7 @@
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
- print_address_demangle (extract_address (valaddr, TYPE_LENGTH (type)),
+ print_address_demangle (extract_unsigned_integer (valaddr, TYPE_LENGTH (type)),
stream, demangle);
break;
}
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.66
diff -u -r1.66 m68hc11-tdep.c
--- m68hc11-tdep.c 5 May 2003 17:56:55 -0000 1.66
+++ m68hc11-tdep.c 14 May 2003 12:05:17 -0000
@@ -1171,8 +1171,8 @@
static CORE_ADDR
m68hc11_extract_struct_value_address (char *regbuf)
{
- return extract_address (®buf[HARD_D_REGNUM * 2],
- REGISTER_RAW_SIZE (HARD_D_REGNUM));
+ return extract_unsigned_integer (®buf[HARD_D_REGNUM * 2],
+ REGISTER_RAW_SIZE (HARD_D_REGNUM));
}
/* Function: push_return_address (pc)
Index: m68k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68k-tdep.c,v
retrieving revision 1.59
diff -u -r1.59 m68k-tdep.c
--- m68k-tdep.c 5 May 2003 17:56:55 -0000 1.59
+++ m68k-tdep.c 14 May 2003 12:05:21 -0000
@@ -923,13 +923,13 @@
buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ jb_addr = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
#else
Index: mcore-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mcore-tdep.c,v
retrieving revision 1.62
diff -u -r1.62 mcore-tdep.c
--- mcore-tdep.c 5 May 2003 17:56:55 -0000 1.62
+++ mcore-tdep.c 14 May 2003 12:05:22 -0000
@@ -992,7 +992,8 @@
CORE_ADDR
mcore_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf + REGISTER_BYTE (FIRST_ARGREG), DEPRECATED_REGISTER_SIZE);
+ return extract_unsigned_integer (regbuf + REGISTER_BYTE (FIRST_ARGREG),
+ DEPRECATED_REGISTER_SIZE);
}
/* Given a function which returns a value of type TYPE, extract the
Index: mips-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-linux-tdep.c,v
retrieving revision 1.10
diff -u -r1.10 mips-linux-tdep.c
--- mips-linux-tdep.c 8 May 2003 20:52:47 -0000 1.10
+++ mips-linux-tdep.c 14 May 2003 12:05:22 -0000
@@ -80,7 +80,7 @@
buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
@@ -367,7 +367,7 @@
buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
Index: mips-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-nat.c,v
retrieving revision 1.11
diff -u -r1.11 mips-nat.c
--- mips-nat.c 8 May 2003 22:33:14 -0000 1.11
+++ mips-nat.c 14 May 2003 12:05:22 -0000
@@ -147,7 +147,7 @@
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
Index: mipsnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsnbsd-tdep.c,v
retrieving revision 1.4
diff -u -r1.4 mipsnbsd-tdep.c
--- mipsnbsd-tdep.c 21 Dec 2002 19:58:07 -0000 1.4
+++ mipsnbsd-tdep.c 14 May 2003 12:05:25 -0000
@@ -250,7 +250,7 @@
NBSD_MIPS_JB_ELEMENT_SIZE))
return 0;
- *pc = extract_address (buf, NBSD_MIPS_JB_ELEMENT_SIZE);
+ *pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE);
return 1;
}
Index: mipsv4-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsv4-nat.c,v
retrieving revision 1.10
diff -u -r1.10 mipsv4-nat.c
--- mipsv4-nat.c 8 May 2003 22:33:14 -0000 1.10
+++ mipsv4-nat.c 14 May 2003 12:05:25 -0000
@@ -154,7 +154,7 @@
TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+ *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
Index: mn10300-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v
retrieving revision 1.76
diff -u -r1.76 mn10300-tdep.c
--- mn10300-tdep.c 8 May 2003 20:52:48 -0000 1.76
+++ mn10300-tdep.c 14 May 2003 12:05:27 -0000
@@ -131,8 +131,8 @@
static CORE_ADDR
mn10300_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf + REGISTER_BYTE (4),
- REGISTER_RAW_SIZE (4));
+ return extract_unsigned_integer (regbuf + REGISTER_BYTE (4),
+ REGISTER_RAW_SIZE (4));
}
static void
Index: ns32k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ns32k-tdep.c,v
retrieving revision 1.47
diff -u -r1.47 ns32k-tdep.c
--- ns32k-tdep.c 5 May 2003 17:56:55 -0000 1.47
+++ ns32k-tdep.c 14 May 2003 12:05:27 -0000
@@ -503,7 +503,8 @@
static CORE_ADDR
ns32k_extract_struct_value_address (char *regbuf)
{
- return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
+ return (extract_unsigned_integer (regbuf + REGISTER_BYTE (0),
+ REGISTER_RAW_SIZE (0)));
}
\f
void
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.16
diff -u -r1.16 p-valprint.c
--- p-valprint.c 25 Feb 2003 21:36:19 -0000 1.16
+++ p-valprint.c 14 May 2003 12:05:27 -0000
@@ -141,7 +141,7 @@
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
- print_address_demangle (extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
+ print_address_demangle (extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)),
stream, demangle);
break;
}
@@ -273,8 +273,9 @@
{
fprintf_filtered (stream, "@");
print_address_numeric
- (extract_address (valaddr + embedded_offset,
- TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
+ (extract_unsigned_integer (valaddr + embedded_offset,
+ TARGET_PTR_BIT / HOST_CHAR_BIT),
+ 1, stream);
if (deref_ref)
fputs_filtered (": ", stream);
}
@@ -312,10 +313,11 @@
/* Print the unmangled name if desired. */
/* Print vtable entry - we only get here if NOT using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
- print_address_demangle (extract_address (
- valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
- TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
- stream, demangle);
+ print_address_demangle
+ (extract_unsigned_integer (valaddr + embedded_offset
+ + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+ TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+ stream, demangle);
}
else
{
Index: ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.28
diff -u -r1.28 ppc-linux-tdep.c
--- ppc-linux-tdep.c 14 Apr 2003 02:29:40 -0000 1.28
+++ ppc-linux-tdep.c 14 May 2003 12:05:27 -0000
@@ -295,7 +295,7 @@
/* Get address of the relocation entry (Elf32_Rela) */
if (target_read_memory (plt_table + reloc_index, buf, 4) != 0)
return 0;
- reloc = extract_address (buf, 4);
+ reloc = extract_unsigned_integer (buf, 4);
sect = find_pc_section (reloc);
if (!sect)
Index: remote-vxsparc.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-vxsparc.c,v
retrieving revision 1.11
diff -u -r1.11 remote-vxsparc.c
--- remote-vxsparc.c 6 Apr 2003 01:13:59 -0000 1.11
+++ remote-vxsparc.c 14 May 2003 12:05:30 -0000
@@ -101,8 +101,8 @@
area in the frame. VxWorks does not do this for the active frame
automatically; it greatly simplifies debugging. */
- sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)],
- REGISTER_RAW_SIZE (SP_REGNUM));
+ sp = extract_unsigned_integer (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)],
+ REGISTER_RAW_SIZE (SP_REGNUM));
write_memory (sp, &deprecated_registers[REGISTER_BYTE (L0_REGNUM)],
16 * REGISTER_RAW_SIZE (L0_REGNUM));
@@ -176,8 +176,8 @@
if (regno < 0 || (L0_REGNUM <= regno && regno <= I7_REGNUM))
{
- sp = extract_address (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)],
- REGISTER_RAW_SIZE (SP_REGNUM));
+ sp = extract_unsigned_integer (&deprecated_registers[REGISTER_BYTE (SP_REGNUM)],
+ REGISTER_RAW_SIZE (SP_REGNUM));
write_memory (sp, &deprecated_registers[REGISTER_BYTE (L0_REGNUM)],
16 * REGISTER_RAW_SIZE (L0_REGNUM));
}
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.123
diff -u -r1.123 sh-tdep.c
--- sh-tdep.c 13 May 2003 19:27:28 -0000 1.123
+++ sh-tdep.c 14 May 2003 12:05:36 -0000
@@ -1921,14 +1921,14 @@
static CORE_ADDR
sh_extract_struct_value_address (char *regbuf)
{
- return (extract_address ((regbuf), REGISTER_RAW_SIZE (0)));
+ return (extract_unsigned_integer ((regbuf), REGISTER_RAW_SIZE (0)));
}
static CORE_ADDR
sh64_extract_struct_value_address (char *regbuf)
{
- return (extract_address ((regbuf + REGISTER_BYTE (STRUCT_RETURN_REGNUM)),
- REGISTER_RAW_SIZE (STRUCT_RETURN_REGNUM)));
+ return (extract_unsigned_integer ((regbuf + REGISTER_BYTE (STRUCT_RETURN_REGNUM)),
+ REGISTER_RAW_SIZE (STRUCT_RETURN_REGNUM)));
}
static CORE_ADDR
@@ -2123,7 +2123,7 @@
if (argreg <= tdep->ARGLAST_REGNUM)
{
/* there's room in a register */
- regval = extract_address (val, REGISTER_RAW_SIZE (argreg));
+ regval = extract_unsigned_integer (val, REGISTER_RAW_SIZE (argreg));
write_register (argreg++, regval);
}
/* Store the value 4 bytes at a time. This means that things
@@ -2238,7 +2238,7 @@
if (int_argreg <= tdep->ARGLAST_REGNUM)
{
/* there's room in a register */
- regval = extract_address (val, argreg_size);
+ regval = extract_unsigned_integer (val, argreg_size);
write_register (int_argreg, regval);
}
/* Store the value 8 bytes at a time. This means that
Index: solib-irix.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-irix.c,v
retrieving revision 1.3
diff -u -r1.3 solib-irix.c
--- solib-irix.c 8 Apr 2003 19:21:15 -0000 1.3
+++ solib-irix.c 14 May 2003 12:05:41 -0000
@@ -124,7 +124,7 @@
/* MIPS sign extends its 32 bit addresses. We could conceivably use
extract_typed_address here, but to do so, we'd have to construct an
appropriate type. Calling extract_signed_integer or
- extract_address seems simpler. */
+ extract_unsigned_integer seems simpler. */
static CORE_ADDR
extract_mips_address (void *addr, int len)
@@ -132,7 +132,7 @@
if (len <= 32)
return extract_signed_integer (addr, len);
else
- return extract_address (addr, len);
+ return extract_unsigned_integer (addr, len);
}
/* Fetch and return the link map data associated with ADDR. Note that
Index: solib-sunos.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-sunos.c,v
retrieving revision 1.9
diff -u -r1.9 solib-sunos.c
--- solib-sunos.c 8 Apr 2003 19:21:15 -0000 1.9
+++ solib-sunos.c 14 May 2003 12:05:43 -0000
@@ -75,7 +75,7 @@
to get the right address when accessing the core file BFD. */
#define SOLIB_EXTRACT_ADDRESS(MEMBER) \
- extract_address (&(MEMBER), sizeof (MEMBER))
+ extract_unsigned_integer (&(MEMBER), sizeof (MEMBER))
/* local data declarations */
@@ -108,7 +108,7 @@
int lm_next_offset = offsetof (struct link_map, lm_next);
int lm_next_size = fieldsize (struct link_map, lm_next);
- return extract_address (so->lm_info->lm + lm_next_offset, lm_next_size);
+ return extract_unsigned_integer (so->lm_info->lm + lm_next_offset, lm_next_size);
}
static CORE_ADDR
@@ -117,7 +117,7 @@
int lm_name_offset = offsetof (struct link_map, lm_name);
int lm_name_size = fieldsize (struct link_map, lm_name);
- return extract_address (so->lm_info->lm + lm_name_offset, lm_name_size);
+ return extract_unsigned_integer (so->lm_info->lm + lm_name_offset, lm_name_size);
}
static CORE_ADDR debug_base; /* Base of dynamic linker structures */
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.32
diff -u -r1.32 solib-svr4.c
--- solib-svr4.c 15 Apr 2003 00:28:23 -0000 1.32
+++ solib-svr4.c 14 May 2003 12:05:43 -0000
@@ -112,7 +112,7 @@
to get the right address when accessing the core file BFD. */
#define SOLIB_EXTRACT_ADDRESS(MEMBER) \
- extract_address (&(MEMBER), sizeof (MEMBER))
+ extract_unsigned_integer (&(MEMBER), sizeof (MEMBER))
/* local data declarations */
@@ -132,7 +132,7 @@
{
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
- return extract_address (so->lm_info->lm + lmo->l_next_offset, lmo->l_next_size);
+ return extract_unsigned_integer (so->lm_info->lm + lmo->l_next_offset, lmo->l_next_size);
}
static CORE_ADDR
@@ -140,7 +140,7 @@
{
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
- return extract_address (so->lm_info->lm + lmo->l_name_offset, lmo->l_name_size);
+ return extract_unsigned_integer (so->lm_info->lm + lmo->l_name_offset, lmo->l_name_size);
}
static int
@@ -148,8 +148,8 @@
{
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
- return extract_address (so->lm_info->lm + lmo->l_prev_offset,
- lmo->l_prev_size) == 0;
+ return extract_unsigned_integer (so->lm_info->lm + lmo->l_prev_offset,
+ lmo->l_prev_size) == 0;
}
static CORE_ADDR debug_base; /* Base of dynamic linker structures */
@@ -587,7 +587,7 @@
read_memory (debug_base + lmo->r_map_offset, r_map_buf, lmo->r_map_size);
- lm = extract_address (r_map_buf, lmo->r_map_size);
+ lm = extract_unsigned_integer (r_map_buf, lmo->r_map_size);
/* FIXME: Perhaps we should validate the info somehow, perhaps by
checking r_version for a known version number, or r_state for
@@ -646,7 +646,7 @@
read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
/* Convert the address to host format. */
- l_name = extract_address (l_name_buf, lmo->l_name_size);
+ l_name = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
/* Free l_name_buf. */
do_cleanups (cleanups);
@@ -821,8 +821,8 @@
read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
/* Extract this object's name. */
- name_address = extract_address (l_name_buf,
- lmo->l_name_size);
+ name_address = extract_unsigned_integer (l_name_buf,
+ lmo->l_name_size);
target_read_string (name_address, &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
make_cleanup (xfree, buffer);
@@ -844,8 +844,8 @@
}
}
/* Not the file we wanted, continue checking. */
- lm = extract_address (objfile_lm_info.lm + lmo->l_next_offset,
- lmo->l_next_size);
+ lm = extract_unsigned_integer (objfile_lm_info.lm + lmo->l_next_offset,
+ lmo->l_next_size);
do_cleanups (old_chain);
}
return 0;
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.99
diff -u -r1.99 sparc-tdep.c
--- sparc-tdep.c 13 May 2003 19:27:28 -0000 1.99
+++ sparc-tdep.c 14 May 2003 12:05:48 -0000
@@ -461,8 +461,8 @@
CORE_ADDR
sparc_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf + REGISTER_BYTE (O0_REGNUM),
- REGISTER_RAW_SIZE (O0_REGNUM));
+ return extract_unsigned_integer (regbuf + REGISTER_BYTE (O0_REGNUM),
+ REGISTER_RAW_SIZE (O0_REGNUM));
}
/* Find the pc saved in frame FRAME. */
@@ -507,7 +507,7 @@
stack layout has changed or the stack is corrupt. */
target_read_memory (sigcontext_addr + saved_pc_offset,
scbuf, sizeof (scbuf));
- return extract_address (scbuf, sizeof (scbuf));
+ return extract_unsigned_integer (scbuf, sizeof (scbuf));
}
else if (get_frame_extra_info (frame)->in_prologue ||
(get_next_frame (frame) != NULL &&
@@ -533,7 +533,7 @@
return PC_ADJUST (read_register (O7_REGNUM));
read_memory (addr, buf, SPARC_INTREG_SIZE);
- return PC_ADJUST (extract_address (buf, SPARC_INTREG_SIZE));
+ return PC_ADJUST (extract_unsigned_integer (buf, SPARC_INTREG_SIZE));
}
/* Since an individual frame in the frame cache is defined by two
@@ -1795,7 +1795,7 @@
LONGJMP_TARGET_SIZE))
return 0;
- *pc = extract_address (buf, LONGJMP_TARGET_SIZE);
+ *pc = extract_unsigned_integer (buf, LONGJMP_TARGET_SIZE);
return 1;
}
Index: sparcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcnbsd-tdep.c,v
retrieving revision 1.3
diff -u -r1.3 sparcnbsd-tdep.c
--- sparcnbsd-tdep.c 21 Dec 2002 19:58:07 -0000 1.3
+++ sparcnbsd-tdep.c 14 May 2003 12:05:48 -0000
@@ -445,7 +445,7 @@
if (target_read_memory (jb_addr + 12, buf, sizeof (buf)))
return 0;
- *pc = extract_address (buf, sizeof (buf));
+ *pc = extract_unsigned_integer (buf, sizeof (buf));
return 1;
}
@@ -461,7 +461,7 @@
if (target_read_memory (jb_addr + 16, buf, sizeof (buf)))
return 0;
- *pc = extract_address (buf, sizeof (buf));
+ *pc = extract_unsigned_integer (buf, sizeof (buf));
return 1;
}
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.75
diff -u -r1.75 stack.c
--- stack.c 8 May 2003 20:52:48 -0000 1.75
+++ stack.c 14 May 2003 12:05:49 -0000
@@ -818,7 +818,7 @@
CORE_ADDR sp;
frame_register_unwind (fi, SP_REGNUM, &optimized, &lval, &addr,
&realnum, value);
- sp = extract_address (value, REGISTER_RAW_SIZE (SP_REGNUM));
+ 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: v850-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/v850-tdep.c,v
retrieving revision 1.62
diff -u -r1.62 v850-tdep.c
--- v850-tdep.c 13 May 2003 19:27:28 -0000 1.62
+++ v850-tdep.c 14 May 2003 12:05:49 -0000
@@ -973,7 +973,7 @@
{
CORE_ADDR regval;
- regval = extract_address (val, v850_register_raw_size (argreg));
+ regval = extract_unsigned_integer (val, v850_register_raw_size (argreg));
write_register (argreg, regval);
len -= v850_register_raw_size (argreg);
@@ -1068,8 +1068,8 @@
/* Aggregates and return values > 8 bytes are returned in memory,
pointed to by R6. */
return_buffer =
- extract_address (regbuf + REGISTER_BYTE (E_V0_REGNUM),
- REGISTER_RAW_SIZE (E_V0_REGNUM));
+ extract_unsigned_integer (regbuf + REGISTER_BYTE (E_V0_REGNUM),
+ REGISTER_RAW_SIZE (E_V0_REGNUM));
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
}
@@ -1086,8 +1086,8 @@
static CORE_ADDR
v850_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf + v850_register_byte (E_V0_REGNUM),
- v850_register_raw_size (E_V0_REGNUM));
+ return extract_unsigned_integer (regbuf + v850_register_byte (E_V0_REGNUM),
+ v850_register_raw_size (E_V0_REGNUM));
}
static void
Index: vax-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/vax-tdep.c,v
retrieving revision 1.48
diff -u -r1.48 vax-tdep.c
--- vax-tdep.c 5 May 2003 17:56:56 -0000 1.48
+++ vax-tdep.c 14 May 2003 12:05:49 -0000
@@ -326,7 +326,7 @@
static CORE_ADDR
vax_extract_struct_value_address (char *regbuf)
{
- return (extract_address (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
+ return (extract_unsigned_integer (regbuf + REGISTER_BYTE (0), REGISTER_RAW_SIZE (0)));
}
\f
static const unsigned char *
Index: xstormy16-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/xstormy16-tdep.c,v
retrieving revision 1.50
diff -u -r1.50 xstormy16-tdep.c
--- xstormy16-tdep.c 13 May 2003 19:27:28 -0000 1.50
+++ xstormy16-tdep.c 14 May 2003 12:05:50 -0000
@@ -228,8 +228,8 @@
/* Aggregates and return values > 12 bytes are returned in memory,
pointed to by R2. */
return_buffer =
- extract_address (regbuf + REGISTER_BYTE (E_PTR_RET_REGNUM),
- REGISTER_RAW_SIZE (E_PTR_RET_REGNUM));
+ extract_unsigned_integer (regbuf + REGISTER_BYTE (E_PTR_RET_REGNUM),
+ REGISTER_RAW_SIZE (E_PTR_RET_REGNUM));
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
}
@@ -410,9 +410,9 @@
static CORE_ADDR
xstormy16_extract_struct_value_address (char *regbuf)
{
- return extract_address (regbuf +
- xstormy16_register_byte (E_PTR_RET_REGNUM),
- xstormy16_reg_size);
+ return extract_unsigned_integer (regbuf +
+ xstormy16_register_byte (E_PTR_RET_REGNUM),
+ xstormy16_reg_size);
}
/* Function: xstormy16_use_struct_convention
@@ -962,7 +962,7 @@
xstormy16_pointer_to_address (struct type *type, const void *buf)
{
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
- CORE_ADDR addr = extract_address (buf, TYPE_LENGTH (type));
+ CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
{
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch rfc] Eliminate extract_address
2003-05-14 12:10 [patch rfc] Eliminate extract_address Andrew Cagney
@ 2003-05-14 16:42 ` Kevin Buettner
2003-05-15 16:49 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Buettner @ 2003-05-14 16:42 UTC (permalink / raw)
To: Andrew Cagney, gdb-patches
Can you explain why you doing
s/extract_address/extract_unsigned_integer/
is a good thing?
Perhaps this has been discussed already, but I see two drawbacks...
First, the return types are different. extract_address() returns
CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
we were to encounter a scenario where this is a problem, it's easier
to fix a wrapper (extract_address()) instead of the myriad places in
the code which presently call extract_address(). (This point is
probably moot because I suspect we already have a lot of code which
assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
anyway.)
Second, having function calls to extract_address() provides
information to the reader that you don't get by having calls to
extract_unsigned_integer(). It tells the reader that we're expecting
to get an address and not an integer. This really helps when someone
reading gdb's code is wondering about what the thing is that's being
extracted.
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch rfc] Eliminate extract_address
2003-05-14 16:42 ` Kevin Buettner
@ 2003-05-15 16:49 ` Andrew Cagney
2003-05-15 18:20 ` Kevin Buettner
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-05-15 16:49 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> Can you explain why you doing
>
> s/extract_address/extract_unsigned_integer/
>
> is a good thing?
> Perhaps this has been discussed already, but I see two drawbacks...
>
> First, the return types are different. extract_address() returns
> CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
> we were to encounter a scenario where this is a problem, it's easier
> to fix a wrapper (extract_address()) instead of the myriad places in
> the code which presently call extract_address(). (This point is
> probably moot because I suspect we already have a lot of code which
> assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
> anyway.)
sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem.
> Second, having function calls to extract_address() provides
> information to the reader that you don't get by having calls to
> extract_unsigned_integer(). It tells the reader that we're expecting
> to get an address and not an integer. This really helps when someone
> reading gdb's code is wondering about what the thing is that's being
> extracted.
The extract_address function doesn't extract an address, it extracts an
unsigned integer.
On the MIPS, extract_address needs to sign extend. On the d10v, extract
address needs to know the address space.
If the code needs to extract an address it can use extract_typed_address
which corectly handles all these cases.
Is it a good thing? It eliminates a lie.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch rfc] Eliminate extract_address
2003-05-15 16:49 ` Andrew Cagney
@ 2003-05-15 18:20 ` Kevin Buettner
2003-05-15 19:03 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Buettner @ 2003-05-15 18:20 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On May 15, 12:49pm, Andrew Cagney wrote:
> > First, the return types are different. extract_address() returns
> > CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
> > we were to encounter a scenario where this is a problem, it's easier
> > to fix a wrapper (extract_address()) instead of the myriad places in
> > the code which presently call extract_address(). (This point is
> > probably moot because I suspect we already have a lot of code which
> > assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
> > anyway.)
>
> sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem.
Do we have a gdb_assert() somewhere to ensure that this is the case?
(This could happen at initialization time...)
> > Second, having function calls to extract_address() provides
> > information to the reader that you don't get by having calls to
> > extract_unsigned_integer(). It tells the reader that we're expecting
> > to get an address and not an integer. This really helps when someone
> > reading gdb's code is wondering about what the thing is that's being
> > extracted.
>
> The extract_address function doesn't extract an address, it extracts an
> unsigned integer.
> On the MIPS, extract_address needs to sign extend. On the d10v, extract
> address needs to know the address space.
Yes, I understand that. Doing the substitution you propose will make
it more difficult to make the correct fix (of using extract_typed_address)
at a later time.
> If the code needs to extract an address it can use extract_typed_address
> which corectly handles all these cases.
Yes.
> Is it a good thing? It eliminates a lie.
At the expense of making the code marginally less comprehensible and
making it more difficult to identify the potential cases where
extract_typed_address() should be used instead.
Or have all of those cases already been identified? If so, then I
withdraw my objection. (Though I still like having "address" in the
function name to help to document what it is that's being extracted.)
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch rfc] Eliminate extract_address
2003-05-15 18:20 ` Kevin Buettner
@ 2003-05-15 19:03 ` Andrew Cagney
2003-05-21 16:20 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-05-15 19:03 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> On May 15, 12:49pm, Andrew Cagney wrote:
>
>
>> > First, the return types are different. extract_address() returns
>> > CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
>> > we were to encounter a scenario where this is a problem, it's easier
>> > to fix a wrapper (extract_address()) instead of the myriad places in
>> > the code which presently call extract_address(). (This point is
>> > probably moot because I suspect we already have a lot of code which
>> > assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
>> > anyway.)
>
>>
>> sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem.
>
>
> Do we have a gdb_assert() somewhere to ensure that this is the case?
> (This could happen at initialization time...)
Magic in "defs.h" does it. An assert wouldn't hurt.
>> > Second, having function calls to extract_address() provides
>> > information to the reader that you don't get by having calls to
>> > extract_unsigned_integer(). It tells the reader that we're expecting
>> > to get an address and not an integer. This really helps when someone
>> > reading gdb's code is wondering about what the thing is that's being
>> > extracted.
>
>>
>> The extract_address function doesn't extract an address, it extracts an
>> unsigned integer.
>> On the MIPS, extract_address needs to sign extend. On the d10v, extract
>> address needs to know the address space.
>
>
> Yes, I understand that. Doing the substitution you propose will make
> it more difficult to make the correct fix (of using extract_typed_address)
> at a later time.
>
>
>> If the code needs to extract an address it can use extract_typed_address
>> which corectly handles all these cases.
>
>
> Yes.
>
>
>> Is it a good thing? It eliminates a lie.
>
>
> At the expense of making the code marginally less comprehensible and
> making it more difficult to identify the potential cases where
> extract_typed_address() should be used instead.
I think it makes it more comprehensible - it is now very clear exactly
how the value is being obtained. The ``extract_address'' function gives
the misleading impression that it is correctly extracting an address,
and that (per MIPS and d10v) isn't the case.
It also takes away the assumption that extract_address can, some how, be
made cross architecture.
> Or have all of those cases already been identified? If so, then I
> withdraw my objection. (Though I still like having "address" in the
> function name to help to document what it is that's being extracted.)
It tinkers with the following:
- ada/jv-* where things are pretty broken
- dwarf2 which is extracting/assuming an an unsigned integer
- unsigned_pointer_to_address making its implementation consistent with
signed_pointer_to_address
- solib* where it is now (worryingly) clear what the code is doing.
- stack.c where it's printing out an integer value
After that, it's all target dependant code.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch rfc] Eliminate extract_address
2003-05-15 19:03 ` Andrew Cagney
@ 2003-05-21 16:20 ` Andrew Cagney
2003-05-21 16:41 ` Kevin Buettner
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-05-21 16:20 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
Kevin?
The other option would be deprecate it, but I'd prefer not to as when
pratical elimination is always better than deprecation.
Andrew
>> First, the return types are different. extract_address() returns
>> CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
>> we were to encounter a scenario where this is a problem, it's easier
>> to fix a wrapper (extract_address()) instead of the myriad places in
>> the code which presently call extract_address(). (This point is
>> probably moot because I suspect we already have a lot of code which
>> assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
>> anyway.)
>
>
> sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem.
>
>
> Do we have a gdb_assert() somewhere to ensure that this is the case?
> (This could happen at initialization time...)
>
> Magic in "defs.h" does it. An assert wouldn't hurt.
>
>> Second, having function calls to extract_address() provides
>> information to the reader that you don't get by having calls to
>> extract_unsigned_integer(). It tells the reader that we're expecting
>> to get an address and not an integer. This really helps when someone
>> reading gdb's code is wondering about what the thing is that's being
>> extracted.
>
>
> The extract_address function doesn't extract an address, it extracts an unsigned integer.
> On the MIPS, extract_address needs to sign extend. On the d10v, extract address needs to know the address space.
>
>
> Yes, I understand that. Doing the substitution you propose will make
> it more difficult to make the correct fix (of using extract_typed_address)
> at a later time.
>
>
> If the code needs to extract an address it can use extract_typed_address which corectly handles all these cases.
>
>
> Yes.
>
>
> Is it a good thing? It eliminates a lie.
>
>
> At the expense of making the code marginally less comprehensible and
> making it more difficult to identify the potential cases where
> extract_typed_address() should be used instead.
>
> I think it makes it more comprehensible - it is now very clear exactly how the value is being obtained. The ``extract_address'' function gives the misleading impression that it is correctly extracting an address, and that (per MIPS and d10v) isn't the case.
>
> It also takes away the assumption that extract_address can, some how, be made cross architecture.
>
> Or have all of those cases already been identified? If so, then I
> withdraw my objection. (Though I still like having "address" in the
> function name to help to document what it is that's being extracted.)
>
> It tinkers with the following:
>
> - ada/jv-* where things are pretty broken
>
> - dwarf2 which is extracting/assuming an an unsigned integer
>
> - unsigned_pointer_to_address making its implementation consistent with signed_pointer_to_address
>
> - solib* where it is now (worryingly) clear what the code is doing.
>
> - stack.c where it's printing out an integer value
>
> After that, it's all target dependant code.
>
> Andrew
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch rfc] Eliminate extract_address
2003-05-21 16:20 ` Andrew Cagney
@ 2003-05-21 16:41 ` Kevin Buettner
2003-05-22 17:50 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Buettner @ 2003-05-21 16:41 UTC (permalink / raw)
To: Andrew Cagney, Kevin Buettner; +Cc: gdb-patches
On May 21, 12:19pm, Andrew Cagney wrote:
> Kevin?
>
> The other option would be deprecate it, but I'd prefer not to as when
> pratical elimination is always better than deprecation.
Yes, I agree with this sentiment.
If you are confident that those of us reading the code will be able to
determine that it is actually an address that's being extracted, then
I have no further objections. If there's any place where it's unclear,
then I suggest the addition of a comment.
Kevin
> Andrew
>
>
> >> First, the return types are different. extract_address() returns
> >> CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
> >> we were to encounter a scenario where this is a problem, it's easier
> >> to fix a wrapper (extract_address()) instead of the myriad places in
> >> the code which presently call extract_address(). (This point is
> >> probably moot because I suspect we already have a lot of code which
> >> assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
> >> anyway.)
> >
> >
> > sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem.
> >
> >
> > Do we have a gdb_assert() somewhere to ensure that this is the case?
> > (This could happen at initialization time...)
> >
> > Magic in "defs.h" does it. An assert wouldn't hurt.
> >
> >> Second, having function calls to extract_address() provides
> >> information to the reader that you don't get by having calls to
> >> extract_unsigned_integer(). It tells the reader that we're expecting
> >> to get an address and not an integer. This really helps when someone
> >> reading gdb's code is wondering about what the thing is that's being
> >> extracted.
> >
> >
> > The extract_address function doesn't extract an address, it extracts an unsigned integer.
> > On the MIPS, extract_address needs to sign extend. On the d10v, extract address needs to know the address space.
> >
> >
> > Yes, I understand that. Doing the substitution you propose will make
> > it more difficult to make the correct fix (of using extract_typed_address)
> > at a later time.
> >
> >
> > If the code needs to extract an address it can use extract_typed_address which corectly handles all these cases.
> >
> >
> > Yes.
> >
> >
> > Is it a good thing? It eliminates a lie.
> >
> >
> > At the expense of making the code marginally less comprehensible and
> > making it more difficult to identify the potential cases where
> > extract_typed_address() should be used instead.
> >
> > I think it makes it more comprehensible - it is now very clear exactly how the value is being obtained. The ``extract_address'' function gives the misleading impression that it is correctly extracting an address, and that (per MIPS and d10v) isn't the case.
> >
> > It also takes away the assumption that extract_address can, some how, be made cross architecture.
> >
> > Or have all of those cases already been identified? If so, then I
> > withdraw my objection. (Though I still like having "address" in the
> > function name to help to document what it is that's being extracted.)
> >
> > It tinkers with the following:
> >
> > - ada/jv-* where things are pretty broken
> >
> > - dwarf2 which is extracting/assuming an an unsigned integer
> >
> > - unsigned_pointer_to_address making its implementation consistent with signed_pointer_to_address
> >
> > - solib* where it is now (worryingly) clear what the code is doing.
> >
> > - stack.c where it's printing out an integer value
> >
> > After that, it's all target dependant code.
> >
> > Andrew
> >
> >
> >
>
>-- End of excerpt from Andrew Cagney
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch rfc] Eliminate extract_address
2003-05-21 16:41 ` Kevin Buettner
@ 2003-05-22 17:50 ` Andrew Cagney
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2003-05-22 17:50 UTC (permalink / raw)
To: Kevin Buettner; +Cc: gdb-patches
> On May 21, 12:19pm, Andrew Cagney wrote:
>
>
>> Kevin?
>>
>> The other option would be deprecate it, but I'd prefer not to as when
>> pratical elimination is always better than deprecation.
>
>
> Yes, I agree with this sentiment.
>
> If you are confident that those of us reading the code will be able to
> determine that it is actually an address that's being extracted, then
> I have no further objections. If there's any place where it's unclear,
> then I suggest the addition of a comment.
I'll do this (which means I'll re-do the change piece meal) and commit
over comming days.
Andrew
>> Andrew
>>
>>
>
>> >> First, the return types are different. extract_address() returns
>> >> CORE_ADDR while extract_unsigned_integer returns ULONGEST. If
>> >> we were to encounter a scenario where this is a problem, it's easier
>> >> to fix a wrapper (extract_address()) instead of the myriad places in
>> >> the code which presently call extract_address(). (This point is
>> >> probably moot because I suspect we already have a lot of code which
>> >> assumes that CORE_ADDR may be interchanged with LONGEST or ULONGEST
>> >> anyway.)
>
>> >
>> >
>> > sizeof(CORE_ADDR) <= sizeof(ULONGEST) so this isn't a problem.
>> >
>> >
>> > Do we have a gdb_assert() somewhere to ensure that this is the case?
>> > (This could happen at initialization time...)
>> >
>> > Magic in "defs.h" does it. An assert wouldn't hurt.
>> >
>
>> >> Second, having function calls to extract_address() provides
>> >> information to the reader that you don't get by having calls to
>> >> extract_unsigned_integer(). It tells the reader that we're expecting
>> >> to get an address and not an integer. This really helps when someone
>> >> reading gdb's code is wondering about what the thing is that's being
>> >> extracted.
>
>> >
>> >
>> > The extract_address function doesn't extract an address, it extracts an unsigned integer.
>> > On the MIPS, extract_address needs to sign extend. On the d10v, extract address needs to know the address space.
>> >
>> >
>> > Yes, I understand that. Doing the substitution you propose will make
>> > it more difficult to make the correct fix (of using extract_typed_address)
>> > at a later time.
>> >
>> >
>> > If the code needs to extract an address it can use extract_typed_address which corectly handles all these cases.
>> >
>> >
>> > Yes.
>> >
>> >
>> > Is it a good thing? It eliminates a lie.
>> >
>> >
>> > At the expense of making the code marginally less comprehensible and
>> > making it more difficult to identify the potential cases where
>> > extract_typed_address() should be used instead.
>> >
>> > I think it makes it more comprehensible - it is now very clear exactly how the value is being obtained. The ``extract_address'' function gives the misleading impression that it is correctly extracting an address, and that (per MIPS and d10v) isn't the case.
>> >
>> > It also takes away the assumption that extract_address can, some how, be made cross architecture.
>> >
>> > Or have all of those cases already been identified? If so, then I
>> > withdraw my objection. (Though I still like having "address" in the
>> > function name to help to document what it is that's being extracted.)
>> >
>> > It tinkers with the following:
>> >
>> > - ada/jv-* where things are pretty broken
>> >
>> > - dwarf2 which is extracting/assuming an an unsigned integer
>> >
>> > - unsigned_pointer_to_address making its implementation consistent with signed_pointer_to_address
>> >
>> > - solib* where it is now (worryingly) clear what the code is doing.
>> >
>> > - stack.c where it's printing out an integer value
>> >
>> > After that, it's all target dependant code.
>> >
>> > Andrew
>> >
>> >
>> >
>
>>
>>-- End of excerpt from Andrew Cagney
>
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-05-22 17:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 12:10 [patch rfc] Eliminate extract_address Andrew Cagney
2003-05-14 16:42 ` Kevin Buettner
2003-05-15 16:49 ` Andrew Cagney
2003-05-15 18:20 ` Kevin Buettner
2003-05-15 19:03 ` Andrew Cagney
2003-05-21 16:20 ` Andrew Cagney
2003-05-21 16:41 ` Kevin Buettner
2003-05-22 17:50 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox