constify to_open

This makes target_ops::to_open take a const string and then fixes the
fallout.

There were a few of these I could not build.  However I eyeballed it
and in any case the fixes should generally be trivial.

This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command

2014-07-30  Tom Tromey  <tromey@redhat.com>

	* bsd-kvm.c (bsd_kvm_open): Constify.
	* corelow.c (core_open): Constify.
	* ctf.c (ctf_open): Constify.
	* dbug-rom.c (dbug_open): Constify.
	* exec.c (exec_open): Constify.
	* m32r-rom.c (m32r_open, mon2000_open): Constify.
	* microblaze-rom.c (picobug_open): Constify.
	* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
	Constify.
	* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
	* record-btrace.c (record_btrace_open): Constify.
	* record-full.c (record_full_core_open_1, record_full_open_1)
	(record_full_open): Constify.
	* remote-m32r-sdi.c (m32r_open): Constify.
	* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
	(rockhopper_open, lsi_open): Constify.
	* remote-sim.c (gdbsim_open): Constify.
	* remote.c (remote_open, extended_remote_open, remote_open_1):
	Constify.
	* target.h (struct target_ops) <to_open>: Make "arg" const.
	* tracefile-tfile.c (tfile_open): Constify.
This commit is contained in:
Tom Tromey
2014-07-22 10:56:01 -06:00
parent e799154c3b
commit 014f9477f4
20 changed files with 68 additions and 61 deletions

View File

@@ -84,8 +84,6 @@ static struct core_fns *sniff_core_bfd (bfd *);
static int gdb_check_format (bfd *);
static void core_open (char *, int);
static void core_close (struct target_ops *self);
static void core_close_cleanup (void *ignore);
@@ -275,7 +273,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
/* This routine opens and sets up the core file bfd. */
static void
core_open (char *filename, int from_tty)
core_open (const char *arg, int from_tty)
{
const char *p;
int siggy;
@@ -285,9 +283,10 @@ core_open (char *filename, int from_tty)
int scratch_chan;
int flags;
volatile struct gdb_exception except;
char *filename;
target_preopen (from_tty);
if (!filename)
if (!arg)
{
if (core_bfd)
error (_("No core file specified. (Use `detach' "
@@ -296,7 +295,7 @@ core_open (char *filename, int from_tty)
error (_("No core file specified."));
}
filename = tilde_expand (filename);
filename = tilde_expand (arg);
if (!IS_ABSOLUTE_PATH (filename))
{
temp = concat (current_directory, "/",