aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote-m32r-sdi.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-03-27 14:14:26 -0600
committerTom Tromey <tromey@redhat.com>2014-06-26 09:14:14 -0600
commit9cbe5fff2b47da85dbc628bdc8c6a85d5344749a (patch)
treea3ee9c16f6b4726d51239c62f40793a810baf0c8 /gdb/remote-m32r-sdi.c
parent34a68019ccc3879801a291a00bad5bc10558bf5d (diff)
downloadgdb-9cbe5fff2b47da85dbc628bdc8c6a85d5344749a.zip
gdb-9cbe5fff2b47da85dbc628bdc8c6a85d5344749a.tar.gz
gdb-9cbe5fff2b47da85dbc628bdc8c6a85d5344749a.tar.bz2
constify to_load
This makes the argument to the target_ops to_load method "const", and fixes up the fallout. Tested by rebuilding all the affected files. 2014-06-26 Tom Tromey <tromey@redhat.com> * defs.h (generic_load): Update. * m32r-rom.c (m32r_load_gen): Make "filename" const. * monitor.c (monitor_load): Make "args" const. * remote-m32r-sdi.c (m32r_load): Make "args" const. * remote-mips.c (mips_load_srec, pmon_load_fast): Make "args" const. (mips_load): Make "file" const. * remote-sim.c (gdbsim_load): Make "args" const. * remote.c (remote_load): Make "name" const. * symfile.c (generic_load): Make "args" const. * target-delegates.c: Rebuild. * target.c (target_load): Make "arg" const. (debug_to_load): Make "args" const. * target.h (struct target_ops) <to_load>: Make parameter const. (target_load): Update.
Diffstat (limited to 'gdb/remote-m32r-sdi.c')
-rw-r--r--gdb/remote-m32r-sdi.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 9c57171..37efaec 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1238,9 +1238,9 @@ m32r_remove_breakpoint (struct target_ops *ops,
}
static void
-m32r_load (struct target_ops *self, char *args, int from_tty)
+m32r_load (struct target_ops *self, const char *args, int from_tty)
{
- struct cleanup *old_chain;
+ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
asection *section;
bfd *pbfd;
bfd_vma entry;
@@ -1258,17 +1258,11 @@ m32r_load (struct target_ops *self, char *args, int from_tty)
while (*args != '\000')
{
- char *arg;
+ char *arg = extract_arg_const (&args);
- args = skip_spaces (args);
-
- arg = args;
-
- while ((*args != '\000') && !isspace (*args))
- args++;
-
- if (*args != '\000')
- *args++ = '\000';
+ if (arg == NULL)
+ break;
+ make_cleanup (xfree, arg);
if (*arg != '-')
filename = arg;
@@ -1285,11 +1279,8 @@ m32r_load (struct target_ops *self, char *args, int from_tty)
pbfd = gdb_bfd_open (filename, gnutarget, -1);
if (pbfd == NULL)
- {
- perror_with_name (filename);
- return;
- }
- old_chain = make_cleanup_bfd_unref (pbfd);
+ perror_with_name (filename);
+ make_cleanup_bfd_unref (pbfd);
if (!bfd_check_format (pbfd, bfd_object))
error (_("\"%s\" is not an object file: %s"), filename,