aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog28
-rw-r--r--gdb/TODO6
-rw-r--r--gdb/arc-tdep.c12
-rw-r--r--gdb/breakpoint.c8
-rw-r--r--gdb/defs.h4
-rw-r--r--gdb/f-exp.y7
-rw-r--r--gdb/infcmd.c4
-rw-r--r--gdb/m32r-rom.c6
-rw-r--r--gdb/mac-xdep.c4
-rw-r--r--gdb/mips-tdep.c10
-rw-r--r--gdb/monitor.c2
-rw-r--r--gdb/remote-mips.c10
-rw-r--r--gdb/serial.c6
-rw-r--r--gdb/sh3-rom.c6
-rw-r--r--gdb/solib.c4
-rw-r--r--gdb/source.c6
-rw-r--r--gdb/sparcl-tdep.c4
-rw-r--r--gdb/symfile.c6
-rw-r--r--gdb/utils.c11
19 files changed, 80 insertions, 64 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 80480fc..e4ba9f6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/TODO b/gdb/TODO
index 91aea53..9f149a1 100644
--- a/gdb/TODO
+++ b/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.
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 2170ed8..701ee55 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -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,
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index a3ef479..3dea304 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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;
}
diff --git a/gdb/defs.h b/gdb/defs.h
index b5fe805..b061280 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 9e67561..049d0f5 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -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';
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index bdc120a..6f43eba 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -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);
diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c
index b283279..2dfac77 100644
--- a/gdb/m32r-rom.c
+++ b/gdb/m32r-rom.c
@@ -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')");
}
diff --git a/gdb/mac-xdep.c b/gdb/mac-xdep.c
index b2ed22b..019c8ba 100644
--- a/gdb/mac-xdep.c
+++ b/gdb/mac-xdep.c
@@ -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. */
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 17b80ca..05ba066 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -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
diff --git a/gdb/monitor.c b/gdb/monitor.c
index 90e82f3..53dbfb3 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -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);
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 2dff690..e2d431e 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -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
diff --git a/gdb/serial.c b/gdb/serial.c
index 1d25adf..0f48947 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -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;
diff --git a/gdb/sh3-rom.c b/gdb/sh3-rom.c
index 47c147b..a470488 100644
--- a/gdb/sh3-rom.c
+++ b/gdb/sh3-rom.c
@@ -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++;
diff --git a/gdb/solib.c b/gdb/solib.c
index 5f9743f..efbc1d1 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -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;
}
diff --git a/gdb/source.c b/gdb/source.c
index 95f597b..8313aee 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -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
diff --git a/gdb/sparcl-tdep.c b/gdb/sparcl-tdep.c
index 6df7e70..07b6696 100644
--- a/gdb/sparcl-tdep.c
+++ b/gdb/sparcl-tdep.c
@@ -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
diff --git a/gdb/symfile.c b/gdb/symfile.c
index abeca3c..e4bc6f6 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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;
}
}
diff --git a/gdb/utils.c b/gdb/utils.c
index 2ebe169..9cfdd3f 100644
--- a/gdb/utils.c
+++ b/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)
{