mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-24 12:39:59 +00:00
Replace strsave() with xstrdup().
This commit is contained in:
parent
e191e0abe5
commit
4fcf66da88
@ -1,3 +1,31 @@
|
||||
Tue Jan 30 17:09:07 2001 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* defs.h (strsave): Delete declaration.
|
||||
* utils.c (strsave): Delete definition.
|
||||
* TODO (strsave): Update
|
||||
|
||||
* mac-xdep.c (tilde_expand): Replace strsave with xstrdup.
|
||||
* sparcl-tdep.c (sparclite_open): Ditto.
|
||||
* mips-tdep.c (mips_set_processor_type_command): Ditto.
|
||||
(_initialize_mips_tdep): Ditto.
|
||||
* solib.c (solib_open): Ditto.
|
||||
* symfile.c (add_filename_language): Ditto.
|
||||
(set_ext_lang_command): Ditto.
|
||||
* source.c (init_source_path): Ditto.
|
||||
(mod_path): Ditto.
|
||||
* sh3-rom.c (sh3_open): Ditto.
|
||||
(sh3e_open): Ditto.
|
||||
* serial.c (serial_open): Ditto.
|
||||
* remote-mips.c (common_open): Ditto.
|
||||
* monitor.c (monitor_open): Ditto.
|
||||
* m32r-rom.c (m32r_upload_command): Ditto.
|
||||
* infcmd.c (path_command): Ditto.
|
||||
* f-exp.y (parse_number): Ditto.
|
||||
* breakpoint.c (create_longjmp_breakpoint): Ditto.
|
||||
(create_thread_event_breakpoint): Ditto.
|
||||
* arc-tdep.c (arc_set_cpu_type_command): Ditto.
|
||||
(_initialize_arc_tdep): Ditto.
|
||||
|
||||
Tue Jan 30 15:14:26 2001 Andrew Cagney <cagney@skil>
|
||||
|
||||
* cli/cli-script.c (define_command): Check for a bad hook value in
|
||||
|
6
gdb/TODO
6
gdb/TODO
@ -384,10 +384,6 @@ needed.
|
||||
|
||||
--
|
||||
|
||||
Replace strsave() + mstrsave() with libiberty:xstrdup().
|
||||
|
||||
--
|
||||
|
||||
Replace savestring() with something from libiberty.
|
||||
|
||||
An xstrldup()? but that would have different semantics.
|
||||
@ -419,7 +415,7 @@ how.
|
||||
|
||||
--
|
||||
|
||||
Eliminate mmalloc() from GDB.
|
||||
Eliminate mmalloc(), mstrsave() et.al. from GDB.
|
||||
|
||||
Also eliminate it from defs.h.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ARC target-dependent stuff.
|
||||
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1997, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -636,7 +636,7 @@ arc_set_cpu_type_command (char *args, int from_tty)
|
||||
printf_unfiltered ("%s\n", arc_cpu_type_table[i].name);
|
||||
|
||||
/* Restore the value. */
|
||||
tmp_arc_cpu_type = strsave (arc_cpu_type);
|
||||
tmp_arc_cpu_type = xstrdup (arc_cpu_type);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -645,7 +645,7 @@ arc_set_cpu_type_command (char *args, int from_tty)
|
||||
{
|
||||
error ("Unknown cpu type `%s'.", tmp_arc_cpu_type);
|
||||
/* Restore its value. */
|
||||
tmp_arc_cpu_type = strsave (arc_cpu_type);
|
||||
tmp_arc_cpu_type = xstrdup (arc_cpu_type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -695,9 +695,9 @@ cpu-type-specific registers and recognize cpu-type-specific instructions.\
|
||||
c = add_show_from_set (c, &showlist);
|
||||
c->function.cfunc = arc_show_cpu_type_command;
|
||||
|
||||
/* We have to use strsave here because the `set' command frees it before
|
||||
setting a new value. */
|
||||
tmp_arc_cpu_type = strsave (DEFAULT_ARC_CPU_TYPE);
|
||||
/* We have to use xstrdup() here because the `set' command frees it
|
||||
before setting a new value. */
|
||||
tmp_arc_cpu_type = xstrdup (DEFAULT_ARC_CPU_TYPE);
|
||||
arc_set_cpu_type (tmp_arc_cpu_type);
|
||||
|
||||
c = add_set_cmd ("displaypipeline", class_support, var_zinteger,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Everything about breakpoints, for GDB.
|
||||
Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Copyright 1986, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999,
|
||||
2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -3871,7 +3871,7 @@ create_longjmp_breakpoint (char *func_name)
|
||||
b->enable = disabled;
|
||||
b->silent = 1;
|
||||
if (func_name)
|
||||
b->addr_string = strsave (func_name);
|
||||
b->addr_string = xstrdup (func_name);
|
||||
b->number = internal_breakpoint_number--;
|
||||
}
|
||||
|
||||
@ -3928,7 +3928,7 @@ create_thread_event_breakpoint (CORE_ADDR address)
|
||||
b->enable = enabled;
|
||||
/* addr_string has to be used or breakpoint_re_set will delete me. */
|
||||
sprintf (addr_string, "*0x%s", paddr (b->address));
|
||||
b->addr_string = strsave (addr_string);
|
||||
b->addr_string = xstrdup (addr_string);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* *INDENT-OFF* */ /* ATTR_FORMAT confuses indent, avoid running it for now */
|
||||
/* Basic, host-specific, and target-specific definitions for GDB.
|
||||
Copyright (C) 1986, 1989, 1991-1996, 1998-2000
|
||||
Copyright (C) 1986, 1989, 1991-1996, 1998-2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -822,8 +822,6 @@ extern char *savestring (const char *, int);
|
||||
|
||||
extern char *msavestring (void *, const char *, int);
|
||||
|
||||
extern char *strsave (const char *);
|
||||
|
||||
extern char *mstrsave (void *, const char *);
|
||||
|
||||
/* FIXME; was long, but this causes compile errors in msvc if already
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* YACC parser for Fortran expressions, for GDB.
|
||||
Copyright 1986, 1989, 1990, 1991, 1993, 1994
|
||||
Free Software Foundation, Inc.
|
||||
Copyright 1986, 1989, 1990, 1991, 1993, 1994, 2001 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Contributed by Motorola. Adapted from the C parser by Farooq Butt
|
||||
(fmbutt@engage.sps.mot.com).
|
||||
|
||||
@ -653,7 +654,7 @@ parse_number (p, len, parsed_float, putithere)
|
||||
/* [dD] is not understood as an exponent by atof, change it to 'e'. */
|
||||
char *tmp, *tmp2;
|
||||
|
||||
tmp = strsave (p);
|
||||
tmp = xstrdup (p);
|
||||
for (tmp2 = tmp; *tmp2; ++tmp2)
|
||||
if (*tmp2 == 'd' || *tmp2 == 'D')
|
||||
*tmp2 = 'e';
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Memory-access and commands for "inferior" process, for GDB.
|
||||
Copyright 1986, 87, 88, 89, 91, 92, 95, 96, 1998, 1999
|
||||
Copyright 1986, 87, 88, 89, 91, 92, 95, 96, 1998, 1999, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -1436,7 +1436,7 @@ path_command (char *dirname, int from_tty)
|
||||
/* Can be null if path is not set */
|
||||
if (!env)
|
||||
env = "";
|
||||
exec_path = strsave (env);
|
||||
exec_path = xstrdup (env);
|
||||
mod_path (dirname, &exec_path);
|
||||
set_in_environ (inferior_environ, path_var_name, exec_path);
|
||||
xfree (exec_path);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
|
||||
the GNU debugger.
|
||||
Copyright 1996 Free Software Foundation, Inc.
|
||||
Copyright 1996, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Adapted by Michael Snyder of Cygnus Support.
|
||||
|
||||
@ -480,7 +480,7 @@ m32r_upload_command (char *args, int from_tty)
|
||||
error ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
|
||||
if (strchr (myIPaddress, '('))
|
||||
*(strchr (myIPaddress, '(')) = '\0'; /* delete trailing junk */
|
||||
board_addr = strsave (myIPaddress);
|
||||
board_addr = xstrdup (myIPaddress);
|
||||
}
|
||||
if (server_addr == 0)
|
||||
{
|
||||
@ -508,7 +508,7 @@ m32r_upload_command (char *args, int from_tty)
|
||||
if (args[0] != '/' && download_path == 0)
|
||||
{
|
||||
if (current_directory)
|
||||
download_path = strsave (current_directory);
|
||||
download_path = xstrdup (current_directory);
|
||||
else
|
||||
error ("Need to know default download path (use 'set download-path')");
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Top level support for Mac interface to GDB, the GNU debugger.
|
||||
Copyright 1994 Free Software Foundation, Inc.
|
||||
Copyright 1994, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support. Written by Stan Shebs.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -926,7 +926,7 @@ filename_completion_function (char *text, char *name)
|
||||
char *
|
||||
tilde_expand (char *str)
|
||||
{
|
||||
return strsave (str);
|
||||
return xstrdup (str);
|
||||
}
|
||||
|
||||
/* Modified versions of standard I/O. */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
|
||||
|
||||
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
|
||||
1997, 1998, 1999, 2000, Free Software Foundation, Inc.
|
||||
1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
|
||||
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
|
||||
@ -3331,7 +3331,7 @@ mips_set_processor_type_command (char *args, int from_tty)
|
||||
printf_unfiltered ("%s\n", mips_processor_type_table[i].name);
|
||||
|
||||
/* Restore the value. */
|
||||
tmp_mips_processor_type = strsave (mips_processor_type);
|
||||
tmp_mips_processor_type = xstrdup (mips_processor_type);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -3340,7 +3340,7 @@ mips_set_processor_type_command (char *args, int from_tty)
|
||||
{
|
||||
error ("Unknown processor type `%s'.", tmp_mips_processor_type);
|
||||
/* Restore its value. */
|
||||
tmp_mips_processor_type = strsave (mips_processor_type);
|
||||
tmp_mips_processor_type = xstrdup (mips_processor_type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4610,8 +4610,8 @@ Set this to be able to access processor-type-specific registers.\n\
|
||||
c = add_show_from_set (c, &showlist);
|
||||
c->function.cfunc = mips_show_processor_type_command;
|
||||
|
||||
tmp_mips_processor_type = strsave (DEFAULT_MIPS_TYPE);
|
||||
mips_set_processor_type_command (strsave (DEFAULT_MIPS_TYPE), 0);
|
||||
tmp_mips_processor_type = xstrdup (DEFAULT_MIPS_TYPE);
|
||||
mips_set_processor_type_command (xstrdup (DEFAULT_MIPS_TYPE), 0);
|
||||
#endif
|
||||
|
||||
/* We really would like to have both "0" and "unlimited" work, but
|
||||
|
@ -755,7 +755,7 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
|
||||
|
||||
if (dev_name)
|
||||
xfree (dev_name);
|
||||
dev_name = strsave (args);
|
||||
dev_name = xstrdup (args);
|
||||
|
||||
monitor_desc = SERIAL_OPEN (dev_name);
|
||||
|
||||
|
@ -1530,7 +1530,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
|
||||
nomem (0);
|
||||
make_cleanup_freeargv (argv);
|
||||
|
||||
serial_port_name = strsave (argv[0]);
|
||||
serial_port_name = xstrdup (argv[0]);
|
||||
if (argv[1]) /* remote TFTP name specified? */
|
||||
{
|
||||
remote_name = argv[1];
|
||||
@ -1586,8 +1586,8 @@ device is attached to the target board (e.g., /dev/ttya).\n"
|
||||
local_name++; /* skip over the colon */
|
||||
if (local_name == NULL)
|
||||
local_name = remote_name; /* local name same as remote name */
|
||||
tftp_name = strsave (remote_name);
|
||||
tftp_localname = strsave (local_name);
|
||||
tftp_name = xstrdup (remote_name);
|
||||
tftp_localname = xstrdup (local_name);
|
||||
tftp_in_use = 1;
|
||||
}
|
||||
}
|
||||
@ -1597,7 +1597,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
|
||||
|
||||
/* Reset the expected monitor prompt if it's never been set before. */
|
||||
if (mips_monitor_prompt == NULL)
|
||||
mips_monitor_prompt = strsave (new_monitor_prompt);
|
||||
mips_monitor_prompt = xstrdup (new_monitor_prompt);
|
||||
mips_monitor = new_monitor;
|
||||
|
||||
mips_initialize ();
|
||||
@ -1613,7 +1613,7 @@ device is attached to the target board (e.g., /dev/ttya).\n"
|
||||
/* Try to figure out the processor model if possible. */
|
||||
ptype = mips_read_processor_type ();
|
||||
if (ptype)
|
||||
mips_set_processor_type_command (strsave (ptype), 0);
|
||||
mips_set_processor_type_command (xstrdup (ptype), 0);
|
||||
|
||||
/* This is really the job of start_remote however, that makes an assumption
|
||||
that the target is about to print out a status message of some sort. That
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* Generic serial interface routines
|
||||
Copyright 1992, 1993, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Copyright 1992, 1993, 1996, 1997, 1999, 2000, 2001 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -213,7 +215,7 @@ serial_open (const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scb->name = strsave (name);
|
||||
scb->name = xstrdup (name);
|
||||
scb->next = scb_base;
|
||||
scb->refcnt = 1;
|
||||
scb->debug_p = 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Remote target glue for the Hitachi SH-3 ROM monitor.
|
||||
Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
Copyright 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -249,7 +249,7 @@ sh3_open (char *args, int from_tty)
|
||||
|
||||
if (args)
|
||||
{
|
||||
char *cursor = serial_port_name = strsave (args);
|
||||
char *cursor = serial_port_name = xstrdup (args);
|
||||
|
||||
while (*cursor && *cursor != ' ')
|
||||
cursor++;
|
||||
@ -289,7 +289,7 @@ sh3e_open (char *args, int from_tty)
|
||||
|
||||
if (args)
|
||||
{
|
||||
char *cursor = serial_port_name = strsave (args);
|
||||
char *cursor = serial_port_name = xstrdup (args);
|
||||
|
||||
while (*cursor && *cursor != ' ')
|
||||
cursor++;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Handle shared libraries for GDB, the GNU Debugger.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -143,7 +143,7 @@ solib_open (char *in_pathname, char **found_pathname)
|
||||
/* Done. If not found, tough luck. Return found_file and
|
||||
(optionally) found_pathname. */
|
||||
if (found_pathname != NULL && temp_pathname != NULL)
|
||||
*found_pathname = strsave (temp_pathname);
|
||||
*found_pathname = xstrdup (temp_pathname);
|
||||
return found_file;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* List lines of source files for GDB, the GNU debugger.
|
||||
Copyright 1986-1989, 1991-1999 Free Software Foundation, Inc.
|
||||
Copyright 1986-1989, 1991-1999, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -255,7 +255,7 @@ init_source_path (void)
|
||||
char buf[20];
|
||||
|
||||
sprintf (buf, "$cdir%c$cwd", DIRNAME_SEPARATOR);
|
||||
source_path = strsave (buf);
|
||||
source_path = xstrdup (buf);
|
||||
forget_cached_source_info ();
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ mod_path (char *dirname, char **which_path)
|
||||
if (dirname == 0)
|
||||
return;
|
||||
|
||||
dirname = strsave (dirname);
|
||||
dirname = xstrdup (dirname);
|
||||
make_cleanup (xfree, dirname);
|
||||
|
||||
do
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Target dependent code for the Fujitsu SPARClite for GDB, the GNU debugger.
|
||||
Copyright 1994, 1995, 1996, 1999 Free Software Foundation, Inc.
|
||||
Copyright 1994, 1995, 1996, 1999, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -413,7 +413,7 @@ sparclite_open (char *name, int from_tty)
|
||||
if (remote_target_name)
|
||||
xfree (remote_target_name);
|
||||
|
||||
remote_target_name = strsave (name);
|
||||
remote_target_name = xstrdup (name);
|
||||
|
||||
/* We need a 'serial' or 'udp' keyword to disambiguate host:port, which can
|
||||
mean either a serial port on a terminal server, or the IP address of a
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic symbol file reading for the GNU debugger, GDB.
|
||||
Copyright 1990-1996, 1998, 2000 Free Software Foundation, Inc.
|
||||
Copyright 1990-1996, 1998, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support, using pieces from other GDB modules.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -1786,7 +1786,7 @@ add_filename_language (char *ext, enum language lang)
|
||||
fl_table_size);
|
||||
}
|
||||
|
||||
filename_language_table[fl_table_next].ext = strsave (ext);
|
||||
filename_language_table[fl_table_next].ext = xstrdup (ext);
|
||||
filename_language_table[fl_table_next].lang = lang;
|
||||
fl_table_next++;
|
||||
}
|
||||
@ -1845,7 +1845,7 @@ set_ext_lang_command (char *args, int from_tty)
|
||||
/* ext_args, language_str (lang)); */
|
||||
|
||||
xfree (filename_language_table[i].ext);
|
||||
filename_language_table[i].ext = strsave (ext_args);
|
||||
filename_language_table[i].ext = xstrdup (ext_args);
|
||||
filename_language_table[i].lang = lang;
|
||||
}
|
||||
}
|
||||
|
11
gdb/utils.c
11
gdb/utils.c
@ -1,5 +1,5 @@
|
||||
/* General utility routines for GDB, the GNU debugger.
|
||||
Copyright 1986, 1989, 1990-1992, 1995, 1996, 1998, 2000
|
||||
Copyright 1986, 1989, 1990-1992, 1995, 1996, 1998, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
@ -1162,15 +1162,6 @@ msavestring (void *md, const char *ptr, int size)
|
||||
return p;
|
||||
}
|
||||
|
||||
/* The "const" is so it compiles under DGUX (which prototypes strsave
|
||||
in <string.h>. FIXME: This should be named "xstrsave", shouldn't it?
|
||||
Doesn't real strsave return NULL if out of memory? */
|
||||
char *
|
||||
strsave (const char *ptr)
|
||||
{
|
||||
return savestring (ptr, strlen (ptr));
|
||||
}
|
||||
|
||||
char *
|
||||
mstrsave (void *md, const char *ptr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user