* printcmd.c (output_command): Always initialize fmt.size.

(printf_command): Use gdb_byte.
	* symfile.c (separate_debug_file_exists): Use gdb_byte.
	(load_section_callback, read_target_long_array): Likewise.
	(simple_read_overlay_table, simple_read_overlay_region_table)
	(simple_overlay_update_1): Correct calls to read_target_long_array.
	* valprint.c (partial_memory_read): Change MYADDR to a gdb_byte *.
	Also change local pointers.
	(val_print_string): Use gdb_byte.
This commit is contained in:
Daniel Jacobowitz
2006-01-15 19:50:05 +00:00
parent 4b17b3897b
commit 777ea8f14f
4 changed files with 40 additions and 25 deletions

View File

@@ -1,8 +1,8 @@
/* Print values for GDB, the GNU debugger.
Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free Software
Foundation, Inc.
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GDB.
@@ -39,7 +39,7 @@
/* Prototypes for local functions */
static int partial_memory_read (CORE_ADDR memaddr, char *myaddr,
static int partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr,
int len, int *errnoptr);
static void show_print (char *, int);
@@ -1038,7 +1038,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
function be eliminated. */
static int
partial_memory_read (CORE_ADDR memaddr, char *myaddr, int len, int *errnoptr)
partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int *errnoptr)
{
int nread; /* Number of bytes actually read. */
int errcode; /* Error from last read. */
@@ -1086,9 +1086,9 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
unsigned int fetchlimit; /* Maximum number of chars to print. */
unsigned int nfetch; /* Chars to fetch / chars fetched. */
unsigned int chunksize; /* Size of each fetch, in chars. */
char *buffer = NULL; /* Dynamically growable fetch buffer. */
char *bufptr; /* Pointer to next available byte in buffer. */
char *limit; /* First location past end of fetch buffer. */
gdb_byte *buffer = NULL; /* Dynamically growable fetch buffer. */
gdb_byte *bufptr; /* Pointer to next available byte in buffer. */
gdb_byte *limit; /* First location past end of fetch buffer. */
struct cleanup *old_chain = NULL; /* Top of the old cleanup chain. */
int found_nul; /* Non-zero if we found the nul char */
@@ -1121,7 +1121,7 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
if (len > 0)
{
buffer = (char *) xmalloc (len * width);
buffer = (gdb_byte *) xmalloc (len * width);
bufptr = buffer;
old_chain = make_cleanup (xfree, buffer);
@@ -1139,11 +1139,11 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
nfetch = min (chunksize, fetchlimit - bufsize);
if (buffer == NULL)
buffer = (char *) xmalloc (nfetch * width);
buffer = (gdb_byte *) xmalloc (nfetch * width);
else
{
discard_cleanups (old_chain);
buffer = (char *) xrealloc (buffer, (nfetch + bufsize) * width);
buffer = (gdb_byte *) xrealloc (buffer, (nfetch + bufsize) * width);
}
old_chain = make_cleanup (xfree, buffer);
@@ -1196,13 +1196,13 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
if (len == -1 && !found_nul)
{
char *peekbuf;
gdb_byte *peekbuf;
/* We didn't find a null terminator we were looking for. Attempt
to peek at the next character. If not successful, or it is not
a null byte, then force ellipsis to be printed. */
peekbuf = (char *) alloca (width);
peekbuf = (gdb_byte *) alloca (width);
if (target_read_memory (addr, peekbuf, width) == 0
&& extract_unsigned_integer (peekbuf, width) != 0)