Constify target_ops::follow_exec
authorTom Tromey <tromey@adacore.com>
Wed, 22 May 2019 19:41:28 +0000 (15:41 -0400)
committerTom Tromey <tromey@adacore.com>
Wed, 22 May 2019 19:41:28 +0000 (15:41 -0400)
I noticed that target_ops::follow_exec took a "char *" parameter,
where "const char *" would be more correct.  This patch changes this
(and related functions) to be constified.

Tested by rebuilding.

gdb/ChangeLog
2019-05-22  Tom Tromey  <tromey@adacore.com>

* target.c (target_follow_exec): Constify parameter.
* target-delegates.c: Rebuild.
* remote.c (remote_target::follow_exec): Constify parameter.
* infrun.c (follow_exec): Constify parameter.
* target.h (struct target_ops) <follow_exec>: Constify parameter.
(target_follow_exec): Likewise.

gdb/ChangeLog
gdb/infrun.c
gdb/remote.c
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index 34d97c826650a72f41791cfa3fa2e43ba110b8f3..87ae3721764ab18fa963845f8a17564d96f3998c 100644 (file)
@@ -1,3 +1,12 @@
+2019-05-22  Tom Tromey  <tromey@adacore.com>
+
+       * target.c (target_follow_exec): Constify parameter.
+       * target-delegates.c: Rebuild.
+       * remote.c (remote_target::follow_exec): Constify parameter.
+       * infrun.c (follow_exec): Constify parameter.
+       * target.h (struct target_ops) <follow_exec>: Constify parameter.
+       (target_follow_exec): Likewise.
+
 2019-05-22  Alan Hayward  <alan.hayward@arm.com>
 
        * aarch64-tdep.c (aarch64_execute_dwarf_cfa_vendor_op): Treat
index 37df561de0b6089a3678cc7091389652a3ff38dd..4fd92f1bac25e50401f8a85e3630e322e7b14965 100644 (file)
@@ -1078,7 +1078,7 @@ show_follow_exec_mode_string (struct ui_file *file, int from_tty,
 /* EXEC_FILE_TARGET is assumed to be non-NULL.  */
 
 static void
-follow_exec (ptid_t ptid, char *exec_file_target)
+follow_exec (ptid_t ptid, const char *exec_file_target)
 {
   struct inferior *inf = current_inferior ();
   int pid = ptid.pid ();
index dc734723d14cbfb003802df75a9873f83a8af13b..124d254478e17485829ed2948120ca4249cd19a8 100644 (file)
@@ -667,7 +667,7 @@ public:
   const struct btrace_config *btrace_conf (const struct btrace_target_info *) override;
   bool augmented_libraries_svr4_read () override;
   int follow_fork (int, int) override;
-  void follow_exec (struct inferior *, char *) override;
+  void follow_exec (struct inferior *, const char *) override;
   int insert_fork_catchpoint (int) override;
   int remove_fork_catchpoint (int) override;
   int insert_vfork_catchpoint (int) override;
@@ -5751,7 +5751,7 @@ remote_target::follow_fork (int follow_child, int detach_fork)
    follow-exec-mode is "new".  */
 
 void
-remote_target::follow_exec (struct inferior *inf, char *execd_pathname)
+remote_target::follow_exec (struct inferior *inf, const char *execd_pathname)
 {
   /* We know that this is a target file name, so if it has the "target:"
      prefix we strip it off before saving it in the program space.  */
index cfc0ce06e998a3510bf8d5d4959cc646b542b075..52034fe4360754077a0a985ffb713f7c7f95d5ae 100644 (file)
@@ -59,7 +59,7 @@ struct dummy_target : public target_ops
   int follow_fork (int arg0, int arg1) override;
   int insert_exec_catchpoint (int arg0) override;
   int remove_exec_catchpoint (int arg0) override;
-  void follow_exec (struct inferior *arg0, char *arg1) override;
+  void follow_exec (struct inferior *arg0, const char *arg1) override;
   int set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3) override;
   void mourn_inferior () override;
   void pass_signals (gdb::array_view<const unsigned char> arg0) override;
@@ -227,7 +227,7 @@ struct debug_target : public target_ops
   int follow_fork (int arg0, int arg1) override;
   int insert_exec_catchpoint (int arg0) override;
   int remove_exec_catchpoint (int arg0) override;
-  void follow_exec (struct inferior *arg0, char *arg1) override;
+  void follow_exec (struct inferior *arg0, const char *arg1) override;
   int set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3) override;
   void mourn_inferior () override;
   void pass_signals (gdb::array_view<const unsigned char> arg0) override;
@@ -1585,25 +1585,25 @@ debug_target::remove_exec_catchpoint (int arg0)
 }
 
 void
-target_ops::follow_exec (struct inferior *arg0, char *arg1)
+target_ops::follow_exec (struct inferior *arg0, const char *arg1)
 {
   this->beneath ()->follow_exec (arg0, arg1);
 }
 
 void
-dummy_target::follow_exec (struct inferior *arg0, char *arg1)
+dummy_target::follow_exec (struct inferior *arg0, const char *arg1)
 {
 }
 
 void
-debug_target::follow_exec (struct inferior *arg0, char *arg1)
+debug_target::follow_exec (struct inferior *arg0, const char *arg1)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->follow_exec (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_exec (arg0, arg1);
   fprintf_unfiltered (gdb_stdlog, "<- %s->follow_exec (", this->beneath ()->shortname ());
   target_debug_print_struct_inferior_p (arg0);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_char_p (arg1);
+  target_debug_print_const_char_p (arg1);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
index f492102b6d465c512bee6215a0fefb0d7bf7719e..752e62b022f81a895cf8672173d580d2dc4127ce 100644 (file)
@@ -2175,7 +2175,7 @@ target_follow_fork (int follow_child, int detach_fork)
 /* Target wrapper for follow exec hook.  */
 
 void
-target_follow_exec (struct inferior *inf, char *execd_pathname)
+target_follow_exec (struct inferior *inf, const char *execd_pathname)
 {
   current_top_target ()->follow_exec (inf, execd_pathname);
 }
index 9078a420018e6d72a882fd6c96a95ada3e64571f..323357ca5503cea8f32f7bd5e4403214cf4b1034 100644 (file)
@@ -622,7 +622,7 @@ struct target_ops
       TARGET_DEFAULT_RETURN (1);
     virtual int remove_exec_catchpoint (int)
       TARGET_DEFAULT_RETURN (1);
-    virtual void follow_exec (struct inferior *, char *)
+    virtual void follow_exec (struct inferior *, const char *)
       TARGET_DEFAULT_IGNORE ();
     virtual int set_syscall_catchpoint (int, bool, int,
                                        gdb::array_view<const int>)
@@ -1637,7 +1637,7 @@ int target_follow_fork (int follow_child, int detach_fork);
 /* Handle the target-specific bookkeeping required when the inferior
    makes an exec call.  INF is the exec'd inferior.  */
 
-void target_follow_exec (struct inferior *inf, char *execd_pathname);
+void target_follow_exec (struct inferior *inf, const char *execd_pathname);
 
 /* On some targets, we can catch an inferior exec event when it
    occurs.  These functions insert/remove an already-created
This page took 0.041265 seconds and 4 git commands to generate.