2005-05-19 Andrew Cagney <cagney@gnu.org>

* defs.h (extract_signed_integer, extract_unsigned_integer)
	(extract_long_unsigned_integer, extract_typed_address)
	(store_signed_integer, store_unsigned_integer)
	(store_typed_address): Use gdb_byte for byte buffer parameters.
	(push_bytes, push_word): Delete declaration.
	* valops.c (push_bytes, push_word): Delete function.
	* findvar.c (extract_signed_integer, extract_unsigned_integer)
	(extract_typed_address, store_signed_integer)
	(store_unsigned_integer): Update.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.185
diff -p -u -r1.185 defs.h
--- defs.h	9 May 2005 17:20:18 -0000	1.185
+++ defs.h	19 May 2005 17:54:12 -0000
@@ -1042,27 +1042,25 @@ enum { MAX_REGISTER_SIZE = 16 };

 /* In findvar.c.  */

-extern LONGEST extract_signed_integer (const void *, int);
+extern LONGEST extract_signed_integer (const gdb_byte *, int);

-extern ULONGEST extract_unsigned_integer (const void *, int);
+extern ULONGEST extract_unsigned_integer (const gdb_byte *, int);

-extern int extract_long_unsigned_integer (const void *, int, LONGEST *);
+extern int extract_long_unsigned_integer (const gdb_byte *, int, LONGEST *);

-extern CORE_ADDR extract_typed_address (const void *buf, struct type *type);
+extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
+					struct type *type);

-extern void store_signed_integer (void *, int, LONGEST);
+extern void store_signed_integer (gdb_byte *, int, LONGEST);

-extern void store_unsigned_integer (void *, int, ULONGEST);
+extern void store_unsigned_integer (gdb_byte *, int, ULONGEST);

-extern void store_typed_address (void *buf, struct type *type, CORE_ADDR addr);
+extern void store_typed_address (gdb_byte *buf, struct type *type,
+				 CORE_ADDR addr);

 
 /* From valops.c */

-extern CORE_ADDR push_bytes (CORE_ADDR, char *, int);
-
-extern CORE_ADDR push_word (CORE_ADDR, ULONGEST);
-
 extern int watchdog;

 /* Hooks for alternate command interfaces.  */
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.91
diff -p -u -r1.91 findvar.c
--- findvar.c	14 May 2005 06:07:41 -0000	1.91
+++ findvar.c	19 May 2005 17:54:12 -0000
@@ -49,7 +49,7 @@ you lose
 #endif

 LONGEST
-extract_signed_integer (const void *addr, int len)
+extract_signed_integer (const gdb_byte *addr, int len)
 {
   LONGEST retval;
   const unsigned char *p;
@@ -83,7 +83,7 @@ That operation is not available on integ
 }

 ULONGEST
-extract_unsigned_integer (const void *addr, int len)
+extract_unsigned_integer (const gdb_byte *addr, int len)
 {
   ULONGEST retval;
   const unsigned char *p;
@@ -117,16 +117,18 @@ That operation is not available on integ
    function returns 1 and sets *PVAL.  Otherwise it returns 0.  */

 int
-extract_long_unsigned_integer (const void *addr, int orig_len, LONGEST *pval)
+extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
+			       LONGEST *pval)
 {
-  char *p, *first_addr;
+  const gdb_byte *p;
+  const gdb_byte *first_addr;
   int len;

   len = orig_len;
   if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
     {
-      for (p = (char *) addr;
-	   len > (int) sizeof (LONGEST) && p < (char *) addr + orig_len;
+      for (p = addr;
+	   len > (int) sizeof (LONGEST) && p < addr + orig_len;
 	   p++)
 	{
 	  if (*p == 0)
@@ -138,9 +140,9 @@ extract_long_unsigned_integer (const voi
     }
   else
     {
-      first_addr = (char *) addr;
-      for (p = (char *) addr + orig_len - 1;
-	   len > (int) sizeof (LONGEST) && p >= (char *) addr;
+      first_addr = addr;
+      for (p = addr + orig_len - 1;
+	   len > (int) sizeof (LONGEST) && p >= addr;
 	   p--)
 	{
 	  if (*p == 0)
@@ -164,7 +166,7 @@ extract_long_unsigned_integer (const voi
 /* Treat the bytes at BUF as a pointer of type TYPE, and return the
    address it represents.  */
 CORE_ADDR
-extract_typed_address (const void *buf, struct type *type)
+extract_typed_address (const gdb_byte *buf, struct type *type)
 {
   if (TYPE_CODE (type) != TYPE_CODE_PTR
       && TYPE_CODE (type) != TYPE_CODE_REF)
@@ -177,11 +179,11 @@ extract_typed_address (const void *buf,


 void
-store_signed_integer (void *addr, int len, LONGEST val)
+store_signed_integer (gdb_byte *addr, int len, LONGEST val)
 {
-  unsigned char *p;
-  unsigned char *startaddr = (unsigned char *) addr;
-  unsigned char *endaddr = startaddr + len;
+  gdb_byte *p;
+  gdb_byte *startaddr = addr;
+  gdb_byte *endaddr = startaddr + len;

   /* Start at the least significant end of the integer, and work towards
      the most significant.  */
@@ -204,7 +206,7 @@ store_signed_integer (void *addr, int le
 }

 void
-store_unsigned_integer (void *addr, int len, ULONGEST val)
+store_unsigned_integer (gdb_byte *addr, int len, ULONGEST val)
 {
   unsigned char *p;
   unsigned char *startaddr = (unsigned char *) addr;
@@ -233,7 +235,7 @@ store_unsigned_integer (void *addr, int
 /* Store the address ADDR as a pointer of type TYPE at BUF, in target
    form.  */
 void
-store_typed_address (void *buf, struct type *type, CORE_ADDR addr)
+store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
 {
   if (TYPE_CODE (type) != TYPE_CODE_PTR
       && TYPE_CODE (type) != TYPE_CODE_REF)
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.157
diff -p -u -r1.157 valops.c
--- valops.c	9 May 2005 21:20:35 -0000	1.157
+++ valops.c	19 May 2005 17:54:12 -0000
@@ -933,54 +933,6 @@ value_ind (struct value *arg1)
   return 0;			/* For lint -- never reached */
 }
 
-/* Pushing small parts of stack frames.  */
-
-/* Push one word (the size of object that a register holds).  */
-
-CORE_ADDR
-push_word (CORE_ADDR sp, ULONGEST word)
-{
-  int len = DEPRECATED_REGISTER_SIZE;
-  char buffer[MAX_REGISTER_SIZE];
-
-  store_unsigned_integer (buffer, len, word);
-  if (INNER_THAN (1, 2))
-    {
-      /* stack grows downward */
-      sp -= len;
-      write_memory (sp, buffer, len);
-    }
-  else
-    {
-      /* stack grows upward */
-      write_memory (sp, buffer, len);
-      sp += len;
-    }
-
-  return sp;
-}
-
-/* Push LEN bytes with data at BUFFER.  */
-
-CORE_ADDR
-push_bytes (CORE_ADDR sp, char *buffer, int len)
-{
-  if (INNER_THAN (1, 2))
-    {
-      /* stack grows downward */
-      sp -= len;
-      write_memory (sp, buffer, len);
-    }
-  else
-    {
-      /* stack grows upward */
-      write_memory (sp, buffer, len);
-      sp += len;
-    }
-
-  return sp;
-}
-
 /* Create a value for an array by allocating space in the inferior, copying
    the data into that space, and then setting up an array value.
This commit is contained in:
Andrew Cagney 2005-05-19 17:55:53 +00:00
parent 2d522557c6
commit 0d509538cb
4 changed files with 37 additions and 75 deletions

View File

@ -1,5 +1,15 @@
2005-05-19 Andrew Cagney <cagney@gnu.org>
* defs.h (extract_signed_integer, extract_unsigned_integer)
(extract_long_unsigned_integer, extract_typed_address)
(store_signed_integer, store_unsigned_integer)
(store_typed_address): Use gdb_byte for byte buffer parameters.
(push_bytes, push_word): Delete declaration.
* valops.c (push_bytes, push_word): Delete function.
* findvar.c (extract_signed_integer, extract_unsigned_integer)
(extract_typed_address, store_signed_integer)
(store_unsigned_integer): Update.
* regcache.h (regcache_raw_read, regcache_raw_write)
(regcache_raw_read_part, regcache_raw_write_part)
(regcache_cooked_read_part, regcache_cooked_write_part)

View File

@ -1042,27 +1042,25 @@ enum { MAX_REGISTER_SIZE = 16 };
/* In findvar.c. */
extern LONGEST extract_signed_integer (const void *, int);
extern LONGEST extract_signed_integer (const gdb_byte *, int);
extern ULONGEST extract_unsigned_integer (const void *, int);
extern ULONGEST extract_unsigned_integer (const gdb_byte *, int);
extern int extract_long_unsigned_integer (const void *, int, LONGEST *);
extern int extract_long_unsigned_integer (const gdb_byte *, int, LONGEST *);
extern CORE_ADDR extract_typed_address (const void *buf, struct type *type);
extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
struct type *type);
extern void store_signed_integer (void *, int, LONGEST);
extern void store_signed_integer (gdb_byte *, int, LONGEST);
extern void store_unsigned_integer (void *, int, ULONGEST);
extern void store_unsigned_integer (gdb_byte *, int, ULONGEST);
extern void store_typed_address (void *buf, struct type *type, CORE_ADDR addr);
extern void store_typed_address (gdb_byte *buf, struct type *type,
CORE_ADDR addr);
/* From valops.c */
extern CORE_ADDR push_bytes (CORE_ADDR, char *, int);
extern CORE_ADDR push_word (CORE_ADDR, ULONGEST);
extern int watchdog;
/* Hooks for alternate command interfaces. */

View File

@ -49,7 +49,7 @@ you lose
#endif
LONGEST
extract_signed_integer (const void *addr, int len)
extract_signed_integer (const gdb_byte *addr, int len)
{
LONGEST retval;
const unsigned char *p;
@ -83,7 +83,7 @@ That operation is not available on integers of more than %d bytes."),
}
ULONGEST
extract_unsigned_integer (const void *addr, int len)
extract_unsigned_integer (const gdb_byte *addr, int len)
{
ULONGEST retval;
const unsigned char *p;
@ -117,16 +117,18 @@ That operation is not available on integers of more than %d bytes."),
function returns 1 and sets *PVAL. Otherwise it returns 0. */
int
extract_long_unsigned_integer (const void *addr, int orig_len, LONGEST *pval)
extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
LONGEST *pval)
{
char *p, *first_addr;
const gdb_byte *p;
const gdb_byte *first_addr;
int len;
len = orig_len;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
{
for (p = (char *) addr;
len > (int) sizeof (LONGEST) && p < (char *) addr + orig_len;
for (p = addr;
len > (int) sizeof (LONGEST) && p < addr + orig_len;
p++)
{
if (*p == 0)
@ -138,9 +140,9 @@ extract_long_unsigned_integer (const void *addr, int orig_len, LONGEST *pval)
}
else
{
first_addr = (char *) addr;
for (p = (char *) addr + orig_len - 1;
len > (int) sizeof (LONGEST) && p >= (char *) addr;
first_addr = addr;
for (p = addr + orig_len - 1;
len > (int) sizeof (LONGEST) && p >= addr;
p--)
{
if (*p == 0)
@ -164,7 +166,7 @@ extract_long_unsigned_integer (const void *addr, int orig_len, LONGEST *pval)
/* Treat the bytes at BUF as a pointer of type TYPE, and return the
address it represents. */
CORE_ADDR
extract_typed_address (const void *buf, struct type *type)
extract_typed_address (const gdb_byte *buf, struct type *type)
{
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@ -177,11 +179,11 @@ extract_typed_address (const void *buf, struct type *type)
void
store_signed_integer (void *addr, int len, LONGEST val)
store_signed_integer (gdb_byte *addr, int len, LONGEST val)
{
unsigned char *p;
unsigned char *startaddr = (unsigned char *) addr;
unsigned char *endaddr = startaddr + len;
gdb_byte *p;
gdb_byte *startaddr = addr;
gdb_byte *endaddr = startaddr + len;
/* Start at the least significant end of the integer, and work towards
the most significant. */
@ -204,7 +206,7 @@ store_signed_integer (void *addr, int len, LONGEST val)
}
void
store_unsigned_integer (void *addr, int len, ULONGEST val)
store_unsigned_integer (gdb_byte *addr, int len, ULONGEST val)
{
unsigned char *p;
unsigned char *startaddr = (unsigned char *) addr;
@ -233,7 +235,7 @@ store_unsigned_integer (void *addr, int len, ULONGEST val)
/* Store the address ADDR as a pointer of type TYPE at BUF, in target
form. */
void
store_typed_address (void *buf, struct type *type, CORE_ADDR addr)
store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
{
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)

View File

@ -933,54 +933,6 @@ value_ind (struct value *arg1)
return 0; /* For lint -- never reached */
}
/* Pushing small parts of stack frames. */
/* Push one word (the size of object that a register holds). */
CORE_ADDR
push_word (CORE_ADDR sp, ULONGEST word)
{
int len = DEPRECATED_REGISTER_SIZE;
char buffer[MAX_REGISTER_SIZE];
store_unsigned_integer (buffer, len, word);
if (INNER_THAN (1, 2))
{
/* stack grows downward */
sp -= len;
write_memory (sp, buffer, len);
}
else
{
/* stack grows upward */
write_memory (sp, buffer, len);
sp += len;
}
return sp;
}
/* Push LEN bytes with data at BUFFER. */
CORE_ADDR
push_bytes (CORE_ADDR sp, char *buffer, int len)
{
if (INNER_THAN (1, 2))
{
/* stack grows downward */
sp -= len;
write_memory (sp, buffer, len);
}
else
{
/* stack grows upward */
write_memory (sp, buffer, len);
sp += len;
}
return sp;
}
/* Create a value for an array by allocating space in the inferior, copying
the data into that space, and then setting up an array value.