* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,

symtab.h, tm-i386v4.h, valprint.c, values.c:  Lint.
	* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
	findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
	putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
	utils.c, valarith.c, valops.c, valprint.c, values.c:
	Replace bcopy() use with memcpy(), which is more standard and can
	take advantage of gcc's builtin functions for increased performance.
	* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
	ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
	target.c, values.c:
	Replace bzero() use with memset(), which is more standard and can
	take advantage of gcc's builtin functions for increased performance.
	* i386-tdep.c, main.c, valprint.c:
	Replace bcmp() use with memcmp(), which is more standard and can
	take advantage of gcc's builtin functions for increased performance.
This commit is contained in:
Fred Fish 1992-06-29 23:34:38 +00:00
parent 22fd4704bc
commit 51b57ded88
44 changed files with 837 additions and 373 deletions

View file

@ -1,3 +1,22 @@
Mon Jun 29 16:30:25 1992 Fred Fish (fnf@cygnus.com)
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
Sun Jun 28 13:30:22 1992 Fred Fish (fnf@cygnus.com) Sun Jun 28 13:30:22 1992 Fred Fish (fnf@cygnus.com)
* remote.c (remote_wait): Fix cast on signal() call. * remote.c (remote_wait): Fix cast on signal() call.

View file

@ -391,8 +391,8 @@ read_memory_nobpt (memaddr, myaddr, len)
bptlen -= (membpt + bptlen) - (memaddr + len); bptlen -= (membpt + bptlen) - (memaddr + len);
} }
bcopy (b->shadow_contents + bptoffset, (void) memcpy (myaddr + membpt - memaddr,
myaddr + membpt - memaddr, bptlen); b->shadow_contents + bptoffset, bptlen);
if (membpt > memaddr) if (membpt > memaddr)
{ {
@ -577,7 +577,7 @@ bpstat_copy (bs)
for (; bs != NULL; bs = bs->next) for (; bs != NULL; bs = bs->next)
{ {
tmp = (bpstat) xmalloc (sizeof (*tmp)); tmp = (bpstat) xmalloc (sizeof (*tmp));
bcopy (bs, tmp, sizeof (*tmp)); (void) memcpy (tmp, bs, sizeof (*tmp));
if (p == NULL) if (p == NULL)
/* This is the first thing in the chain. */ /* This is the first thing in the chain. */
retval = tmp; retval = tmp;
@ -1209,7 +1209,7 @@ set_raw_breakpoint (sal)
register struct breakpoint *b, *b1; register struct breakpoint *b, *b1;
b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint)); b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
bzero (b, sizeof *b); (void) memset (b, 0, sizeof (*b));
b->address = sal.pc; b->address = sal.pc;
b->symtab = sal.symtab; b->symtab = sal.symtab;
b->line_number = sal.line; b->line_number = sal.line;
@ -1377,6 +1377,12 @@ mention (b)
if (b->symtab) if (b->symtab)
printf_filtered (": file %s, line %d.", printf_filtered (": file %s, line %d.",
b->symtab->filename, b->line_number); b->symtab->filename, b->line_number);
break;
case bp_until:
case bp_finish:
case bp_longjmp:
case bp_longjmp_resume:
break;
} }
printf_filtered ("\n"); printf_filtered ("\n");
} }
@ -1796,7 +1802,7 @@ get_catch_sals (this_level_only)
bl = blockvector_for_pc (BLOCK_END (block) - 4, &index); bl = blockvector_for_pc (BLOCK_END (block) - 4, &index);
blocks_searched = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char)); blocks_searched = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
bzero (blocks_searched, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char)); (void) memset (blocks_searched, 0, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
while (block != 0) while (block != 0)
{ {

View file

@ -220,8 +220,8 @@ dbx_lookup_type (typenums)
type_vector = (struct type **) type_vector = (struct type **)
xrealloc ((char *) type_vector, xrealloc ((char *) type_vector,
(type_vector_length * sizeof (struct type *))); (type_vector_length * sizeof (struct type *)));
bzero (&type_vector[old_len], (void) memset (&type_vector[old_len], 0,
(type_vector_length - old_len) * sizeof (struct type *)); (type_vector_length - old_len) * sizeof (struct type *));
} }
return &type_vector[index]; return &type_vector[index];
} }
@ -243,8 +243,8 @@ dbx_lookup_type (typenums)
f->length *= 2; f->length *= 2;
f->vector = (struct type **) f->vector = (struct type **)
xrealloc ((char *) f->vector, f->length * sizeof (struct type *)); xrealloc ((char *) f->vector, f->length * sizeof (struct type *));
bzero (&f->vector[f_orig_length], (void) memset (&f->vector[f_orig_length], 0,
(f->length - f_orig_length) * sizeof (struct type *)); (f->length - f_orig_length) * sizeof (struct type *));
} }
return &f->vector[index]; return &f->vector[index];
} }
@ -968,7 +968,7 @@ void
buildsym_new_init () buildsym_new_init ()
{ {
/* Empty the hash table of global syms looking for values. */ /* Empty the hash table of global syms looking for values. */
bzero (global_sym_chain, sizeof global_sym_chain); (void) memset (global_sym_chain, 0, sizeof global_sym_chain);
buildsym_init (); buildsym_init ();
} }
@ -2825,7 +2825,7 @@ read_array_type (pp, type, objfile)
/* Create range type. */ /* Create range type. */
range_type = (struct type *) range_type = (struct type *)
obstack_alloc (&objfile -> type_obstack, sizeof (struct type)); obstack_alloc (&objfile -> type_obstack, sizeof (struct type));
bzero (range_type, sizeof (struct type)); (void) memset (range_type, 0, sizeof (struct type));
TYPE_OBJFILE (range_type) = objfile; TYPE_OBJFILE (range_type) = objfile;
TYPE_CODE (range_type) = TYPE_CODE_RANGE; TYPE_CODE (range_type) = TYPE_CODE_RANGE;
TYPE_TARGET_TYPE (range_type) = index_type; TYPE_TARGET_TYPE (range_type) = index_type;
@ -2905,7 +2905,7 @@ read_enum_type (pp, type, objfile)
n = read_number (pp, ','); n = read_number (pp, ',');
sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol)); sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
bzero (sym, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol));
SYMBOL_NAME (sym) = name; SYMBOL_NAME (sym) = name;
SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@ -3254,7 +3254,7 @@ read_range_type (pp, typenums, objfile)
result_type = (struct type *) result_type = (struct type *)
obstack_alloc (&objfile -> type_obstack, obstack_alloc (&objfile -> type_obstack,
sizeof (struct type)); sizeof (struct type));
bzero (result_type, sizeof (struct type)); (void) memset (result_type, 0, sizeof (struct type));
TYPE_OBJFILE (result_type) = objfile; TYPE_OBJFILE (result_type) = objfile;
TYPE_LENGTH (result_type) = nbits / TARGET_CHAR_BIT; TYPE_LENGTH (result_type) = nbits / TARGET_CHAR_BIT;
TYPE_CODE (result_type) = TYPE_CODE_INT; TYPE_CODE (result_type) = TYPE_CODE_INT;
@ -3366,7 +3366,7 @@ read_range_type (pp, typenums, objfile)
result_type = (struct type *) result_type = (struct type *)
obstack_alloc (&objfile -> type_obstack, sizeof (struct type)); obstack_alloc (&objfile -> type_obstack, sizeof (struct type));
bzero (result_type, sizeof (struct type)); (void) memset (result_type, 0, sizeof (struct type));
TYPE_OBJFILE (result_type) = objfile; TYPE_OBJFILE (result_type) = objfile;
TYPE_CODE (result_type) = TYPE_CODE_RANGE; TYPE_CODE (result_type) = TYPE_CODE_RANGE;
@ -3381,7 +3381,7 @@ read_range_type (pp, typenums, objfile)
TYPE_FIELDS (result_type) = TYPE_FIELDS (result_type) =
(struct field *) obstack_alloc (&objfile -> type_obstack, (struct field *) obstack_alloc (&objfile -> type_obstack,
2 * sizeof (struct field)); 2 * sizeof (struct field));
bzero (TYPE_FIELDS (result_type), 2 * sizeof (struct field)); (void) memset (TYPE_FIELDS (result_type), 0, 2 * sizeof (struct field));
TYPE_FIELD_BITPOS (result_type, 0) = n2; TYPE_FIELD_BITPOS (result_type, 0) = n2;
TYPE_FIELD_BITPOS (result_type, 1) = n3; TYPE_FIELD_BITPOS (result_type, 1) = n3;
@ -3469,7 +3469,7 @@ read_args (pp, end, objfile)
else if (TYPE_CODE (types[n-1]) != TYPE_CODE_VOID) else if (TYPE_CODE (types[n-1]) != TYPE_CODE_VOID)
{ {
rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *)); rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *));
bzero (rval + n, sizeof (struct type *)); (void) memset (rval + n, 0, sizeof (struct type *));
} }
else else
{ {

View file

@ -1221,7 +1221,7 @@ yylex ()
{ {
char *err_copy = (char *) alloca (p - tokstart + 1); char *err_copy = (char *) alloca (p - tokstart + 1);
bcopy (tokstart, err_copy, p - tokstart); (void) memcpy (err_copy, tokstart, p - tokstart);
err_copy[p - tokstart] = 0; err_copy[p - tokstart] = 0;
error ("Invalid number \"%s\".", err_copy); error ("Invalid number \"%s\".", err_copy);
} }

View file

@ -324,7 +324,7 @@ coff_lookup_type (index)
type_vector = (struct type **) type_vector = (struct type **)
xrealloc ((char *) type_vector, xrealloc ((char *) type_vector,
type_vector_length * sizeof (struct type *)); type_vector_length * sizeof (struct type *));
bzero (&type_vector[old_vector_length], (void) memset (&type_vector[old_vector_length], 0,
(type_vector_length - old_vector_length) * sizeof(struct type *)); (type_vector_length - old_vector_length) * sizeof(struct type *));
} }
return &type_vector[index]; return &type_vector[index];
@ -776,7 +776,6 @@ coff_symfile_read (objfile, addr, mainline)
int num_symbols; int num_symbols;
int symtab_offset; int symtab_offset;
int stringtab_offset; int stringtab_offset;
struct symtab *s;
info = (struct coff_symfile_info *) objfile -> sym_private; info = (struct coff_symfile_info *) objfile -> sym_private;
symfile_bfd = abfd; /* Kludge for swap routines */ symfile_bfd = abfd; /* Kludge for swap routines */
@ -919,14 +918,14 @@ read_coff_symtab (symtab_offset, nsyms, objfile)
nlist_stream_global = stream; nlist_stream_global = stream;
nlist_nsyms_global = nsyms; nlist_nsyms_global = nsyms;
last_source_file = 0; last_source_file = 0;
bzero (opaque_type_chain, sizeof opaque_type_chain); (void) memset (opaque_type_chain, 0, sizeof opaque_type_chain);
if (type_vector) /* Get rid of previous one */ if (type_vector) /* Get rid of previous one */
free ((PTR)type_vector); free ((PTR)type_vector);
type_vector_length = 160; type_vector_length = 160;
type_vector = (struct type **) type_vector = (struct type **)
xmalloc (type_vector_length * sizeof (struct type *)); xmalloc (type_vector_length * sizeof (struct type *));
bzero (type_vector, type_vector_length * sizeof (struct type *)); (void) memset (type_vector, 0, type_vector_length * sizeof (struct type *));
coff_start_symtab (); coff_start_symtab ();
@ -1319,7 +1318,7 @@ init_stringtab (chan, offset)
if (stringtab == NULL) if (stringtab == NULL)
return -1; return -1;
bcopy (&length, stringtab, sizeof length); (void) memcpy (stringtab, &length, sizeof length);
if (length == sizeof length) /* Empty table -- just the count */ if (length == sizeof length) /* Empty table -- just the count */
return 0; return 0;
@ -1426,7 +1425,7 @@ init_lineno (chan, offset, size)
return -1; return -1;
/* Terminate it with an all-zero sentinel record */ /* Terminate it with an all-zero sentinel record */
bzero (linetab + size, local_linesz); (void) memset (linetab + size, 0, local_linesz);
make_cleanup (free, linetab); /* Be sure it gets de-allocated. */ make_cleanup (free, linetab); /* Be sure it gets de-allocated. */
return 0; return 0;
@ -1485,7 +1484,7 @@ patch_type (type, real_type)
TYPE_FIELDS (target) = (struct field *) TYPE_FIELDS (target) = (struct field *)
obstack_alloc (&current_objfile -> type_obstack, field_size); obstack_alloc (&current_objfile -> type_obstack, field_size);
bcopy (TYPE_FIELDS (real_target), TYPE_FIELDS (target), field_size); (void) memcpy (TYPE_FIELDS (target), TYPE_FIELDS (real_target), field_size);
if (TYPE_NAME (real_target)) if (TYPE_NAME (real_target))
{ {
@ -1576,7 +1575,7 @@ process_coff_symbol (cs, aux, objfile)
#endif #endif
struct type *temptype; struct type *temptype;
bzero (sym, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol));
name = cs->c_name; name = cs->c_name;
name = (name[0] == '_' ? name + offset : name); name = (name[0] == '_' ? name + offset : name);
SYMBOL_NAME (sym) = obstack_copy0 (&objfile->symbol_obstack, name, strlen (name)); SYMBOL_NAME (sym) = obstack_copy0 (&objfile->symbol_obstack, name, strlen (name));
@ -1595,8 +1594,8 @@ process_coff_symbol (cs, aux, objfile)
struct type *new = (struct type *) struct type *new = (struct type *)
obstack_alloc (&objfile->symbol_obstack, sizeof (struct type)); obstack_alloc (&objfile->symbol_obstack, sizeof (struct type));
bcopy(lookup_function_type (decode_function_type (cs, cs->c_type, aux)), (void) memcpy (new, lookup_function_type (decode_function_type (cs, cs->c_type, aux)),
new, sizeof(struct type)); sizeof(struct type));
SYMBOL_TYPE (sym) = new; SYMBOL_TYPE (sym) = new;
in_function_type = SYMBOL_TYPE(sym); in_function_type = SYMBOL_TYPE(sym);
#else #else
@ -1793,7 +1792,7 @@ decode_type (cs, c_type, aux)
type = (struct type *) type = (struct type *)
obstack_alloc (&current_objfile -> type_obstack, obstack_alloc (&current_objfile -> type_obstack,
sizeof (struct type)); sizeof (struct type));
bzero (type, sizeof (struct type)); (void) memset (type, 0, sizeof (struct type));
TYPE_OBJFILE (type) = current_objfile; TYPE_OBJFILE (type) = current_objfile;
base_type = decode_type (cs, new_c_type, aux); base_type = decode_type (cs, new_c_type, aux);
@ -2104,7 +2103,7 @@ coff_read_enum_type (index, length, lastsym)
{ {
case C_MOE: case C_MOE:
sym = (struct symbol *) xmalloc (sizeof (struct symbol)); sym = (struct symbol *) xmalloc (sizeof (struct symbol));
bzero (sym, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol));
SYMBOL_NAME (sym) = savestring (name, strlen (name)); SYMBOL_NAME (sym) = savestring (name, strlen (name));
SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_CLASS (sym) = LOC_CONST;

View file

@ -235,7 +235,7 @@ add_show_from_set (setcmd, list)
struct cmd_list_element *showcmd = struct cmd_list_element *showcmd =
(struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element)); (struct cmd_list_element *) xmalloc (sizeof (struct cmd_list_element));
bcopy (setcmd, showcmd, sizeof (struct cmd_list_element)); (void) memcpy (showcmd, setcmd, sizeof (struct cmd_list_element));
delete_cmd (showcmd->name, list); delete_cmd (showcmd->name, list);
showcmd->type = show_cmd; showcmd->type = show_cmd;

View file

@ -175,8 +175,10 @@ typedef struct string /* Beware: these aren't required to be */
static char * static char *
mop_up PARAMS ((string *, struct work_stuff *, int)); mop_up PARAMS ((string *, struct work_stuff *, int));
#if 0
static int static int
demangle_method_args PARAMS ((string *, const char **, struct work_stuff *)); demangle_method_args PARAMS ((string *, const char **, struct work_stuff *));
#endif
static int static int
demangle_template PARAMS ((string *declp, const char **, struct work_stuff *)); demangle_template PARAMS ((string *declp, const char **, struct work_stuff *));
@ -211,8 +213,10 @@ string_init PARAMS ((string *));
static void static void
string_clear PARAMS ((string *)); string_clear PARAMS ((string *));
#if 0
static int static int
string_empty PARAMS ((string *)); string_empty PARAMS ((string *));
#endif
static void static void
string_append PARAMS ((string *, const char *)); string_append PARAMS ((string *, const char *));
@ -335,7 +339,6 @@ cplus_demangle (mangled, options)
string decl; string decl;
int success = 0; int success = 0;
struct work_stuff work[1]; struct work_stuff work[1];
const char *p;
char *demangled = NULL; char *demangled = NULL;
if ((mangled != NULL) && (*mangled != '\0')) if ((mangled != NULL) && (*mangled != '\0'))
@ -582,7 +585,6 @@ demangle_template (declp, mangled, work)
struct work_stuff *work; struct work_stuff *work;
{ {
int i; int i;
int n;
string tname; string tname;
string trawname; string trawname;
int is_pointer; int is_pointer;
@ -662,8 +664,8 @@ demangle_template (declp, mangled, work)
{ {
case 'P': case 'P':
case 'R': case 'R':
done = is_pointer = 1; done = is_pointer = 1;
break; break;
case 'C': /* const */ case 'C': /* const */
case 'S': /* explicitly signed [char] */ case 'S': /* explicitly signed [char] */
case 'U': /* unsigned */ case 'U': /* unsigned */
@ -671,29 +673,29 @@ demangle_template (declp, mangled, work)
case 'F': /* function */ case 'F': /* function */
case 'M': /* member function */ case 'M': /* member function */
case 'O': /* ??? */ case 'O': /* ??? */
old_p++; old_p++;
continue; continue;
case 'Q': /* repetition of following */ case 'Q': /* repetition of following */
case 'T': /* remembered type */ case 'T': /* remembered type */
abort (); abort ();
break; break;
case 'v': /* void */ case 'v': /* void */
abort (); abort ();
break; break;
case 'x': /* long long */ case 'x': /* long long */
case 'l': /* long */ case 'l': /* long */
case 'i': /* int */ case 'i': /* int */
case 's': /* short */ case 's': /* short */
case 'c': /* char */ case 'c': /* char */
done = is_integral = 1; done = is_integral = 1;
break; break;
case 'r': /* long double */ case 'r': /* long double */
case 'd': /* double */ case 'd': /* double */
case 'f': /* float */ case 'f': /* float */
done = is_real = 1; done = is_real = 1;
break; break;
default: default:
abort (); abort ();
} }
} }
if (is_integral) if (is_integral)
@ -786,6 +788,7 @@ demangle_template (declp, mangled, work)
success = demangle_args (declp, mangled, work); success = demangle_args (declp, mangled, work);
} }
} }
return (success);
} }
/* /*
@ -1839,6 +1842,8 @@ string_clear (s)
s->p = s->b; s->p = s->b;
} }
#if 0
static int static int
string_empty (s) string_empty (s)
string *s; string *s;
@ -1846,6 +1851,8 @@ string_empty (s)
return (s->b == s->p); return (s->b == s->p);
} }
#endif
static void static void
string_append (p, s) string_append (p, s)
string *p; string *p;
@ -1901,6 +1908,7 @@ string_prepend (p, s)
} }
#if 0 #if 0
static void static void
string_prepends (p, s) string_prepends (p, s)
string *p, *s; string *p, *s;
@ -1910,6 +1918,7 @@ string_prepends (p, s)
string_prependn (p, s->b, s->p - s->b); string_prependn (p, s->b, s->p - s->b);
} }
} }
#endif #endif
static void static void

View file

@ -424,7 +424,7 @@ add_new_header_file (name, instance)
header_files[i].length = 10; header_files[i].length = 10;
header_files[i].vector header_files[i].vector
= (struct type **) xmalloc (10 * sizeof (struct type *)); = (struct type **) xmalloc (10 * sizeof (struct type *));
bzero (header_files[i].vector, 10 * sizeof (struct type *)); (void) memset (header_files[i].vector, 0, 10 * sizeof (struct type *));
add_this_object_header_file (i); add_this_object_header_file (i);
} }
@ -1872,7 +1872,7 @@ process_one_symbol (type, desc, valu, name, offset, objfile)
int i; int i;
struct symbol *sym = struct symbol *sym =
(struct symbol *) xmmalloc (objfile -> md, sizeof (struct symbol)); (struct symbol *) xmmalloc (objfile -> md, sizeof (struct symbol));
bzero (sym, sizeof *sym); (void) memset (sym, 0, sizeof *sym);
SYMBOL_NAME (sym) = savestring (name, strlen (name)); SYMBOL_NAME (sym) = savestring (name, strlen (name));
SYMBOL_CLASS (sym) = LOC_BLOCK; SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_NAMESPACE (sym) = (enum namespace)((long) SYMBOL_NAMESPACE (sym) = (enum namespace)((long)
@ -2014,7 +2014,7 @@ DEFUN(elfstab_build_psymtabs, (objfile, addr, mainline,
DBX_STRINGTAB_SIZE (objfile) = stabstrsize; DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
DBX_SYMTAB_OFFSET (objfile) = staboffset; DBX_SYMTAB_OFFSET (objfile) = staboffset;
if (stabstrsize < 0) if (stabstrsize < 0) /* FIXME: stabstrsize is unsigned; never true! */
error ("ridiculous string table size: %d bytes", stabstrsize); error ("ridiculous string table size: %d bytes", stabstrsize);
DBX_STRINGTAB (objfile) = (char *) DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1); obstack_alloc (&objfile->psymbol_obstack, stabstrsize+1);

View file

@ -643,6 +643,9 @@ perror PARAMS ((const char *)); /* 4.9.10.4 */
extern double extern double
atof PARAMS ((const char *nptr)); /* 4.10.1.1 */ atof PARAMS ((const char *nptr)); /* 4.10.1.1 */
extern int
atoi PARAMS ((const char *)); /* 4.10.1.2 */
#ifndef MALLOC_INCOMPATIBLE #ifndef MALLOC_INCOMPATIBLE
extern PTR extern PTR
@ -661,6 +664,12 @@ qsort PARAMS ((void *base, size_t nmemb, /* 4.10.5.2 */
size_t size, size_t size,
int (*comp)(const void *, const void *))); int (*comp)(const void *, const void *)));
extern PTR
memcpy PARAMS ((void *, const void *, size_t)); /* 4.11.2.1 */
extern int
memcmp PARAMS ((const void *, const void *, size_t)); /* 4.11.4.1 */
extern char * extern char *
strchr PARAMS ((const char *, int)); /* 4.11.5.2 */ strchr PARAMS ((const char *, int)); /* 4.11.5.2 */
@ -673,6 +682,9 @@ strstr PARAMS ((const char *, const char *)); /* 4.11.5.7 */
extern char * extern char *
strtok PARAMS ((char *, const char *)); /* 4.11.5.8 */ strtok PARAMS ((char *, const char *)); /* 4.11.5.8 */
extern PTR
memset PARAMS ((void *, int, size_t)); /* 4.11.6.1 */
extern char * extern char *
strerror PARAMS ((int)); /* 4.11.6.2 */ strerror PARAMS ((int)); /* 4.11.6.2 */

View file

@ -69,9 +69,16 @@ elf_symfile_finish PARAMS ((struct objfile *));
static void static void
elf_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *)); elf_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *));
#if 0
static void static void
record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type, record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
struct objfile *)); struct objfile *));
#endif
static void
record_minimal_symbol_and_info PARAMS ((char *, CORE_ADDR,
enum minimal_symbol_type, char *,
struct objfile *));
static void static void
elf_locate_sections PARAMS ((bfd *, asection *, PTR)); elf_locate_sections PARAMS ((bfd *, asection *, PTR));
@ -169,6 +176,8 @@ DESCRIPTION
*/ */
#if 0 /* FIXME: Unused */
static void static void
record_minimal_symbol (name, address, ms_type, objfile) record_minimal_symbol (name, address, ms_type, objfile)
char *name; char *name;
@ -180,6 +189,8 @@ record_minimal_symbol (name, address, ms_type, objfile)
prim_record_minimal_symbol (name, address, ms_type); prim_record_minimal_symbol (name, address, ms_type);
} }
#endif
static void static void
record_minimal_symbol_and_info (name, address, ms_type, info, objfile) record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
char *name; char *name;

View file

@ -1,29 +1,28 @@
/* environ.c -- library for manipulating environments for GNU. /* environ.c -- library for manipulating environments for GNU.
Copyright (C) 1986, 1989 Free Software Foundation, Inc. Copyright (C) 1986, 1989 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option) the Free Software Foundation; either version 2 of the License, or
any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
#include "defs.h"
#include "environ.h" #include "environ.h"
#include <string.h> #include <string.h>
#include "defs.h" /* For strsave(). */
extern char *xmalloc ();
extern char *xrealloc ();
extern void free ();
/* Return a new environment object. */ /* Return a new environment object. */
@ -74,13 +73,13 @@ init_environ (e)
(e->allocated + 1) * sizeof (char *)); (e->allocated + 1) * sizeof (char *));
} }
bcopy (environ, e->vector, (i + 1) * sizeof (char *)); (void) memcpy (e->vector, environ, (i + 1) * sizeof (char *));
while (--i >= 0) while (--i >= 0)
{ {
register int len = strlen (e->vector[i]); register int len = strlen (e->vector[i]);
register char *new = (char *) xmalloc (len + 1); register char *new = (char *) xmalloc (len + 1);
bcopy (e->vector[i], new, len + 1); (void) memcpy (new, e->vector[i], len + 1);
e->vector[i] = new; e->vector[i] = new;
} }
} }
@ -99,14 +98,14 @@ environ_vector (e)
char * char *
get_in_environ (e, var) get_in_environ (e, var)
struct environ *e; const struct environ *e;
char *var; const char *var;
{ {
register int len = strlen (var); register int len = strlen (var);
register char **vector = e->vector; register char **vector = e->vector;
register char *s; register char *s;
for (; s = *vector; vector++) for (; (s = *vector) != NULL; vector++)
if (!strncmp (s, var, len) if (!strncmp (s, var, len)
&& s[len] == '=') && s[len] == '=')
return &s[len + 1]; return &s[len + 1];
@ -119,15 +118,15 @@ get_in_environ (e, var)
void void
set_in_environ (e, var, value) set_in_environ (e, var, value)
struct environ *e; struct environ *e;
char *var; const char *var;
char *value; const char *value;
{ {
register int i; register int i;
register int len = strlen (var); register int len = strlen (var);
register char **vector = e->vector; register char **vector = e->vector;
register char *s; register char *s;
for (i = 0; s = vector[i]; i++) for (i = 0; (s = vector[i]) != NULL; i++)
if (!strncmp (s, var, len) if (!strncmp (s, var, len)
&& s[len] == '=') && s[len] == '=')
break; break;
@ -175,13 +174,13 @@ unset_in_environ (e, var)
register char **vector = e->vector; register char **vector = e->vector;
register char *s; register char *s;
for (; s = *vector; vector++) for (; (s = *vector) != NULL; vector++)
if (!strncmp (s, var, len) if (!strncmp (s, var, len)
&& s[len] == '=') && s[len] == '=')
{ {
free (s); free (s);
bcopy (vector + 1, vector, (void) memcpy (vector, vector + 1,
(e->allocated - (vector - e->vector)) * sizeof (char *)); (e->allocated - (vector - e->vector)) * sizeof (char *));
e->vector[e->allocated - 1] = 0; e->vector[e->allocated - 1] = 0;
return; return;
} }

View file

@ -1068,7 +1068,7 @@ parse_and_eval_type (p, length)
char *tmp = (char *)alloca (length + 4); char *tmp = (char *)alloca (length + 4);
struct expression *expr; struct expression *expr;
tmp[0] = '('; tmp[0] = '(';
bcopy (p, tmp+1, length); (void) memcpy (tmp+1, p, length);
tmp[length+1] = ')'; tmp[length+1] = ')';
tmp[length+2] = '0'; tmp[length+2] = '0';
tmp[length+3] = '\0'; tmp[length+3] = '\0';

View file

@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "defs.h" #include "defs.h"
#include "symtab.h" #include "symtab.h"
#include "gdbtypes.h"
#include "frame.h" #include "frame.h"
#include "value.h" #include "value.h"
#include "gdbcore.h" #include "gdbcore.h"
@ -129,7 +129,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
if (optimized != NULL) if (optimized != NULL)
*optimized = 0; *optimized = 0;
addr = find_saved_register (frame, regnum); addr = find_saved_register (frame, regnum);
if (addr != NULL) if (addr != 0)
{ {
if (lval != NULL) if (lval != NULL)
*lval = lval_memory; *lval = lval_memory;
@ -171,8 +171,9 @@ read_relative_register_raw_bytes (regnum, myaddr)
int optim; int optim;
if (regnum == FP_REGNUM && selected_frame) if (regnum == FP_REGNUM && selected_frame)
{ {
bcopy (&FRAME_FP(selected_frame), myaddr, sizeof (CORE_ADDR)); (void) memcpy (myaddr, &FRAME_FP(selected_frame),
SWAP_TARGET_AND_HOST (myaddr, sizeof (CORE_ADDR)); /* in target order */ REGISTER_RAW_SIZE(FP_REGNUM));
SWAP_TARGET_AND_HOST (myaddr, REGISTER_RAW_SIZE(FP_REGNUM)); /* in target order */
return 0; return 0;
} }
@ -201,8 +202,8 @@ value_of_register (regnum)
target_convert_to_virtual (regnum, raw_buffer, virtual_buffer); target_convert_to_virtual (regnum, raw_buffer, virtual_buffer);
val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum)); val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
bcopy (virtual_buffer, VALUE_CONTENTS_RAW (val), (void) memcpy (VALUE_CONTENTS_RAW (val), virtual_buffer,
REGISTER_VIRTUAL_SIZE (regnum)); REGISTER_VIRTUAL_SIZE (regnum));
VALUE_LVAL (val) = lval; VALUE_LVAL (val) = lval;
VALUE_ADDRESS (val) = addr; VALUE_ADDRESS (val) = addr;
VALUE_REGNO (val) = regnum; VALUE_REGNO (val) = regnum;
@ -262,7 +263,7 @@ read_register_bytes (regbyte, myaddr, len)
break; break;
} }
if (myaddr != NULL) if (myaddr != NULL)
bcopy (&registers[regbyte], myaddr, len); (void) memcpy (myaddr, &registers[regbyte], len);
} }
/* Read register REGNO into memory at MYADDR, which must be large enough /* Read register REGNO into memory at MYADDR, which must be large enough
@ -276,7 +277,8 @@ read_register_gen (regno, myaddr)
{ {
if (!register_valid[regno]) if (!register_valid[regno])
target_fetch_registers (regno); target_fetch_registers (regno);
bcopy (&registers[REGISTER_BYTE (regno)], myaddr, REGISTER_RAW_SIZE (regno)); (void) memcpy (myaddr, &registers[REGISTER_BYTE (regno)],
REGISTER_RAW_SIZE (regno));
} }
/* Copy LEN bytes of consecutive data from memory at MYADDR /* Copy LEN bytes of consecutive data from memory at MYADDR
@ -290,22 +292,24 @@ write_register_bytes (regbyte, myaddr, len)
{ {
/* Make sure the entire registers array is valid. */ /* Make sure the entire registers array is valid. */
read_register_bytes (0, (char *)NULL, REGISTER_BYTES); read_register_bytes (0, (char *)NULL, REGISTER_BYTES);
bcopy (myaddr, &registers[regbyte], len); (void) memcpy (&registers[regbyte], myaddr, len);
target_store_registers (-1); target_store_registers (-1);
} }
/* Return the contents of register REGNO, regarding it as an integer. */ /* Return the contents of register REGNO, regarding it as an integer. */
/* FIXME, this loses when the REGISTER_VIRTUAL (REGNO) is true. Also,
why is the return type CORE_ADDR rather than some integer type? */
CORE_ADDR CORE_ADDR
read_register (regno) read_register (regno)
int regno; int regno;
{ {
int reg; REGISTER_TYPE reg;
if (!register_valid[regno]) if (!register_valid[regno])
target_fetch_registers (regno); target_fetch_registers (regno);
/* FIXME, this loses when REGISTER_RAW_SIZE (regno) != sizeof (int) */ memcpy (&reg, &registers[REGISTER_BYTE (regno)], sizeof (REGISTER_TYPE));
reg = *(int *) &registers[REGISTER_BYTE (regno)]; SWAP_TARGET_AND_HOST (&reg, sizeof (REGISTER_TYPE));
SWAP_TARGET_AND_HOST (&reg, sizeof (int));
return reg; return reg;
} }
@ -315,24 +319,27 @@ read_register (regno)
#endif #endif
/* Store VALUE in the register number REGNO, regarded as an integer. */ /* Store VALUE in the register number REGNO, regarded as an integer. */
/* FIXME, this loses when REGISTER_VIRTUAL (REGNO) is true. Also,
shouldn't the val arg be a LONGEST or something? */
void void
write_register (regno, val) write_register (regno, val)
int regno, val; int regno, val;
{ {
REGISTER_TYPE reg;
/* On the sparc, writing %g0 is a no-op, so we don't even want to change /* On the sparc, writing %g0 is a no-op, so we don't even want to change
the registers array if something writes to this register. */ the registers array if something writes to this register. */
if (CANNOT_STORE_REGISTER (regno)) if (CANNOT_STORE_REGISTER (regno))
return; return;
SWAP_TARGET_AND_HOST (&val, sizeof (int)); reg = val;
SWAP_TARGET_AND_HOST (&reg, sizeof (REGISTER_TYPE));
target_prepare_to_store (); target_prepare_to_store ();
register_valid [regno] = 1; register_valid [regno] = 1;
/* FIXME, this loses when REGISTER_RAW_SIZE (regno) != sizeof (int) */ memcpy (&registers[REGISTER_BYTE (regno)], &reg, sizeof (REGISTER_TYPE));
/* FIXME, this depends on REGISTER_BYTE (regno) being aligned for host */
*(int *) &registers[REGISTER_BYTE (regno)] = val;
target_store_registers (regno); target_store_registers (regno);
} }
@ -347,7 +354,8 @@ supply_register (regno, val)
char *val; char *val;
{ {
register_valid[regno] = 1; register_valid[regno] = 1;
bcopy (val, &registers[REGISTER_BYTE (regno)], REGISTER_RAW_SIZE (regno)); (void) memcpy (&registers[REGISTER_BYTE (regno)], val,
REGISTER_RAW_SIZE (regno));
} }
/* Given a struct symbol for a variable, /* Given a struct symbol for a variable,
@ -376,14 +384,14 @@ read_var_value (var, frame)
switch (SYMBOL_CLASS (var)) switch (SYMBOL_CLASS (var))
{ {
case LOC_CONST: case LOC_CONST:
bcopy (&SYMBOL_VALUE (var), VALUE_CONTENTS_RAW (v), len); (void) memcpy (VALUE_CONTENTS_RAW (v), &SYMBOL_VALUE (var), len);
SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len); SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len);
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;
case LOC_LABEL: case LOC_LABEL:
addr = SYMBOL_VALUE_ADDRESS (var); addr = SYMBOL_VALUE_ADDRESS (var);
bcopy (&addr, VALUE_CONTENTS_RAW (v), len); (void) memcpy (VALUE_CONTENTS_RAW (v), &addr, len);
SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len); SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len);
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;
@ -392,7 +400,7 @@ read_var_value (var, frame)
{ {
char *bytes_addr; char *bytes_addr;
bytes_addr = SYMBOL_VALUE_BYTES (var); bytes_addr = SYMBOL_VALUE_BYTES (var);
bcopy (bytes_addr, VALUE_CONTENTS_RAW (v), len); (void) memcpy (VALUE_CONTENTS_RAW (v), bytes_addr, len);
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;
} }
@ -401,43 +409,59 @@ read_var_value (var, frame)
addr = SYMBOL_VALUE_ADDRESS (var); addr = SYMBOL_VALUE_ADDRESS (var);
break; break;
/* Nonzero if a struct which is located in a register or a LOC_ARG
really contains
the address of the struct, not the struct itself. GCC_P is nonzero
if the function was compiled with GCC. */
#if !defined (REG_STRUCT_HAS_ADDR)
#define REG_STRUCT_HAS_ADDR(gcc_p) 0
#endif
case LOC_ARG: case LOC_ARG:
fi = get_frame_info (frame); if (SYMBOL_BASEREG_VALID (var))
if (fi == NULL) {
return 0; addr = FRAME_GET_BASEREG_VALUE (frame, SYMBOL_BASEREG (var));
addr = FRAME_ARGS_ADDRESS (fi); }
if (!addr) { else
return 0; {
} fi = get_frame_info (frame);
if (fi == NULL)
return 0;
addr = FRAME_ARGS_ADDRESS (fi);
}
if (!addr)
{
return 0;
}
addr += SYMBOL_VALUE (var); addr += SYMBOL_VALUE (var);
break; break;
case LOC_REF_ARG: case LOC_REF_ARG:
fi = get_frame_info (frame); if (SYMBOL_BASEREG_VALID (var))
if (fi == NULL) {
return 0; addr = FRAME_GET_BASEREG_VALUE (frame, SYMBOL_BASEREG (var));
addr = FRAME_ARGS_ADDRESS (fi); }
if (!addr) { else
return 0; {
} fi = get_frame_info (frame);
if (fi == NULL)
return 0;
addr = FRAME_ARGS_ADDRESS (fi);
}
if (!addr)
{
return 0;
}
addr += SYMBOL_VALUE (var); addr += SYMBOL_VALUE (var);
read_memory (addr, &addr, sizeof (CORE_ADDR)); read_memory (addr, (char *) &addr, sizeof (CORE_ADDR));
break; break;
case LOC_LOCAL: case LOC_LOCAL:
case LOC_LOCAL_ARG: case LOC_LOCAL_ARG:
fi = get_frame_info (frame); if (SYMBOL_BASEREG_VALID (var))
if (fi == NULL) {
return 0; addr = FRAME_GET_BASEREG_VALUE (frame, SYMBOL_BASEREG (var));
addr = SYMBOL_VALUE (var) + FRAME_LOCALS_ADDRESS (fi); }
else
{
fi = get_frame_info (frame);
if (fi == NULL)
return 0;
addr = FRAME_LOCALS_ADDRESS (fi);
}
addr += SYMBOL_VALUE (var);
break; break;
case LOC_TYPEDEF: case LOC_TYPEDEF:
@ -459,8 +483,17 @@ read_var_value (var, frame)
v = value_from_register (type, SYMBOL_VALUE (var), frame); v = value_from_register (type, SYMBOL_VALUE (var), frame);
/* Nonzero if a struct which is located in a register or a LOC_ARG
really contains
the address of the struct, not the struct itself. GCC_P is nonzero
if the function was compiled with GCC. */
#if !defined (REG_STRUCT_HAS_ADDR)
#define REG_STRUCT_HAS_ADDR(gcc_p) 0
#endif
if (REG_STRUCT_HAS_ADDR (BLOCK_GCC_COMPILED (b)) if (REG_STRUCT_HAS_ADDR (BLOCK_GCC_COMPILED (b))
&& TYPE_CODE (type) == TYPE_CODE_STRUCT) && ( (TYPE_CODE (type) == TYPE_CODE_STRUCT)
|| (TYPE_CODE (type) == TYPE_CODE_UNION)))
addr = *(CORE_ADDR *)VALUE_CONTENTS (v); addr = *(CORE_ADDR *)VALUE_CONTENTS (v);
else else
return v; return v;
@ -575,7 +608,7 @@ value_from_register (type, regnum, frame)
endian machines. */ endian machines. */
/* Copy into the contents section of the value. */ /* Copy into the contents section of the value. */
bcopy (value_bytes, VALUE_CONTENTS_RAW (v), len); (void) memcpy (VALUE_CONTENTS_RAW (v), value_bytes, len);
return v; return v;
} }
@ -607,11 +640,11 @@ value_from_register (type, regnum, frame)
with raw type `extended' and virtual type `double'. with raw type `extended' and virtual type `double'.
Fetch it as a `double' and then convert to `float'. */ Fetch it as a `double' and then convert to `float'. */
v = allocate_value (REGISTER_VIRTUAL_TYPE (regnum)); v = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
bcopy (virtual_buffer, VALUE_CONTENTS_RAW (v), len); (void) memcpy (VALUE_CONTENTS_RAW (v), virtual_buffer, len);
v = value_cast (type, v); v = value_cast (type, v);
} }
else else
bcopy (virtual_buffer, VALUE_CONTENTS_RAW (v), len); (void) memcpy (VALUE_CONTENTS_RAW (v), virtual_buffer, len);
} }
else else
{ {
@ -625,8 +658,8 @@ value_from_register (type, regnum, frame)
} }
#endif #endif
bcopy (virtual_buffer + VALUE_OFFSET (v), (void) memcpy (VALUE_CONTENTS_RAW (v), virtual_buffer + VALUE_OFFSET (v),
VALUE_CONTENTS_RAW (v), len); len);
} }
return v; return v;
@ -657,18 +690,6 @@ locate_var_value (var, frame)
|| TYPE_CODE (type) == TYPE_CODE_FUNC) || TYPE_CODE (type) == TYPE_CODE_FUNC)
{ {
addr = VALUE_ADDRESS (lazy_value); addr = VALUE_ADDRESS (lazy_value);
/* C++: The "address" of a reference should yield the address
* of the object pointed to. So force an extra de-reference. */
if (TYPE_CODE (type) == TYPE_CODE_REF)
{
char *buf = alloca (TYPE_LENGTH (type));
read_memory (addr, buf, TYPE_LENGTH (type));
addr = unpack_pointer (type, buf);
type = TYPE_TARGET_TYPE (type);
}
return value_from_longest (lookup_pointer_type (type), (LONGEST) addr); return value_from_longest (lookup_pointer_type (type), (LONGEST) addr);
} }

View file

@ -104,6 +104,8 @@ int OP_J(), OP_SEG();
int OP_DIR(), OP_OFF(), OP_DSSI(), OP_ESDI(), OP_ONE(), OP_C(); int OP_DIR(), OP_OFF(), OP_DSSI(), OP_ESDI(), OP_ONE(), OP_C();
int OP_D(), OP_T(), OP_rm(); int OP_D(), OP_T(), OP_rm();
static void dofloat (), putop (), append_prefix (), set_op ();
static int get16 (), get32 ();
#define b_mode 1 #define b_mode 1
#define v_mode 2 #define v_mode 2
@ -845,6 +847,7 @@ struct dis386 grps[][8] = {
static int prefixes; static int prefixes;
static void
ckprefix () ckprefix ()
{ {
prefixes = 0; prefixes = 0;
@ -916,13 +919,14 @@ extern void fputs_filtered ();
* 100 bytes is certainly enough, unless symbol printing is added later * 100 bytes is certainly enough, unless symbol printing is added later
* The function returns the length of this instruction in bytes. * The function returns the length of this instruction in bytes.
*/ */
int
i386dis (pc, inbuf, stream) i386dis (pc, inbuf, stream)
int pc; int pc;
unsigned char *inbuf; unsigned char *inbuf;
FILE *stream; FILE *stream;
{ {
struct dis386 *dp; struct dis386 *dp;
char *p;
int i; int i;
int enter_instruction; int enter_instruction;
char *first, *second, *third; char *first, *second, *third;
@ -1297,7 +1301,7 @@ char *fgrps[][8] = {
}, },
}; };
static void
dofloat () dofloat ()
{ {
struct dis386 *dp; struct dis386 *dp;
@ -1335,20 +1339,27 @@ dofloat ()
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_ST (ignore) OP_ST (ignore)
int ignore;
{ {
oappend ("%st"); oappend ("%st");
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_STi (ignore) OP_STi (ignore)
int ignore;
{ {
sprintf (scratchbuf, "%%st(%d)", rm); sprintf (scratchbuf, "%%st(%d)", rm);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
/* capital letters in template are macros */ /* capital letters in template are macros */
static void
putop (template) putop (template)
char *template; char *template;
{ {
@ -1383,13 +1394,14 @@ putop (template)
static void static void
oappend (s) oappend (s)
char *s; char *s;
{ {
strcpy (obufp, s); strcpy (obufp, s);
obufp += strlen (s); obufp += strlen (s);
*obufp = 0; *obufp = 0;
} }
static void
append_prefix () append_prefix ()
{ {
if (prefixes & PREFIX_CS) if (prefixes & PREFIX_CS)
@ -1406,17 +1418,21 @@ append_prefix ()
oappend ("%gs:"); oappend ("%gs:");
} }
int
OP_indirE (bytemode) OP_indirE (bytemode)
int bytemode;
{ {
oappend ("*"); oappend ("*");
OP_E (bytemode); OP_E (bytemode);
return (0);
} }
int
OP_E (bytemode) OP_E (bytemode)
int bytemode;
{ {
int disp; int disp;
int havesib; int havesib;
int didoutput = 0;
int base; int base;
int index; int index;
int scale; int scale;
@ -1449,7 +1465,7 @@ OP_E (bytemode)
oappend ("<bad dis table>"); oappend ("<bad dis table>");
break; break;
} }
return; return (0);
} }
append_prefix (); append_prefix ();
@ -1525,9 +1541,12 @@ OP_E (bytemode)
} }
oappend (")"); oappend (")");
} }
return (0);
} }
int
OP_G (bytemode) OP_G (bytemode)
int bytemode;
{ {
switch (bytemode) switch (bytemode)
{ {
@ -1550,8 +1569,10 @@ OP_G (bytemode)
oappend ("<internal disassembler error>"); oappend ("<internal disassembler error>");
break; break;
} }
return (0);
} }
static int
get32 () get32 ()
{ {
int x = 0; int x = 0;
@ -1563,6 +1584,7 @@ get32 ()
return (x); return (x);
} }
static int
get16 () get16 ()
{ {
int x = 0; int x = 0;
@ -1572,14 +1594,17 @@ get16 ()
return (x); return (x);
} }
static void
set_op (op) set_op (op)
int op; int op;
{ {
op_index[op_ad] = op_ad; op_index[op_ad] = op_ad;
op_address[op_ad] = op; op_address[op_ad] = op;
} }
int
OP_REG (code) OP_REG (code)
int code;
{ {
char *s; char *s;
@ -1610,9 +1635,12 @@ OP_REG (code)
break; break;
} }
oappend (s); oappend (s);
return (0);
} }
int
OP_I (bytemode) OP_I (bytemode)
int bytemode;
{ {
int op; int op;
@ -1632,13 +1660,16 @@ OP_I (bytemode)
break; break;
default: default:
oappend ("<internal disassembler error>"); oappend ("<internal disassembler error>");
return; return (0);
} }
sprintf (scratchbuf, "$0x%x", op); sprintf (scratchbuf, "$0x%x", op);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
int
OP_sI (bytemode) OP_sI (bytemode)
int bytemode;
{ {
int op; int op;
@ -1658,13 +1689,16 @@ OP_sI (bytemode)
break; break;
default: default:
oappend ("<internal disassembler error>"); oappend ("<internal disassembler error>");
return; return (0);
} }
sprintf (scratchbuf, "$0x%x", op); sprintf (scratchbuf, "$0x%x", op);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
int
OP_J (bytemode) OP_J (bytemode)
int bytemode;
{ {
int disp; int disp;
int mask = -1; int mask = -1;
@ -1688,25 +1722,31 @@ OP_J (bytemode)
break; break;
default: default:
oappend ("<internal disassembler error>"); oappend ("<internal disassembler error>");
return; return (0);
} }
disp = (start_pc + codep - start_codep + disp) & mask; disp = (start_pc + codep - start_codep + disp) & mask;
set_op (disp); set_op (disp);
sprintf (scratchbuf, "0x%x", disp); sprintf (scratchbuf, "0x%x", disp);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_SEG (dummy) OP_SEG (dummy)
int dummy;
{ {
static char *sreg[] = { static char *sreg[] = {
"%es","%cs","%ss","%ds","%fs","%gs","%?","%?", "%es","%cs","%ss","%ds","%fs","%gs","%?","%?",
}; };
oappend (sreg[reg]); oappend (sreg[reg]);
return (0);
} }
int
OP_DIR (size) OP_DIR (size)
int size;
{ {
int seg, offset; int seg, offset;
@ -1741,10 +1781,13 @@ OP_DIR (size)
oappend ("<internal disassembler error>"); oappend ("<internal disassembler error>");
break; break;
} }
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_OFF (bytemode) OP_OFF (bytemode)
int bytemode;
{ {
int off; int off;
@ -1755,55 +1798,76 @@ OP_OFF (bytemode)
sprintf (scratchbuf, "0x%x", off); sprintf (scratchbuf, "0x%x", off);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_ESDI (dummy) OP_ESDI (dummy)
int dummy;
{ {
oappend ("%es:("); oappend ("%es:(");
oappend (aflag ? "%edi" : "%di"); oappend (aflag ? "%edi" : "%di");
oappend (")"); oappend (")");
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_DSSI (dummy) OP_DSSI (dummy)
int dummy;
{ {
oappend ("%ds:("); oappend ("%ds:(");
oappend (aflag ? "%esi" : "%si"); oappend (aflag ? "%esi" : "%si");
oappend (")"); oappend (")");
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_ONE (dummy) OP_ONE (dummy)
int dummy;
{ {
oappend ("1"); oappend ("1");
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_C (dummy) OP_C (dummy)
int dummy;
{ {
codep++; /* skip mod/rm */ codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%cr%d", reg); sprintf (scratchbuf, "%%cr%d", reg);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_D (dummy) OP_D (dummy)
int dummy;
{ {
codep++; /* skip mod/rm */ codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%db%d", reg); sprintf (scratchbuf, "%%db%d", reg);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
/* ARGSUSED */ /* ARGSUSED */
int
OP_T (dummy) OP_T (dummy)
int dummy;
{ {
codep++; /* skip mod/rm */ codep++; /* skip mod/rm */
sprintf (scratchbuf, "%%tr%d", reg); sprintf (scratchbuf, "%%tr%d", reg);
oappend (scratchbuf); oappend (scratchbuf);
return (0);
} }
int
OP_rm (bytemode) OP_rm (bytemode)
int bytemode;
{ {
switch (bytemode) switch (bytemode)
{ {
@ -1814,9 +1878,12 @@ OP_rm (bytemode)
oappend (names16[rm]); oappend (names16[rm]);
break; break;
} }
return (0);
} }
#define MAXLEN 20 #define MAXLEN 20
int
print_insn (memaddr, stream) print_insn (memaddr, stream)
CORE_ADDR memaddr; CORE_ADDR memaddr;
FILE *stream; FILE *stream;

View file

@ -21,6 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "frame.h" #include "frame.h"
#include "inferior.h" #include "inferior.h"
#include "gdbcore.h" #include "gdbcore.h"
#include "target.h"
#ifdef USE_PROC_FS /* Target dependent support for /proc */ #ifdef USE_PROC_FS /* Target dependent support for /proc */
#include <sys/procfs.h> #include <sys/procfs.h>
@ -203,9 +204,9 @@ i386_get_frame_setup (pc)
static unsigned char proto2[4] = { 0x87,0x44,0x24,0x00 }; static unsigned char proto2[4] = { 0x87,0x44,0x24,0x00 };
pos = codestream_tell (); pos = codestream_tell ();
codestream_read (buf, 4); codestream_read (buf, 4);
if (bcmp (buf, proto1, 3) == 0) if (memcmp (buf, proto1, 3) == 0)
pos += 3; pos += 3;
else if (bcmp (buf, proto2, 4) == 0) else if (memcmp (buf, proto2, 4) == 0)
pos += 4; pos += 4;
codestream_seek (pos); codestream_seek (pos);
@ -388,13 +389,12 @@ i386_frame_find_saved_regs (fip, fsrp)
struct frame_saved_regs *fsrp; struct frame_saved_regs *fsrp;
{ {
long locals; long locals;
unsigned char *p;
unsigned char op; unsigned char op;
CORE_ADDR dummy_bottom; CORE_ADDR dummy_bottom;
CORE_ADDR adr; CORE_ADDR adr;
int i; int i;
bzero (fsrp, sizeof *fsrp); (void) memset (fsrp, 0, sizeof *fsrp);
/* if frame is the end of a dummy, compute where the /* if frame is the end of a dummy, compute where the
* beginning would be * beginning would be
@ -644,3 +644,37 @@ fill_fpregset (fpregsetp, regno)
#endif /* defined (FP0_REGNUM) */ #endif /* defined (FP0_REGNUM) */
#endif /* USE_PROC_FS */ #endif /* USE_PROC_FS */
#ifdef GET_LONGJMP_TARGET
/* Figure out where the longjmp will land. Slurp the args out of the stack.
We expect the first arg to be a pointer to the jmp_buf structure from which
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
This routine returns true on success. */
int
get_longjmp_target(pc)
CORE_ADDR *pc;
{
CORE_ADDR sp, jb_addr;
sp = read_register(SP_REGNUM);
if (target_read_memory(sp + SP_ARG0, /* Offset of first arg on stack */
(char *) &jb_addr,
sizeof(CORE_ADDR)))
return 0;
SWAP_TARGET_AND_HOST(&jb_addr, sizeof(CORE_ADDR));
if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, (char *) pc,
sizeof(CORE_ADDR)))
return 0;
SWAP_TARGET_AND_HOST(pc, sizeof(CORE_ADDR));
return 1;
}
#endif /* GET_LONGJMP_TARGET */

View file

@ -77,7 +77,7 @@ double_to_ieee_extended (ext_format, from, to)
unsigned long mant0, mant1, exponent; unsigned long mant0, mant1, exponent;
unsigned char tobytes[8]; unsigned char tobytes[8];
bzero (to, TOTALSIZE); (void) memset (to, 0, TOTALSIZE);
if (dfrom == 0) if (dfrom == 0)
return; /* Result is zero */ return; /* Result is zero */
if (dfrom != dfrom) { if (dfrom != dfrom) {

View file

@ -528,7 +528,7 @@ The expression which contained the function call has been discarded.");
/* On return, the stack dummy has been popped already. */ /* On return, the stack dummy has been popped already. */
bcopy (stop_registers, buffer, sizeof stop_registers); (void) memcpy (buffer, stop_registers, sizeof stop_registers);
} }
/* Proceed until we reach a different source line with pc greater than /* Proceed until we reach a different source line with pc greater than

View file

@ -395,7 +395,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
/* Copy data to be written over corresponding part of buffer */ /* Copy data to be written over corresponding part of buffer */
bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); (void) memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr,
len);
/* Write the entire buffer. */ /* Write the entire buffer. */
@ -430,7 +431,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
} }
/* Copy appropriate bytes out of the buffer. */ /* Copy appropriate bytes out of the buffer. */
bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); (void) memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)),
len);
} }
return len; return len;
} }

View file

@ -1800,7 +1800,7 @@ save_inferior_status (inf_status, restore_stack_info)
inf_status->restore_stack_info = restore_stack_info; inf_status->restore_stack_info = restore_stack_info;
inf_status->proceed_to_finish = proceed_to_finish; inf_status->proceed_to_finish = proceed_to_finish;
bcopy (stop_registers, inf_status->stop_registers, REGISTER_BYTES); (void) memcpy (inf_status->stop_registers, stop_registers, REGISTER_BYTES);
record_selected_frame (&(inf_status->selected_frame_address), record_selected_frame (&(inf_status->selected_frame_address),
&(inf_status->selected_level)); &(inf_status->selected_level));
@ -1834,7 +1834,7 @@ restore_inferior_status (inf_status)
breakpoint_proceeded = inf_status->breakpoint_proceeded; breakpoint_proceeded = inf_status->breakpoint_proceeded;
proceed_to_finish = inf_status->proceed_to_finish; proceed_to_finish = inf_status->proceed_to_finish;
bcopy (inf_status->stop_registers, stop_registers, REGISTER_BYTES); (void) memcpy (stop_registers, inf_status->stop_registers, REGISTER_BYTES);
/* The inferior can be gone if the user types "print exit(0)" /* The inferior can be gone if the user types "print exit(0)"
(and perhaps other times). */ (and perhaps other times). */

View file

@ -625,8 +625,9 @@ character_type (type)
return (TYPE_CODE(type) == TYPE_CODE_INT) && return (TYPE_CODE(type) == TYPE_CODE_INT) &&
TYPE_LENGTH(type) == sizeof(char) TYPE_LENGTH(type) == sizeof(char)
? 1 : 0; ? 1 : 0;
default:
return (0);
} }
return (0);
} }
/* Returns non-zero if the value is a boolean type */ /* Returns non-zero if the value is a boolean type */
@ -642,8 +643,9 @@ boolean_type (type)
case language_c: case language_c:
case language_cplus: case language_cplus:
return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1; return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1;
default:
return (0);
} }
return (0);
} }
/* Returns non-zero if the value is a floating-point type */ /* Returns non-zero if the value is a floating-point type */
@ -679,8 +681,9 @@ structured_type(type)
return (TYPE_CODE(type) == TYPE_CODE_STRUCT) || return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
(TYPE_CODE(type) == TYPE_CODE_SET) || (TYPE_CODE(type) == TYPE_CODE_SET) ||
(TYPE_CODE(type) == TYPE_CODE_ARRAY); (TYPE_CODE(type) == TYPE_CODE_ARRAY);
default:
return (0);
} }
return (0);
} }
/* This page contains functions that return info about /* This page contains functions that return info about

View file

@ -987,7 +987,7 @@ yylex ()
{ {
char *err_copy = (char *) alloca (p - tokstart + 1); char *err_copy = (char *) alloca (p - tokstart + 1);
bcopy (tokstart, err_copy, p - tokstart); (void) memcpy (err_copy, tokstart, p - tokstart);
err_copy[p - tokstart] = 0; err_copy[p - tokstart] = 0;
error ("Invalid number \"%s\".", err_copy); error ("Invalid number \"%s\".", err_copy);
} }

View file

@ -1,5 +1,6 @@
/* Top level `main' program for GDB, the GNU debugger. /* Top level `main' program for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992
Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -19,6 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h" #include "defs.h"
#include "gdbcmd.h" #include "gdbcmd.h"
#include "call-cmds.h"
#include "symtab.h" #include "symtab.h"
#include "inferior.h" #include "inferior.h"
#include "signals.h" #include "signals.h"
@ -648,7 +650,8 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
} }
error_pre_print = "\n\n"; error_pre_print = "\n\n";
warning_pre_print = "\n\nwarning: "; /* We may get more than one warning, don't double space all of them... */
warning_pre_print = "\nwarning: ";
/* Now perform all the actions indicated by the arguments. */ /* Now perform all the actions indicated by the arguments. */
if (cdarg != NULL) if (cdarg != NULL)
@ -664,7 +667,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
for (i = 0; i < ndir; i++) for (i = 0; i < ndir; i++)
if (!setjmp (to_top_level)) if (!setjmp (to_top_level))
directory_command (dirarg[i], 0); directory_command (dirarg[i], 0);
free (dirarg); free ((PTR)dirarg);
do_cleanups (ALL_CLEANUPS); do_cleanups (ALL_CLEANUPS);
if (execarg != NULL if (execarg != NULL
@ -772,9 +775,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
the same file (it should exist, also). */ the same file (it should exist, also). */
if (!homedir if (!homedir
|| bcmp ((char *) &homebuf, || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
(char *) &cwdbuf,
sizeof (struct stat)))
if (!inhibit_gdbinit && access (gdbinit, R_OK) == 0) if (!inhibit_gdbinit && access (gdbinit, R_OK) == 0)
if (!setjmp (to_top_level)) if (!setjmp (to_top_level))
source_command (gdbinit, 0); source_command (gdbinit, 0);
@ -790,7 +791,7 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
source_command (cmdarg[i], !batch); source_command (cmdarg[i], !batch);
do_cleanups (ALL_CLEANUPS); do_cleanups (ALL_CLEANUPS);
} }
free (cmdarg); free ((PTR)cmdarg);
/* Read in the old history after all the command files have been read. */ /* Read in the old history after all the command files have been read. */
initialize_history(); initialize_history();
@ -1020,6 +1021,11 @@ static char *history_filename;
/* Variables which are necessary for fancy command line editing. */ /* Variables which are necessary for fancy command line editing. */
char *gdb_completer_word_break_characters = char *gdb_completer_word_break_characters =
" \t\n!@#$%^&*()-+=|~`}{[]\"';:?/>.<,"; " \t\n!@#$%^&*()-+=|~`}{[]\"';:?/>.<,";
/* Characters that can be used to quote completion strings. Note that we
can't include '"' because the gdb C parser treats such quoted sequences
as strings. */
char *gdb_completer_quote_characters =
"'";
/* Functions that are used as part of the fancy command line editing. */ /* Functions that are used as part of the fancy command line editing. */
@ -1033,39 +1039,52 @@ noop_completer (text)
return NULL; return NULL;
} }
/* Generate symbol names one by one for the completer. If STATE is /* Generate symbol names one by one for the completer. Each time we are
zero, then we need to initialize, otherwise the initialization has called return another potential completion to the caller.
already taken place. TEXT is what we expect the symbol to start
with. RL_LINE_BUFFER is available to be looked at; it contains the
entire text of the line. RL_POINT is the offset in that line of
the cursor. You should pretend that the line ends at RL_POINT.
The result is NULL if there are no more completions, else a char
string which is a possible completion. */
TEXT is what we expect the symbol to start with.
MATCHES is the number of matches that have currently been collected from
calling this completion function. When zero, then we need to initialize,
otherwise the initialization has already taken place and we can just
return the next potential completion string.
Returns NULL if there are no more completions, else a pointer to a string
which is a possible completion.
RL_LINE_BUFFER is available to be looked at; it contains the entire text
of the line. RL_POINT is the offset in that line of the cursor. You
should pretend that the line ends at RL_POINT. */
static char * static char *
symbol_completion_function (text, state) symbol_completion_function (text, matches)
char *text; char *text;
int state; int matches;
{ {
static char **list = (char **)NULL; static char **list = (char **)NULL; /* Cache of completions */
static int index; static int index; /* Next cached completion */
char *output; char *output = NULL;
extern char *rl_line_buffer;
extern int rl_point;
char *tmp_command, *p; char *tmp_command, *p;
struct cmd_list_element *c, *result_list; struct cmd_list_element *c, *result_list;
extern char *rl_line_buffer;
extern int rl_point;
if (!state) if (matches == 0)
{ {
/* Free the storage used by LIST, but not by the strings inside. This is /* The caller is beginning to accumulate a new set of completions, so
because rl_complete_internal () frees the strings. */ we need to find all of them now, and cache them for returning one at
a time on future calls. */
if (list) if (list)
free (list); {
/* Free the storage used by LIST, but not by the strings inside.
This is because rl_complete_internal () frees the strings. */
free ((PTR)list);
}
list = 0; list = 0;
index = 0; index = 0;
/* Decide whether to complete on a list of gdb commands or on /* Decide whether to complete on a list of gdb commands or on symbols. */
symbols. */
tmp_command = (char *) alloca (rl_point + 1); tmp_command = (char *) alloca (rl_point + 1);
p = tmp_command; p = tmp_command;
@ -1074,21 +1093,27 @@ symbol_completion_function (text, state)
if (rl_point == 0) if (rl_point == 0)
{ {
/* An empty line we want to consider ambiguous; that is, /* An empty line we want to consider ambiguous; that is, it
it could be any command. */ could be any command. */
c = (struct cmd_list_element *) -1; c = (struct cmd_list_element *) -1;
result_list = 0; result_list = 0;
} }
else else
c = lookup_cmd_1 (&p, cmdlist, &result_list, 1); {
c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
}
/* Move p up to the next interesting thing. */ /* Move p up to the next interesting thing. */
while (*p == ' ' || *p == '\t') while (*p == ' ' || *p == '\t')
p++; {
p++;
}
if (!c) if (!c)
/* He's typed something unrecognizable. Sigh. */ {
list = (char **) 0; /* He's typed something unrecognizable. Sigh. */
list = NULL;
}
else if (c == (struct cmd_list_element *) -1) else if (c == (struct cmd_list_element *) -1)
{ {
/* If we didn't recognize everything up to the thing that /* If we didn't recognize everything up to the thing that
@ -1096,25 +1121,34 @@ symbol_completion_function (text, state)
yet, we are in trouble. Part of the trouble might be yet, we are in trouble. Part of the trouble might be
that the list of delimiters used by readline includes that the list of delimiters used by readline includes
'-', which we use in commands. Check for this. */ '-', which we use in commands. Check for this. */
if (p + strlen(text) != tmp_command + rl_point) {
if (tmp_command[rl_point - strlen(text) - 1] == '-') if (p + strlen(text) != tmp_command + rl_point)
text = p; {
else { if (tmp_command[rl_point - strlen(text) - 1] == '-')
/* This really should not produce an error. Better would {
be to pretend to hit RETURN here; this would produce a text = p;
response like "Ambiguous command: foo, foobar, etc", }
and leave the line available for re-entry with ^P. Instead, else
this error blows away the user's typed input without {
any way to get it back. */ /* This really should not produce an error. Better would
error (" Unrecognized command."); be to pretend to hit RETURN here; this would produce a
response like "Ambiguous command: foo, foobar, etc",
and leave the line available for re-entry with ^P.
Instead, this error blows away the user's typed input
without any way to get it back. */
error (" Unrecognized command.");
}
} }
}
/* He's typed something ambiguous. This is easier. */ /* He's typed something ambiguous. This is easier. */
if (result_list) if (result_list)
list = complete_on_cmdlist (*result_list->prefixlist, text); {
list = complete_on_cmdlist (*result_list->prefixlist, text);
}
else else
list = complete_on_cmdlist (cmdlist, text); {
list = complete_on_cmdlist (cmdlist, text);
}
} }
else else
{ {
@ -1128,48 +1162,91 @@ symbol_completion_function (text, state)
command. */ command. */
if (!*p && *text) if (!*p && *text)
/* Always (might be longer versions of thie command). */ {
list = complete_on_cmdlist (result_list, text); /* Always (might be longer versions of thie command). */
list = complete_on_cmdlist (result_list, text);
}
else if (!*p && !*text) else if (!*p && !*text)
{ {
if (c->prefixlist) if (c->prefixlist)
list = complete_on_cmdlist (*c->prefixlist, ""); {
list = complete_on_cmdlist (*c->prefixlist, "");
}
else else
list = (*c->completer) (""); {
list = (*c->completer) ("");
}
} }
else else
{ {
if (c->prefixlist && !c->allow_unknown) if (c->prefixlist && !c->allow_unknown)
{ {
#if 0 /* Something like "info adsfkdj". But error() is not the
/* Something like "info adsfkdj". But error() is not proper response; just return no completions instead. */
the proper response; just return no completions
instead. */
*p = '\0';
error ("\"%s\" command requires a subcommand.",
tmp_command);
#else
list = NULL; list = NULL;
#endif
} }
else else
list = (*c->completer) (text); {
list = (*c->completer) (text);
}
} }
} }
} }
/* If the debugged program wasn't compiled with symbols, or if we're /* If we found a list of potential completions during initialization then
clearly completing on a command and no command matches, return dole them out one at a time. The vector of completions is NULL
NULL. */ terminated, so after returning the last one, return NULL (and continue
if (!list) to do so) each time we are called after that, until a new list is
return ((char *)NULL); available. */
output = list[index]; if (list)
if (output) {
index++; output = list[index];
if (output)
{
index++;
}
}
return (output); return (output);
} }
/* Skip over a possibly quoted word (as defined by the quote characters
and word break characters the completer uses). Returns pointer to the
location after the "word". */
char *
skip_quoted (str)
char *str;
{
char quote_char = '\0';
char *scan;
for (scan = str; *scan != '\0'; scan++)
{
if (quote_char != '\0')
{
/* Ignore everything until the matching close quote char */
if (*scan == quote_char)
{
/* Found matching close quote. */
scan++;
break;
}
}
else if (strchr (gdb_completer_quote_characters, *scan))
{
/* Found start of a quoted string. */
quote_char = *scan;
}
else if (strchr (gdb_completer_word_break_characters, *scan))
{
break;
}
}
return (scan);
}
#ifdef STOP_SIGNAL #ifdef STOP_SIGNAL
static void static void
@ -1492,7 +1569,7 @@ free_command_lines (lptr)
{ {
next = l->next; next = l->next;
free (l->line); free (l->line);
free (l); free ((PTR)l);
l = next; l = next;
} }
} }
@ -1601,6 +1678,14 @@ validate_comname (comname)
} }
} }
/* This is just a placeholder in the command data structures. */
static void
user_defined_command (ignore, from_tty)
char *ignore;
int from_tty;
{
}
static void static void
define_command (comname, from_tty) define_command (comname, from_tty)
char *comname; char *comname;
@ -1646,7 +1731,7 @@ End with a line saying just \"end\".\n", comname);
if (c && c->class == class_user) if (c && c->class == class_user)
free_command_lines (&c->user_commands); free_command_lines (&c->user_commands);
newc = add_cmd (comname, class_user, not_just_help_class_command, newc = add_cmd (comname, class_user, user_defined_command,
(c && c->class == class_user) (c && c->class == class_user)
? c->doc : savestring ("User-defined.", 13), &cmdlist); ? c->doc : savestring ("User-defined.", 13), &cmdlist);
newc->user_commands = cmds; newc->user_commands = cmds;
@ -2151,6 +2236,7 @@ initialize_main ()
/* Setup important stuff for command line editing. */ /* Setup important stuff for command line editing. */
rl_completion_entry_function = (int (*)()) symbol_completion_function; rl_completion_entry_function = (int (*)()) symbol_completion_function;
rl_completer_word_break_characters = gdb_completer_word_break_characters; rl_completer_word_break_characters = gdb_completer_word_break_characters;
rl_completer_quote_characters = gdb_completer_quote_characters;
rl_readline_name = "gdb"; rl_readline_name = "gdb";
/* Define the classes of commands. /* Define the classes of commands.

View file

@ -71,6 +71,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "coff/mips.h" /* COFF-like aspects of ecoff files */ #include "coff/mips.h" /* COFF-like aspects of ecoff files */
#include "coff/ecoff-ext.h" /* External forms of ecoff sym structures */ #include "coff/ecoff-ext.h" /* External forms of ecoff sym structures */
#include "libbfd.h" /* FIXME Secret internal BFD stuff (bfd_read) */
#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */ #include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
#include "aout/aout64.h" #include "aout/aout64.h"
#include "aout/stab_gnu.h" /* STABS information */ #include "aout/stab_gnu.h" /* STABS information */
@ -340,8 +341,6 @@ mipscoff_symfile_read (objfile, addr, mainline)
CORE_ADDR addr; CORE_ADDR addr;
int mainline; int mainline;
{ {
bfd *abfd = objfile -> obfd;
init_minimal_symbol_collection (); init_minimal_symbol_collection ();
make_cleanup (discard_minimal_symbols, 0); make_cleanup (discard_minimal_symbols, 0);
@ -385,10 +384,10 @@ static PTR
xzalloc(size) xzalloc(size)
unsigned int size; unsigned int size;
{ {
PTR p = xmalloc(size); PTR p = xmalloc (size);
memset(p, 0, size); (void) memset (p, 0, size);
return p; return p;
} }
/* Exported procedure: Builds a symtab from the PST partial one. /* Exported procedure: Builds a symtab from the PST partial one.
@ -524,6 +523,7 @@ fixup_symtab (hdr, data, f_ptr, abfd)
/* This function depends on the external and internal forms /* This function depends on the external and internal forms
of the MIPS symbol table taking identical space. Check this of the MIPS symbol table taking identical space. Check this
assumption at compile-time. */ assumption at compile-time. */
#if 0 /* FIXME: Unused */
static check_hdr1[1 + sizeof (struct hdr_ext) - sizeof (HDRR)] = {0}; static check_hdr1[1 + sizeof (struct hdr_ext) - sizeof (HDRR)] = {0};
static check_hdr2[1 + sizeof (HDRR) - sizeof (struct hdr_ext)] = {0}; static check_hdr2[1 + sizeof (HDRR) - sizeof (struct hdr_ext)] = {0};
static check_fdr1[1 + sizeof (struct fdr_ext) - sizeof (FDR)] = {0}; static check_fdr1[1 + sizeof (struct fdr_ext) - sizeof (FDR)] = {0};
@ -536,6 +536,7 @@ fixup_symtab (hdr, data, f_ptr, abfd)
static check_ext2[1 + sizeof (EXTR) - sizeof (struct ext_ext)] = {0}; static check_ext2[1 + sizeof (EXTR) - sizeof (struct ext_ext)] = {0};
static check_rfd1[1 + sizeof (struct rfd_ext) - sizeof (RFDT)] = {0}; static check_rfd1[1 + sizeof (struct rfd_ext) - sizeof (RFDT)] = {0};
static check_rfd2[1 + sizeof (RFDT) - sizeof (struct rfd_ext)] = {0}; static check_rfd2[1 + sizeof (RFDT) - sizeof (struct rfd_ext)] = {0};
#endif
/* Swap in the header record. */ /* Swap in the header record. */
ecoff_swap_hdr_in (abfd, hdr, hdr); ecoff_swap_hdr_in (abfd, hdr, hdr);
@ -845,6 +846,8 @@ add_pending(fh, sh, t)
/* Throw away undef entries when done with file index F_IDX */ /* Throw away undef entries when done with file index F_IDX */
/* FIXME -- storage leak. This is never called!!! --gnu */ /* FIXME -- storage leak. This is never called!!! --gnu */
#if 0
static void static void
free_pending(f_idx) free_pending(f_idx)
int f_idx; int f_idx;
@ -858,6 +861,8 @@ free_pending(f_idx)
pending_list[f_idx] = 0; pending_list[f_idx] = 0;
} }
#endif
static char * static char *
prepend_tag_kind(tag_name, type_code) prepend_tag_kind(tag_name, type_code)
char *tag_name; char *tag_name;
@ -1630,7 +1635,6 @@ parse_procedure (pr, bound, have_stabs)
SYMR *sh = (SYMR*)pr->isym; SYMR *sh = (SYMR*)pr->isym;
struct block *b; struct block *b;
struct mips_extra_func_info *e; struct mips_extra_func_info *e;
char name[100];
char *sh_name; char *sh_name;
/* Static procedure at address pr->adr. Sigh. */ /* Static procedure at address pr->adr. Sigh. */
@ -2347,7 +2351,6 @@ psymtab_to_symtab_1(pst, filename)
* This symbol table contains stabs-in-ecoff entries. * This symbol table contains stabs-in-ecoff entries.
*/ */
SYMR *sh;
PDR *pr; PDR *pr;
/* Parse local symbols first */ /* Parse local symbols first */

View file

@ -248,7 +248,6 @@ void
free_objfile (objfile) free_objfile (objfile)
struct objfile *objfile; struct objfile *objfile;
{ {
struct objfile *ofp;
int mmfd; int mmfd;
/* First do any symbol file specific actions required when we are /* First do any symbol file specific actions required when we are

View file

@ -219,7 +219,7 @@ write_exp_string (str)
xrealloc ((char *) expout, (sizeof (struct expression) xrealloc ((char *) expout, (sizeof (struct expression)
+ (expout_size * sizeof (union exp_element)))); + (expout_size * sizeof (union exp_element))));
} }
bcopy (str.ptr, (char *) &expout->elts[expout_ptr - lenelt], len); (void) memcpy ((char *) &expout->elts[expout_ptr - lenelt], str.ptr, len);
((char *) &expout->elts[expout_ptr - lenelt])[len] = 0; ((char *) &expout->elts[expout_ptr - lenelt])[len] = 0;
write_exp_elt_longcst ((LONGEST) len); write_exp_elt_longcst ((LONGEST) len);
} }
@ -231,7 +231,7 @@ char *
copy_name (token) copy_name (token)
struct stoken token; struct stoken token;
{ {
bcopy (token.ptr, namecopy, token.length); (void) memcpy (namecopy, token.ptr, token.length);
namecopy[token.length] = 0; namecopy[token.length] = 0;
return namecopy; return namecopy;
} }
@ -251,7 +251,7 @@ prefixify_expression (expr)
temp = (struct expression *) alloca (len); temp = (struct expression *) alloca (len);
/* Copy the original expression into temp. */ /* Copy the original expression into temp. */
bcopy (expr, temp, len); (void) memcpy (temp, expr, len);
prefixify_subexp (temp, expr, inpos, outpos); prefixify_subexp (temp, expr, inpos, outpos);
} }
@ -481,8 +481,8 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
/* Copy the final operator itself, from the end of the input /* Copy the final operator itself, from the end of the input
to the beginning of the output. */ to the beginning of the output. */
inend -= oplen; inend -= oplen;
bcopy (&inexpr->elts[inend], &outexpr->elts[outbeg], (void) memcpy (&outexpr->elts[outbeg], &inexpr->elts[inend],
oplen * sizeof (union exp_element)); oplen * sizeof (union exp_element));
outbeg += oplen; outbeg += oplen;
/* Find the lengths of the arg subexpressions. */ /* Find the lengths of the arg subexpressions. */

View file

@ -40,9 +40,11 @@ regardless of whether or not the actual target has floating point hardware.
#include <sys/procfs.h> #include <sys/procfs.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "inferior.h" #include "inferior.h"
#include "target.h" #include "target.h"
#include "command.h"
#define MAX_SYSCALLS 256 /* Maximum number of syscalls for table */ #define MAX_SYSCALLS 256 /* Maximum number of syscalls for table */
@ -626,8 +628,6 @@ NOTES
static void static void
init_syscall_table () init_syscall_table ()
{ {
int syscallnum;
#if defined (SYS_exit) #if defined (SYS_exit)
syscall_table[SYS_exit] = "exit"; syscall_table[SYS_exit] = "exit";
#endif #endif
@ -1466,7 +1466,6 @@ proc_iterate_over_mappings (func)
int funcstat = 0; int funcstat = 0;
struct prmap *prmaps; struct prmap *prmaps;
struct prmap *prmap; struct prmap *prmap;
CORE_ADDR baseaddr = 0;
if (pi.valid && (ioctl (pi.fd, PIOCNMAP, &nmap) == 0)) if (pi.valid && (ioctl (pi.fd, PIOCNMAP, &nmap) == 0))
{ {
@ -2766,7 +2765,6 @@ info_proc (args, from_tty)
struct procinfo pii; struct procinfo pii;
struct procinfo *pip; struct procinfo *pip;
struct cleanup *old_chain; struct cleanup *old_chain;
char *nexttok;
char **argv; char **argv;
int argsize; int argsize;
int summary = 1; int summary = 1;

View file

@ -100,7 +100,7 @@ putenv( entry )
if ( new_environ == (char **) NULL ) if ( new_environ == (char **) NULL )
return( -1 ); return( -1 );
bcopy( (char *) environ, (char *) new_environ, size*PSIZE ); (void) memcpy ((char *) new_environ, (char *) environ, size*PSIZE );
new_environ[size] = entry; new_environ[size] = entry;
new_environ[size+1] = NULL; new_environ[size+1] = NULL;

View file

@ -122,6 +122,7 @@ static int obscure_syntax = 0;
int int
re_set_syntax (syntax) re_set_syntax (syntax)
int syntax;
{ {
int ret; int ret;
@ -706,7 +707,7 @@ re_compile_fastmap (bufp)
register char *fastmap = bufp->fastmap; register char *fastmap = bufp->fastmap;
register unsigned char *p = pattern; register unsigned char *p = pattern;
register unsigned char *pend = pattern + size; register unsigned char *pend = pattern + size;
register int j, k; register int j;
unsigned char *translate = (unsigned char *) bufp->translate; unsigned char *translate = (unsigned char *) bufp->translate;
unsigned char *stackb[NFAILURES]; unsigned char *stackb[NFAILURES];

View file

@ -94,12 +94,16 @@ struct so_list {
struct objfile *objfile; /* objfile for loaded lib */ struct objfile *objfile; /* objfile for loaded lib */
struct section_table *sections; struct section_table *sections;
struct section_table *sections_end; struct section_table *sections_end;
struct section_table *textsection;
}; };
static struct so_list *so_list_head; /* List of known shared objects */ static struct so_list *so_list_head; /* List of known shared objects */
static CORE_ADDR debug_base; /* Base of dynamic linker structures */ static CORE_ADDR debug_base; /* Base of dynamic linker structures */
static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */ static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
extern int
fdmatch PARAMS ((int, int)); /* In libiberty */
/* Local function prototypes */ /* Local function prototypes */
static void static void
@ -115,7 +119,7 @@ static int
disable_break PARAMS ((void)); disable_break PARAMS ((void));
static void static void
info_sharedlibrary_command PARAMS ((void)); info_sharedlibrary_command PARAMS ((char *, int));
static int static int
symbol_add_stub PARAMS ((char *)); symbol_add_stub PARAMS ((char *));
@ -223,6 +227,10 @@ solib_map_sections (so)
p -> addr += (CORE_ADDR) LM_ADDR (so); p -> addr += (CORE_ADDR) LM_ADDR (so);
p -> endaddr += (CORE_ADDR) LM_ADDR (so); p -> endaddr += (CORE_ADDR) LM_ADDR (so);
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend); so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
if (strcmp (p -> sec_ptr -> name, ".text") == 0)
{
so -> textsection = p;
}
} }
} }
@ -664,7 +672,8 @@ symbol_add_stub (arg)
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */ register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
so -> objfile = symbol_file_add (so -> so_name, so -> from_tty, so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
(unsigned int) LM_ADDR (so), 0, 0, 0); (unsigned int) so -> textsection -> addr,
0, 0, 0);
return (1); return (1);
} }
@ -765,8 +774,9 @@ solib_add (arg_string, from_tty, target)
if (so -> so_name[0]) if (so -> so_name[0])
{ {
count = so -> sections_end - so -> sections; count = so -> sections_end - so -> sections;
bcopy (so -> sections, (char *)(target -> to_sections + old), (void) memcpy ((char *) (target -> to_sections + old),
(sizeof (struct section_table)) * count); so -> sections,
(sizeof (struct section_table)) * count);
old += count; old += count;
} }
} }
@ -791,7 +801,9 @@ DESCRIPTION
*/ */
static void static void
info_sharedlibrary_command () info_sharedlibrary_command (ignore, from_tty)
char *ignore;
int from_tty;
{ {
register struct so_list *so = NULL; /* link map state variable */ register struct so_list *so = NULL; /* link map state variable */
int header_done = 0; int header_done = 0;
@ -1003,12 +1015,11 @@ static int
enable_break () enable_break ()
{ {
int j;
#ifndef SVR4_SHARED_LIBS #ifndef SVR4_SHARED_LIBS
int j;
int in_debugger; int in_debugger;
/* Get link_dynamic structure */ /* Get link_dynamic structure */
j = target_read_memory (debug_base, (char *) &dynamic_copy, j = target_read_memory (debug_base, (char *) &dynamic_copy,
@ -1193,11 +1204,34 @@ special_symbol_handling (so)
struct so_list *so; struct so_list *so;
{ {
#ifndef SVR4_SHARED_LIBS #ifndef SVR4_SHARED_LIBS
int j;
if (debug_addr == 0)
{
/* Get link_dynamic structure */
j = target_read_memory (debug_base, (char *) &dynamic_copy,
sizeof (dynamic_copy));
if (j)
{
/* unreadable */
return;
}
/* Calc address of debugger interface structure */
/* FIXME, this needs work for cross-debugging of core files
(byteorder, size, alignment, etc). */
debug_addr = (CORE_ADDR) dynamic_copy.ldd;
}
/* Read the debugger structure from the inferior, just to make sure /* Read the debugger structure from the inferior, just to make sure
we have a current copy. */ we have a current copy. */
read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy)); j = target_read_memory (debug_addr, (char *) &debug_copy,
sizeof (debug_copy));
if (j)
return; /* unreadable */
/* Get common symbol definitions for the loaded object. */ /* Get common symbol definitions for the loaded object. */

View file

@ -464,7 +464,7 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr)
if (!fid) if (!fid)
fatal ("Bad frame info struct in FRAME_FIND_SAVED_REGS"); fatal ("Bad frame info struct in FRAME_FIND_SAVED_REGS");
bzero (saved_regs_addr, sizeof (*saved_regs_addr)); (void) memset (saved_regs_addr, 0, sizeof (*saved_regs_addr));
/* Old test. /* Old test.
if (fi->pc >= frame - CALL_DUMMY_LENGTH - 0x140 if (fi->pc >= frame - CALL_DUMMY_LENGTH - 0x140

View file

@ -76,7 +76,7 @@ fetch_inferior_registers (regno)
perror("ptrace_getregs"); perror("ptrace_getregs");
registers[REGISTER_BYTE (0)] = 0; registers[REGISTER_BYTE (0)] = 0;
bcopy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (1)], 15 * REGISTER_RAW_SIZE (G0_REGNUM)); (void) memcpy (&registers[REGISTER_BYTE (1)], &inferior_registers.r_g1, 15 * REGISTER_RAW_SIZE (G0_REGNUM));
*(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
*(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
*(int *)&registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc; *(int *)&registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc;
@ -103,8 +103,9 @@ fetch_inferior_registers (regno)
(PTRACE_ARG3_TYPE) &inferior_fp_registers, (PTRACE_ARG3_TYPE) &inferior_fp_registers,
0)) 0))
perror("ptrace_getfpregs"); perror("ptrace_getfpregs");
bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)], (void) memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fpu_fr); &inferior_fp_registers,
sizeof inferior_fp_registers.fpu_fr);
/* bcopy (&inferior_fp_registers.Fpu_fsr, /* bcopy (&inferior_fp_registers.Fpu_fsr,
&registers[REGISTER_BYTE (FPS_REGNUM)], &registers[REGISTER_BYTE (FPS_REGNUM)],
sizeof (FPU_FSR_TYPE)); FIXME??? -- gnu@cyg */ sizeof (FPU_FSR_TYPE)); FIXME??? -- gnu@cyg */
@ -209,8 +210,9 @@ store_inferior_registers (regno)
{ {
if (!register_valid[G1_REGNUM]) abort(); if (!register_valid[G1_REGNUM]) abort();
bcopy (&registers[REGISTER_BYTE (G1_REGNUM)], (void) memcpy (&inferior_registers.r_g1,
&inferior_registers.r_g1, 15 * REGISTER_RAW_SIZE (G1_REGNUM)); &registers[REGISTER_BYTE (G1_REGNUM)],
15 * REGISTER_RAW_SIZE (G1_REGNUM));
inferior_registers.r_ps = inferior_registers.r_ps =
*(int *)&registers[REGISTER_BYTE (PS_REGNUM)]; *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
@ -229,13 +231,13 @@ store_inferior_registers (regno)
if (wanna_store & FP_REGS) if (wanna_store & FP_REGS)
{ {
if (!register_valid[FP0_REGNUM+9]) abort(); if (!register_valid[FP0_REGNUM+9]) abort();
bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], (void) memcpy (&inferior_fp_registers,
&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fpu_fr); sizeof inferior_fp_registers.fpu_fr);
/* bcopy (&registers[REGISTER_BYTE (FPS_REGNUM)], /* (void) memcpy (&inferior_fp_registers.Fpu_fsr,
&inferior_fp_registers.Fpu_fsr, &registers[REGISTER_BYTE (FPS_REGNUM)],
sizeof (FPU_FSR_TYPE)); sizeof (FPU_FSR_TYPE));
****/ ****/
if (0 != if (0 !=
ptrace (PTRACE_SETFPREGS, inferior_pid, ptrace (PTRACE_SETFPREGS, inferior_pid,
@ -261,9 +263,9 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
*(int *)&registers[REGISTER_BYTE (0)] = 0; *(int *)&registers[REGISTER_BYTE (0)] = 0;
/* The globals and output registers. */ /* The globals and output registers. */
bcopy (&gregs->r_g1, (void) memcpy (&registers[REGISTER_BYTE (G1_REGNUM)],
&registers[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1,
15 * REGISTER_RAW_SIZE (G1_REGNUM)); 15 * REGISTER_RAW_SIZE (G1_REGNUM));
*(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps;
*(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc;
*(int *)&registers[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; *(int *)&registers[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc;
@ -293,12 +295,12 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
#define fpuregs ((struct fpu *) core_reg_sect) #define fpuregs ((struct fpu *) core_reg_sect)
if (core_reg_size >= sizeof (struct fpu)) if (core_reg_size >= sizeof (struct fpu))
{ {
bcopy (fpuregs->fpu_regs, (void) memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
&registers[REGISTER_BYTE (FP0_REGNUM)], fpuregs->fpu_regs,
sizeof (fpuregs->fpu_regs)); sizeof (fpuregs->fpu_regs));
bcopy (&fpuregs->fpu_fsr, (void) memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)],
&registers[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr,
sizeof (FPU_FSR_TYPE)); sizeof (FPU_FSR_TYPE));
} }
else else
fprintf (stderr, "Couldn't read float regs from core file\n"); fprintf (stderr, "Couldn't read float regs from core file\n");

View file

@ -779,7 +779,7 @@ print_frame_label_vars (frame, this_level_only, stream)
bl = blockvector_for_pc (BLOCK_END (block) - 4, &index); bl = blockvector_for_pc (BLOCK_END (block) - 4, &index);
blocks_printed = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char)); blocks_printed = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
bzero (blocks_printed, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char)); (void) memset (blocks_printed, 0, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
while (block != 0) while (block != 0)
{ {

View file

@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "breakpoint.h" #include "breakpoint.h"
#include "command.h" #include "command.h"
#include "obstack.h" #include "obstack.h"
#include "language.h"
#include <string.h> #include <string.h>
@ -255,7 +256,7 @@ dump_psymtab (objfile, psymtab, outfile)
psymtab -> filename); psymtab -> filename);
fprintf_filtered (outfile, "(object 0x%x)\n\n", psymtab); fprintf_filtered (outfile, "(object 0x%x)\n\n", psymtab);
fprintf (outfile, " Read from object file %s (0x%x)\n", fprintf (outfile, " Read from object file %s (0x%x)\n",
objfile -> name, objfile); objfile -> name, (unsigned int) objfile);
if (psymtab -> readin) if (psymtab -> readin)
{ {
@ -299,7 +300,7 @@ dump_symtab (objfile, symtab, outfile)
fprintf (outfile, "\nSymtab for file %s\n", symtab->filename); fprintf (outfile, "\nSymtab for file %s\n", symtab->filename);
fprintf (outfile, "Read from object file %s (%x)\n", objfile->name, fprintf (outfile, "Read from object file %s (%x)\n", objfile->name,
objfile); (unsigned int) objfile);
fprintf (outfile, "Language: %s\n", language_str (symtab -> language)); fprintf (outfile, "Language: %s\n", language_str (symtab -> language));
/* First print the line table. */ /* First print the line table. */
@ -320,10 +321,10 @@ dump_symtab (objfile, symtab, outfile)
b = BLOCKVECTOR_BLOCK (bv, i); b = BLOCKVECTOR_BLOCK (bv, i);
depth = block_depth (b) * 2; depth = block_depth (b) * 2;
print_spaces (depth, outfile); print_spaces (depth, outfile);
fprintf (outfile, "block #%03d (object 0x%x) ", i, b); fprintf (outfile, "block #%03d (object 0x%x) ", i, (unsigned int) b);
fprintf (outfile, "[0x%x..0x%x]", BLOCK_START (b), BLOCK_END (b)); fprintf (outfile, "[0x%x..0x%x]", BLOCK_START (b), BLOCK_END (b));
if (BLOCK_SUPERBLOCK (b)) if (BLOCK_SUPERBLOCK (b))
fprintf (outfile, " (under 0x%x)", BLOCK_SUPERBLOCK (b)); fprintf (outfile, " (under 0x%x)", (unsigned int) BLOCK_SUPERBLOCK (b));
if (BLOCK_FUNCTION (b)) if (BLOCK_FUNCTION (b))
fprintf (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b))); fprintf (outfile, " %s", SYMBOL_NAME (BLOCK_FUNCTION (b)));
fputc ('\n', outfile); fputc ('\n', outfile);
@ -461,12 +462,28 @@ print_symbol (symbol, depth, outfile)
break; break;
case LOC_ARG: case LOC_ARG:
fprintf (outfile, "arg at 0x%lx,", SYMBOL_VALUE (symbol)); if (SYMBOL_BASEREG_VALID (symbol))
{
fprintf (outfile, "arg at 0x%lx from register %d,",
SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
}
else
{
fprintf (outfile, "arg at 0x%lx,", SYMBOL_VALUE (symbol));
}
break; break;
case LOC_LOCAL_ARG: case LOC_LOCAL_ARG:
fprintf (outfile, "arg at offset 0x%x from fp,", if (SYMBOL_BASEREG_VALID (symbol))
SYMBOL_VALUE (symbol)); {
fprintf (outfile, "arg at offset 0x%lx from register %d,",
SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
}
else
{
fprintf (outfile, "arg at offset 0x%lx from fp,",
SYMBOL_VALUE (symbol));
}
case LOC_REF_ARG: case LOC_REF_ARG:
fprintf (outfile, "reference arg at 0x%lx,", SYMBOL_VALUE (symbol)); fprintf (outfile, "reference arg at 0x%lx,", SYMBOL_VALUE (symbol));
@ -477,7 +494,15 @@ print_symbol (symbol, depth, outfile)
break; break;
case LOC_LOCAL: case LOC_LOCAL:
fprintf (outfile, "local at 0x%lx,", SYMBOL_VALUE (symbol)); if (SYMBOL_BASEREG_VALID (symbol))
{
fprintf (outfile, "local at 0x%lx from register %d",
SYMBOL_VALUE (symbol), SYMBOL_BASEREG (symbol));
}
else
{
fprintf (outfile, "local at 0x%lx,", SYMBOL_VALUE (symbol));
}
break; break;
case LOC_TYPEDEF: case LOC_TYPEDEF:
@ -489,7 +514,7 @@ print_symbol (symbol, depth, outfile)
case LOC_BLOCK: case LOC_BLOCK:
fprintf (outfile, "block (object 0x%x) starting at 0x%x,", fprintf (outfile, "block (object 0x%x) starting at 0x%x,",
SYMBOL_BLOCK_VALUE (symbol), (unsigned int) SYMBOL_BLOCK_VALUE (symbol),
BLOCK_START (SYMBOL_BLOCK_VALUE (symbol))); BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)));
break; break;

View file

@ -1494,7 +1494,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
p1 = p; p1 = p;
while (p != *argptr && p[-1] == ' ') --p; while (p != *argptr && p[-1] == ' ') --p;
copy = (char *) alloca (p - *argptr + 1); copy = (char *) alloca (p - *argptr + 1);
bcopy (*argptr, copy, p - *argptr); (void) memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = 0; copy[p - *argptr] = 0;
/* Discard the class name from the arg. */ /* Discard the class name from the arg. */
@ -1535,7 +1535,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
else else
{ {
copy = (char *) alloca (p - *argptr + 1 + (q1 - q)); copy = (char *) alloca (p - *argptr + 1 + (q1 - q));
bcopy (*argptr, copy, p - *argptr); (void) memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0'; copy[p - *argptr] = '\0';
} }
@ -1630,7 +1630,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
p1 = p; p1 = p;
while (p != *argptr && p[-1] == ' ') --p; while (p != *argptr && p[-1] == ' ') --p;
copy = (char *) alloca (p - *argptr + 1); copy = (char *) alloca (p - *argptr + 1);
bcopy (*argptr, copy, p - *argptr); (void) memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = 0; copy[p - *argptr] = 0;
/* Find that file's data. */ /* Find that file's data. */
@ -1717,7 +1717,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
p = skip_quoted (*argptr); p = skip_quoted (*argptr);
copy = (char *) alloca (p - *argptr + 1); copy = (char *) alloca (p - *argptr + 1);
bcopy (*argptr, copy, p - *argptr); (void) memcpy (copy, *argptr, p - *argptr);
copy[p - *argptr] = '\0'; copy[p - *argptr] = '\0';
if ((copy[0] == copy [p - *argptr - 1]) if ((copy[0] == copy [p - *argptr - 1])
&& strchr (gdb_completer_quote_characters, copy[0]) != NULL) && strchr (gdb_completer_quote_characters, copy[0]) != NULL)
@ -1784,7 +1784,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
values.sals = (struct symtab_and_line *) values.sals = (struct symtab_and_line *)
xmalloc (sizeof (struct symtab_and_line)); xmalloc (sizeof (struct symtab_and_line));
values.nelts = 1; values.nelts = 1;
bzero (&values.sals[0], sizeof (values.sals[0])); (void) memset (&values.sals[0], 0, sizeof (values.sals[0]));
values.sals[0].symtab = sym_symtab; values.sals[0].symtab = sym_symtab;
values.sals[0].line = SYMBOL_LINE (sym); values.sals[0].line = SYMBOL_LINE (sym);
return values; return values;
@ -1899,7 +1899,8 @@ decode_line_2 (sym_arr, nelts, funfirstline)
error ("cancelled"); error ("cancelled");
else if (num == 1) else if (num == 1)
{ {
bcopy (values.sals, return_values.sals, (nelts * sizeof(struct symtab_and_line))); (void) memcpy (return_values.sals, values.sals,
(nelts * sizeof(struct symtab_and_line)));
return_values.nelts = nelts; return_values.nelts = nelts;
return return_values; return return_values;
} }
@ -2729,7 +2730,7 @@ expensive_mangler (lookfor)
to in_function_type if it was called correctly). to in_function_type if it was called correctly).
Note that since we are modifying a type, the result of Note that since we are modifying a type, the result of
lookup_function_type() should be bcopy()ed before calling lookup_function_type() should be memcpy()ed before calling
this. When not in strict typing mode, the expression this. When not in strict typing mode, the expression
evaluator can choose to ignore this. evaluator can choose to ignore this.

View file

@ -30,12 +30,12 @@ extern struct objfile *current_objfile;
#define obstack_chunk_free free #define obstack_chunk_free free
/* Some macros for char-based bitfields. */ /* Some macros for char-based bitfields. */
#define B_SET(a,x) (a[x>>3] |= (1 << (x&7))) #define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
#define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7))) #define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
#define B_TST(a,x) (a[x>>3] & (1 << (x&7))) #define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
#define B_TYPE unsigned char #define B_TYPE unsigned char
#define B_BYTES(x) ( 1 + ((x)>>3) ) #define B_BYTES(x) ( 1 + ((x)>>3) )
#define B_CLRALL(a,x) bzero (a, B_BYTES(x)) #define B_CLRALL(a,x) (void) memset ((a), 0, B_BYTES(x))
/* Define a simple structure used to hold some very basic information about /* Define a simple structure used to hold some very basic information about
@ -490,7 +490,15 @@ extern int current_source_line;
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain #define SYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain
#define SYMBOL_TYPE(symbol) (symbol)->type #define SYMBOL_TYPE(symbol) (symbol)->type
#define SYMBOL_LINE(symbol) (symbol)->line #define SYMBOL_LINE(symbol) (symbol)->line
#if 0
/* This currently fails because some symbols are not being initialized
to zero on allocation, and no code is currently setting this value.
Basereg handling will probably change significantly in the next release.
FIXME -fnf */
#define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid #define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid
#else
#define SYMBOL_BASEREG_VALID(symbol) 0
#endif
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno #define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno
/* The virtual function table is now an array of structures /* The virtual function table is now an array of structures
@ -578,6 +586,11 @@ extern void
prim_record_minimal_symbol PARAMS ((const char *, CORE_ADDR, prim_record_minimal_symbol PARAMS ((const char *, CORE_ADDR,
enum minimal_symbol_type)); enum minimal_symbol_type));
extern void
prim_record_minimal_symbol_and_info PARAMS ((const char *, CORE_ADDR,
enum minimal_symbol_type,
char *info));
extern struct minimal_symbol * extern struct minimal_symbol *
lookup_minimal_symbol PARAMS ((const char *, struct objfile *)); lookup_minimal_symbol PARAMS ((const char *, struct objfile *));
@ -672,6 +685,9 @@ make_symbol_completion_list PARAMS ((char *));
/* symtab.c */ /* symtab.c */
extern void
clear_symtab_users_once PARAMS ((void));
extern struct partial_symtab * extern struct partial_symtab *
find_main_psymtab PARAMS ((void)); find_main_psymtab PARAMS ((void));

View file

@ -27,6 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "inferior.h" #include "inferior.h"
#include "bfd.h" #include "bfd.h"
#include "symfile.h" #include "symfile.h"
#include "objfiles.h"
extern int errno; extern int errno;
@ -169,6 +170,7 @@ nomemory (memaddr, myaddr, len, write)
int len; int len;
int write; int write;
{ {
errno = EIO; /* Can't read/write this location */
return 0; /* No bytes handled */ return 0; /* No bytes handled */
} }
@ -520,7 +522,7 @@ target_xfer_memory (memaddr, myaddr, len, write)
/* If this address is for nonexistent memory, /* If this address is for nonexistent memory,
read zeros if reading, or do nothing if writing. Return error. */ read zeros if reading, or do nothing if writing. Return error. */
if (!write) if (!write)
bzero (myaddr, len); (void) memset (myaddr, 0, len);
if (errno == 0) if (errno == 0)
return EIO; return EIO;
else else

View file

@ -179,12 +179,14 @@ i386_skip_prologue PARAMS ((int));
/* Convert data from raw format for register REGNUM /* Convert data from raw format for register REGNUM
to virtual format for register REGNUM. */ to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);} #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
{(void) memcpy ((TO), (FROM), 4);}
/* Convert data from virtual format for register REGNUM /* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */ to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);} #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
{(void) memcpy ((TO), (FROM), 4);}
/* Return the GDB type object for the "standard" data type /* Return the GDB type object for the "standard" data type
of data in register N. */ of data in register N. */
@ -206,7 +208,7 @@ i386_skip_prologue PARAMS ((int));
into VALBUF. */ into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE)) (void) memcpy ((VALBUF), (REGBUF), TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value /* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */ of type TYPE, given in virtual format. */

View file

@ -63,4 +63,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
This routine returns true on success */ This routine returns true on success */
extern int
get_longjmp_target PARAMS ((CORE_ADDR *));
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) #define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)

View file

@ -222,13 +222,13 @@ extern CORE_ADDR sparc_pc_adjust();
to virtual format for register REGNUM. */ to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \ #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
{ bcopy ((FROM), (TO), 4); } { (void) memcpy ((TO), (FROM), 4); }
/* Convert data from virtual format for register REGNUM /* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */ to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \ #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
{ bcopy ((FROM), (TO), 4); } { (void) memcpy ((TO), (FROM), 4); }
/* Return the GDB type object for the "standard" data type /* Return the GDB type object for the "standard" data type
of data in register N. */ of data in register N. */
@ -256,13 +256,15 @@ extern CORE_ADDR sparc_pc_adjust();
{ \ { \
if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
{ \ { \
bcopy (((int *)(REGBUF))+FP0_REGNUM, \ (void) memcpy ((VALBUF), \
(VALBUF), TYPE_LENGTH(TYPE)); \ ((int *)(REGBUF))+FP0_REGNUM, \
TYPE_LENGTH(TYPE)); \
} \ } \
else \ else \
bcopy ((char *)(REGBUF) + 4 * 8 + \ (void) memcpy ((VALBUF), \
(TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)), \ (char *)(REGBUF) + 4 * 8 + \
(VALBUF), TYPE_LENGTH(TYPE)); \ (TYPE_LENGTH(TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH(TYPE)), \
TYPE_LENGTH(TYPE)); \
} }
/* Write into appropriate registers a function return value /* Write into appropriate registers a function return value

View file

@ -18,10 +18,11 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h" #include "defs.h"
#if !defined(__GO32__)
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/param.h> #include <sys/param.h>
#include <pwd.h> #include <pwd.h>
#endif
#include <varargs.h> #include <varargs.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -402,6 +403,7 @@ quit ()
{ {
target_terminal_ours (); target_terminal_ours ();
wrap_here ((char *)0); /* Force out any pending output */ wrap_here ((char *)0); /* Force out any pending output */
#if !defined(__GO32__)
#ifdef HAVE_TERMIO #ifdef HAVE_TERMIO
ioctl (fileno (stdout), TCFLSH, 1); ioctl (fileno (stdout), TCFLSH, 1);
#else /* not HAVE_TERMIO */ #else /* not HAVE_TERMIO */
@ -412,6 +414,7 @@ quit ()
#else #else
error ("Quit (expect signal %d when inferior is resumed)", SIGINT); error ("Quit (expect signal %d when inferior is resumed)", SIGINT);
#endif /* TIOCGPGRP */ #endif /* TIOCGPGRP */
#endif
} }
/* Control C comes here */ /* Control C comes here */
@ -631,7 +634,7 @@ savestring (ptr, size)
int size; int size;
{ {
register char *p = (char *) xmalloc (size + 1); register char *p = (char *) xmalloc (size + 1);
bcopy (ptr, p, size); (void) memcpy (p, ptr, size);
p[size] = 0; p[size] = 0;
return p; return p;
} }
@ -643,7 +646,7 @@ msavestring (md, ptr, size)
int size; int size;
{ {
register char *p = (char *) xmmalloc (md, size + 1); register char *p = (char *) xmmalloc (md, size + 1);
bcopy (ptr, p, size); (void) memcpy (p, ptr, size);
p[size] = 0; p[size] = 0;
return p; return p;
} }
@ -1285,6 +1288,24 @@ print_spaces_filtered (n, stream)
/* C++ demangler stuff. */ /* C++ demangler stuff. */
/* Make a copy of a symbol, applying C++ demangling if demangling is enabled
and a demangled version exists. Note that the value returned from
cplus_demangle is already allocated in malloc'd memory. */
char *
strdup_demangled (name)
const char *name;
{
char *demangled = NULL;
if (demangle)
{
demangled = cplus_demangle (name, DMGL_PARAMS | DMGL_ANSI);
}
return ((demangled != NULL) ? demangled : strdup (name));
}
/* Print NAME on STREAM, demangling if necessary. */ /* Print NAME on STREAM, demangling if necessary. */
void void
fprint_symbol (stream, name) fprint_symbol (stream, name)
@ -1301,6 +1322,73 @@ fprint_symbol (stream, name)
free (demangled); free (demangled);
} }
} }
/* Do a strcmp() type operation on STRING1 and STRING2, ignoring any
differences in whitespace. Returns 0 if they match, non-zero if they
don't (slightly different than strcmp()'s range of return values). */
int
strcmp_iw (string1, string2)
const char *string1;
const char *string2;
{
while ((*string1 != '\0') && (*string2 != '\0'))
{
while (isspace (*string1))
{
string1++;
}
while (isspace (*string2))
{
string2++;
}
if (*string1 != *string2)
{
break;
}
if (*string1 != '\0')
{
string1++;
string2++;
}
}
return (!((*string1 == '\0') && (*string2 == '\0')));
}
/* Demangle NAME and compare the result with LOOKFOR, ignoring any differences
in whitespace.
If a match is found, returns a pointer to the demangled version of NAME
in malloc'd memory, which needs to be freed by the caller after use.
If a match is not found, returns NULL.
OPTIONS is a flags word that controls the demangling process and is just
passed on to the demangler.
When the caller sees a non-NULL result, it knows that NAME is the mangled
equivalent of LOOKFOR, and it can use either NAME, the "official demangled"
version of NAME (the return value) or the "unofficial demangled" version
of NAME (LOOKFOR, which it already knows). */
char *
demangle_and_match (name, lookfor, options)
const char *name;
const char *lookfor;
int options;
{
char *demangled;
if ((demangled = cplus_demangle (name, options)) != NULL)
{
if (strcmp_iw (demangled, lookfor) != 0)
{
free (demangled);
demangled = NULL;
}
}
return (demangled);
}
void void
_initialize_utils () _initialize_utils ()
@ -1322,6 +1410,10 @@ _initialize_utils ()
/* These defaults will be used if we are unable to get the correct /* These defaults will be used if we are unable to get the correct
values from termcap. */ values from termcap. */
#if defined(__GO32__)
lines_per_page = ScreenRows();
chars_per_line = ScreenCols();
#else
lines_per_page = 24; lines_per_page = 24;
chars_per_line = 80; chars_per_line = 80;
/* Initialize the screen height and width from termcap. */ /* Initialize the screen height and width from termcap. */
@ -1364,7 +1456,7 @@ _initialize_utils ()
/* If there is a better way to determine the window size, use it. */ /* If there is a better way to determine the window size, use it. */
SIGWINCH_HANDLER (); SIGWINCH_HANDLER ();
#endif #endif
#endif
/* If the output is not a terminal, don't paginate it. */ /* If the output is not a terminal, don't paginate it. */
if (!ISATTY (stdout)) if (!ISATTY (stdout))
lines_per_page = UINT_MAX; lines_per_page = UINT_MAX;

View file

@ -17,11 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "defs.h" #include "defs.h"
#include "value.h" #include "value.h"
#include "symtab.h" #include "symtab.h"
#include "gdbtypes.h"
#include "expression.h" #include "expression.h"
#include "target.h" #include "target.h"
#include <string.h> #include <string.h>
@ -135,7 +134,8 @@ value_subscripted_rvalue (array, idx)
error ("no such vector element"); error ("no such vector element");
v = allocate_value (elt_type); v = allocate_value (elt_type);
bcopy (VALUE_CONTENTS (array) + elt_offs, VALUE_CONTENTS (v), elt_size); (void) memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs,
elt_size);
if (VALUE_LVAL (array) == lval_internalvar) if (VALUE_LVAL (array) == lval_internalvar)
VALUE_LVAL (v) = lval_internalvar_component; VALUE_LVAL (v) = lval_internalvar_component;
@ -550,7 +550,7 @@ value_binop (arg1, arg2, op)
return val; return val;
} }
/* Simulate the C operator ! -- return 1 if ARG1 contains zeros. */ /* Simulate the C operator ! -- return 1 if ARG1 contains zero. */
int int
value_zerop (arg1) value_zerop (arg1)
@ -561,6 +561,9 @@ value_zerop (arg1)
COERCE_ARRAY (arg1); COERCE_ARRAY (arg1);
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_FLT)
return 0 == value_as_double (arg1);
len = TYPE_LENGTH (VALUE_TYPE (arg1)); len = TYPE_LENGTH (VALUE_TYPE (arg1));
p = VALUE_CONTENTS (arg1); p = VALUE_CONTENTS (arg1);

View file

@ -130,7 +130,7 @@ value_zero (type, lv)
{ {
register value val = allocate_value (type); register value val = allocate_value (type);
memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (type)); (void) memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (type));
VALUE_LVAL (val) = lv; VALUE_LVAL (val) = lv;
return val; return val;
@ -323,7 +323,7 @@ value_assign (toval, fromval)
amount_copied += reg_size, regno++) amount_copied += reg_size, regno++)
{ {
get_saved_register (buffer + amount_copied, get_saved_register (buffer + amount_copied,
(int *)NULL, (CORE_ADDR)NULL, (int *)NULL, (CORE_ADDR *)NULL,
frame, regno, (enum lval_type *)NULL); frame, regno, (enum lval_type *)NULL);
} }
@ -333,10 +333,10 @@ value_assign (toval, fromval)
(int) value_as_long (fromval), (int) value_as_long (fromval),
VALUE_BITPOS (toval), VALUE_BITSIZE (toval)); VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
else if (use_buffer) else if (use_buffer)
bcopy (raw_buffer, buffer + byte_offset, use_buffer); (void) memcpy (buffer + byte_offset, raw_buffer, use_buffer);
else else
bcopy (VALUE_CONTENTS (fromval), buffer + byte_offset, (void) memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
/* Copy it back. */ /* Copy it back. */
for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset, for ((regno = VALUE_FRAME_REGNUM (toval) + reg_offset,
@ -379,8 +379,9 @@ value_assign (toval, fromval)
} }
val = allocate_value (type); val = allocate_value (type);
bcopy (toval, val, VALUE_CONTENTS_RAW (val) - (char *) val); (void) memcpy (val, toval, VALUE_CONTENTS_RAW (val) - (char *) val);
bcopy (VALUE_CONTENTS (fromval), VALUE_CONTENTS_RAW (val), TYPE_LENGTH (type)); (void) memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS (fromval),
TYPE_LENGTH (type));
VALUE_TYPE (val) = type; VALUE_TYPE (val) = type;
return val; return val;
@ -741,7 +742,7 @@ call_function_by_hand (function, nargs, args)
/* Create a call sequence customized for this function /* Create a call sequence customized for this function
and the number of arguments for it. */ and the number of arguments for it. */
bcopy (dummy, dummy1, sizeof dummy); (void) memcpy (dummy1, dummy, sizeof dummy);
for (i = 0; i < sizeof dummy / sizeof (REGISTER_TYPE); i++) for (i = 0; i < sizeof dummy / sizeof (REGISTER_TYPE); i++)
SWAP_TARGET_AND_HOST (&dummy1[i], sizeof (REGISTER_TYPE)); SWAP_TARGET_AND_HOST (&dummy1[i], sizeof (REGISTER_TYPE));
FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
@ -1331,8 +1332,9 @@ check_field (arg1, name)
to resolve user expressions of the form "DOMAIN::NAME". */ to resolve user expressions of the form "DOMAIN::NAME". */
value value
value_struct_elt_for_reference (domain, curtype, name, intype) value_struct_elt_for_reference (domain, offset, curtype, name, intype)
struct type *domain, *curtype, *intype; struct type *domain, *curtype, *intype;
int offset;
char *name; char *name;
{ {
register struct type *t = curtype; register struct type *t = curtype;
@ -1367,7 +1369,7 @@ value_struct_elt_for_reference (domain, curtype, name, intype)
return value_from_longest return value_from_longest
(lookup_reference_type (lookup_member_type (TYPE_FIELD_TYPE (t, i), (lookup_reference_type (lookup_member_type (TYPE_FIELD_TYPE (t, i),
domain)), domain)),
(LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3)); offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
} }
} }
@ -1431,7 +1433,15 @@ value_struct_elt_for_reference (domain, curtype, name, intype)
for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--) for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--)
{ {
value v;
int base_offset;
if (BASETYPE_VIA_VIRTUAL (t, i))
base_offset = 0;
else
base_offset = TYPE_BASECLASS_BITPOS (t, i) / 8;
v = value_struct_elt_for_reference (domain, v = value_struct_elt_for_reference (domain,
offset + base_offset,
TYPE_BASECLASS (t, i), TYPE_BASECLASS (t, i),
name, name,
intype); intype);

View file

@ -236,7 +236,7 @@ print_floating (valaddr, type, stream)
if (len == sizeof (float)) if (len == sizeof (float))
{ {
/* It's single precision. */ /* It's single precision. */
bcopy (valaddr, &low, sizeof (low)); (void) memcpy ((char *) &low, valaddr, sizeof (low));
/* target -> host. */ /* target -> host. */
SWAP_TARGET_AND_HOST (&low, sizeof (float)); SWAP_TARGET_AND_HOST (&low, sizeof (float));
nonnegative = low >= 0; nonnegative = low >= 0;
@ -250,11 +250,11 @@ print_floating (valaddr, type, stream)
/* It's double precision. Get the high and low words. */ /* It's double precision. Get the high and low words. */
#if TARGET_BYTE_ORDER == BIG_ENDIAN #if TARGET_BYTE_ORDER == BIG_ENDIAN
bcopy (valaddr+4, &low, sizeof (low)); (void) memcpy (&low, valaddr+4, sizeof (low));
bcopy (valaddr+0, &high, sizeof (high)); (void) memcpy (&high, valaddr+0, sizeof (high));
#else #else
bcopy (valaddr+0, &low, sizeof (low)); (void) memcpy (&low, valaddr+0, sizeof (low));
bcopy (valaddr+4, &high, sizeof (high)); (void) memcpy (&high, valaddr+4, sizeof (high));
#endif #endif
SWAP_TARGET_AND_HOST (&low, sizeof (low)); SWAP_TARGET_AND_HOST (&low, sizeof (low));
SWAP_TARGET_AND_HOST (&high, sizeof (high)); SWAP_TARGET_AND_HOST (&high, sizeof (high));
@ -368,7 +368,7 @@ value_print (val, stream, format, pretty)
rep1 = i + 1; rep1 = i + 1;
reps = 1; reps = 1;
while (rep1 < n while (rep1 < n
&& !bcmp (VALUE_CONTENTS (val) + typelen * i, && !memcmp (VALUE_CONTENTS (val) + typelen * i,
VALUE_CONTENTS (val) + typelen * rep1, typelen)) VALUE_CONTENTS (val) + typelen * rep1, typelen))
{ {
++reps; ++reps;
@ -815,8 +815,8 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
rep1 = i + 1; rep1 = i + 1;
reps = 1; reps = 1;
while (rep1 < len while (rep1 < len
&& !bcmp (valaddr + i * eltlen, && !memcmp (valaddr + i * eltlen,
valaddr + rep1 * eltlen, eltlen)) valaddr + rep1 * eltlen, eltlen))
{ {
++reps; ++reps;
++rep1; ++rep1;
@ -1562,6 +1562,9 @@ type_print_varspec_prefix (type, stream, show, passed_a_ptr)
case TYPE_CODE_ERROR: case TYPE_CODE_ERROR:
case TYPE_CODE_CHAR: case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL: case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_PASCAL_ARRAY:
/* These types need no prefix. They are listed here so that /* These types need no prefix. They are listed here so that
gcc -Wall will reveal any types that haven't been handled. */ gcc -Wall will reveal any types that haven't been handled. */
break; break;
@ -1662,6 +1665,9 @@ type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
case TYPE_CODE_ERROR: case TYPE_CODE_ERROR:
case TYPE_CODE_CHAR: case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL: case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_PASCAL_ARRAY:
/* These types do not need a suffix. They are listed so that /* These types do not need a suffix. They are listed so that
gcc -Wall will report types that may not have been considered. */ gcc -Wall will report types that may not have been considered. */
break; break;

View file

@ -211,9 +211,9 @@ value_copy (arg)
VALUE_LAZY (val) = VALUE_LAZY (arg); VALUE_LAZY (val) = VALUE_LAZY (arg);
if (!VALUE_LAZY (val)) if (!VALUE_LAZY (val))
{ {
bcopy (VALUE_CONTENTS_RAW (arg), VALUE_CONTENTS_RAW (val), memcpy (VALUE_CONTENTS_RAW (val), VALUE_CONTENTS_RAW (arg),
TYPE_LENGTH (VALUE_TYPE (arg)) TYPE_LENGTH (VALUE_TYPE (arg))
* (VALUE_REPEATED (arg) ? VALUE_REPETITIONS (arg) : 1)); * (VALUE_REPEATED (arg) ? VALUE_REPETITIONS (arg) : 1));
} }
return val; return val;
} }
@ -247,7 +247,7 @@ record_latest_value (val)
register struct value_history_chunk *new register struct value_history_chunk *new
= (struct value_history_chunk *) = (struct value_history_chunk *)
xmalloc (sizeof (struct value_history_chunk)); xmalloc (sizeof (struct value_history_chunk));
bzero (new->values, sizeof new->values); (void) memset (new->values, 0, sizeof new->values);
new->next = value_history_chain; new->next = value_history_chain;
value_history_chain = new; value_history_chain = new;
} }
@ -437,8 +437,8 @@ set_internalvar_component (var, offset, bitpos, bitsize, newval)
modify_field (addr, (int) value_as_long (newval), modify_field (addr, (int) value_as_long (newval),
bitpos, bitsize); bitpos, bitsize);
else else
bcopy (VALUE_CONTENTS (newval), addr, (void) memcpy (addr, VALUE_CONTENTS (newval),
TYPE_LENGTH (VALUE_TYPE (newval))); TYPE_LENGTH (VALUE_TYPE (newval)));
} }
void void
@ -587,7 +587,7 @@ unpack_long (type, valaddr)
if (len == sizeof (float)) if (len == sizeof (float))
{ {
float retval; float retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -595,7 +595,7 @@ unpack_long (type, valaddr)
if (len == sizeof (double)) if (len == sizeof (double))
{ {
double retval; double retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -616,7 +616,7 @@ unpack_long (type, valaddr)
if (len == sizeof (short)) if (len == sizeof (short))
{ {
unsigned short retval; unsigned short retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -624,7 +624,7 @@ unpack_long (type, valaddr)
if (len == sizeof (int)) if (len == sizeof (int))
{ {
unsigned int retval; unsigned int retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -632,7 +632,7 @@ unpack_long (type, valaddr)
if (len == sizeof (long)) if (len == sizeof (long))
{ {
unsigned long retval; unsigned long retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -640,7 +640,7 @@ unpack_long (type, valaddr)
if (len == sizeof (long long)) if (len == sizeof (long long))
{ {
unsigned long long retval; unsigned long long retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -655,7 +655,7 @@ unpack_long (type, valaddr)
if (len == sizeof (char)) if (len == sizeof (char))
{ {
SIGNED char retval; /* plain chars might be unsigned on host */ SIGNED char retval; /* plain chars might be unsigned on host */
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -663,7 +663,7 @@ unpack_long (type, valaddr)
if (len == sizeof (short)) if (len == sizeof (short))
{ {
short retval; short retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -671,7 +671,7 @@ unpack_long (type, valaddr)
if (len == sizeof (int)) if (len == sizeof (int))
{ {
int retval; int retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -679,7 +679,7 @@ unpack_long (type, valaddr)
if (len == sizeof (long)) if (len == sizeof (long))
{ {
long retval; long retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -688,7 +688,7 @@ unpack_long (type, valaddr)
if (len == sizeof (long long)) if (len == sizeof (long long))
{ {
long long retval; long long retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -706,14 +706,14 @@ unpack_long (type, valaddr)
if (len == sizeof(long)) if (len == sizeof(long))
{ {
unsigned long retval; unsigned long retval;
bcopy (valaddr, &retval, sizeof(retval)); (void) memcpy (&retval, valaddr, sizeof(retval));
SWAP_TARGET_AND_HOST (&retval, sizeof(retval)); SWAP_TARGET_AND_HOST (&retval, sizeof(retval));
return retval; return retval;
} }
else if (len == sizeof(short)) else if (len == sizeof(short))
{ {
unsigned short retval; unsigned short retval;
bcopy (valaddr, &retval, len); (void) memcpy (&retval, valaddr, len);
SWAP_TARGET_AND_HOST (&retval, len); SWAP_TARGET_AND_HOST (&retval, len);
return retval; return retval;
} }
@ -755,7 +755,7 @@ unpack_double (type, valaddr, invp)
if (len == sizeof (float)) if (len == sizeof (float))
{ {
float retval; float retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -763,7 +763,7 @@ unpack_double (type, valaddr, invp)
if (len == sizeof (double)) if (len == sizeof (double))
{ {
double retval; double retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -816,7 +816,7 @@ unpack_pointer (type, valaddr)
if (len == sizeof (CORE_ADDR)) if (len == sizeof (CORE_ADDR))
{ {
CORE_ADDR retval; CORE_ADDR retval;
bcopy (valaddr, &retval, sizeof (retval)); (void) memcpy (&retval, valaddr, sizeof (retval));
SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
return retval; return retval;
} }
@ -872,9 +872,8 @@ value_primitive_field (arg1, offset, fieldno, arg_type)
if (VALUE_LAZY (arg1)) if (VALUE_LAZY (arg1))
VALUE_LAZY (v) = 1; VALUE_LAZY (v) = 1;
else else
bcopy (VALUE_CONTENTS_RAW (arg1) + offset, (void) memcpy (VALUE_CONTENTS_RAW (v),
VALUE_CONTENTS_RAW (v), VALUE_CONTENTS_RAW (arg1) + offset, TYPE_LENGTH (type));
TYPE_LENGTH (type));
} }
VALUE_LVAL (v) = VALUE_LVAL (arg1); VALUE_LVAL (v) = VALUE_LVAL (arg1);
if (VALUE_LVAL (arg1) == lval_internalvar) if (VALUE_LVAL (arg1) == lval_internalvar)
@ -1008,8 +1007,6 @@ value_headof (arg, btype, dtype)
/* First collect the vtables we must look at for this object. */ /* First collect the vtables we must look at for this object. */
/* FIXME-tiemann: right now, just look at top-most vtable. */ /* FIXME-tiemann: right now, just look at top-most vtable. */
value vtbl, entry, best_entry = 0; value vtbl, entry, best_entry = 0;
/* FIXME: entry_type is never used. */
struct type *entry_type;
int i, nelems; int i, nelems;
int offset, best_offset = 0; int offset, best_offset = 0;
struct symbol *sym; struct symbol *sym;
@ -1034,7 +1031,7 @@ value_headof (arg, btype, dtype)
know that we aren't happy, but don't throw an error. know that we aren't happy, but don't throw an error.
FIXME: there has to be a better way to do this. */ FIXME: there has to be a better way to do this. */
struct type *error_type = (struct type *)xmalloc (sizeof (struct type)); struct type *error_type = (struct type *)xmalloc (sizeof (struct type));
bcopy (VALUE_TYPE (arg), error_type, sizeof (struct type)); (void) memcpy (error_type, VALUE_TYPE (arg), sizeof (struct type));
TYPE_NAME (error_type) = savestring ("suspicious *", sizeof ("suspicious *")); TYPE_NAME (error_type) = savestring ("suspicious *", sizeof ("suspicious *"));
VALUE_TYPE (arg) = error_type; VALUE_TYPE (arg) = error_type;
return arg; return arg;
@ -1221,7 +1218,7 @@ unpack_field_as_long (type, valaddr, fieldno)
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
int lsbcount; int lsbcount;
bcopy (valaddr + bitpos / 8, &val, sizeof (val)); (void) memcpy (&val, valaddr + bitpos / 8, sizeof (val));
SWAP_TARGET_AND_HOST (&val, sizeof (val)); SWAP_TARGET_AND_HOST (&val, sizeof (val));
/* Extract bits. See comment above. */ /* Extract bits. See comment above. */
@ -1270,7 +1267,7 @@ modify_field (addr, fieldval, bitpos, bitsize)
&& 0 != (fieldval & ~((1<<bitsize)-1))) && 0 != (fieldval & ~((1<<bitsize)-1)))
error ("Value %d does not fit in %d bits.", fieldval, bitsize); error ("Value %d does not fit in %d bits.", fieldval, bitsize);
bcopy (addr, &oword, sizeof oword); (void) memcpy (&oword, addr, sizeof oword);
SWAP_TARGET_AND_HOST (&oword, sizeof oword); /* To host format */ SWAP_TARGET_AND_HOST (&oword, sizeof oword); /* To host format */
/* Shifting for bit field depends on endianness of the target machine. */ /* Shifting for bit field depends on endianness of the target machine. */
@ -1286,7 +1283,7 @@ modify_field (addr, fieldval, bitpos, bitsize)
oword |= fieldval << bitpos; oword |= fieldval << bitpos;
SWAP_TARGET_AND_HOST (&oword, sizeof oword); /* To target format */ SWAP_TARGET_AND_HOST (&oword, sizeof oword); /* To target format */
bcopy (&oword, addr, sizeof oword); (void) memcpy (addr, &oword, sizeof oword);
} }
/* Convert C numbers into newly allocated values */ /* Convert C numbers into newly allocated values */