This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/5] constify to_save_record
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 25 Apr 2013 11:24:54 -0600
- Subject: [PATCH 1/5] constify to_save_record
I have a branch where, inspired by Keith and Pedro, I've been working
to constify the CLI. The basic idea is that a command should not
modify the argument it is passed, and the API should reflect this.
As you can imagine this is a very big effort. So, I'm planning to
send various small bits of constification infrastructure first. These
are generally obvious, I think; and though not very useful in
isolation, they enable the bigger constification efforts later.
This one constifies to_save_record and target_save_record.
* gcore.c (create_gcore_bfd): Make 'filename' const.
* gcore.h (create_gcore_bfd): Make 'filename' const.
* record-full.c (record_full_save): Make 'recfilename' const.
* target.c (target_save_record): Make 'filename' const.
* target.h (struct target_ops) <to_save_record>: Make 'filename'
const.
(target_save_record): Likewise.
---
gdb/gcore.c | 2 +-
gdb/gcore.h | 2 +-
gdb/record-full.c | 4 ++--
gdb/target.c | 2 +-
gdb/target.h | 4 ++--
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gdb/gcore.c b/gdb/gcore.c
index 24732e9..e34fc89 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -49,7 +49,7 @@ static int gcore_memory_sections (bfd *);
Open a new bfd core file for output, and return the handle. */
bfd *
-create_gcore_bfd (char *filename)
+create_gcore_bfd (const char *filename)
{
bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ());
diff --git a/gdb/gcore.h b/gdb/gcore.h
index 8d2e8b6..0f67a1e 100644
--- a/gdb/gcore.h
+++ b/gdb/gcore.h
@@ -20,7 +20,7 @@
#if !defined (GCORE_H)
#define GCORE_H 1
-extern bfd *create_gcore_bfd (char *filename);
+extern bfd *create_gcore_bfd (const char *filename);
extern void write_gcore_file (bfd *obfd);
extern bfd *load_corefile (char *filename, int from_tty);
diff --git a/gdb/record-full.c b/gdb/record-full.c
index aa3ad85..3a8d326 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -251,7 +251,7 @@ static void
static void record_full_goto_insn (struct record_full_entry *entry,
enum exec_direction_kind dir);
-static void record_full_save (char *recfilename);
+static void record_full_save (const char *recfilename);
/* Alloc and free functions for record_full_reg, record_full_mem, and
record_full_end entries. */
@@ -2632,7 +2632,7 @@ record_full_save_cleanups (void *data)
format, with an extra section for our data. */
static void
-record_full_save (char *recfilename)
+record_full_save (const char *recfilename)
{
struct record_full_entry *cur_record_full_list;
uint32_t magic;
diff --git a/gdb/target.c b/gdb/target.c
index 8f8e46a..8eadd63 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -4296,7 +4296,7 @@ target_info_record (void)
/* See target.h. */
void
-target_save_record (char *filename)
+target_save_record (const char *filename)
{
struct target_ops *t;
diff --git a/gdb/target.h b/gdb/target.h
index 319fcc3..54cbf99 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -890,7 +890,7 @@ struct target_ops
void (*to_info_record) (void);
/* Save the recorded execution trace into a file. */
- void (*to_save_record) (char *filename);
+ void (*to_save_record) (const char *filename);
/* Delete the recorded execution trace from the current position onwards. */
void (*to_delete_record) (void);
@@ -2006,7 +2006,7 @@ extern void target_stop_recording (void);
extern void target_info_record (void);
/* See to_save_record in struct target_ops. */
-extern void target_save_record (char *filename);
+extern void target_save_record (const char *filename);
/* Query if the target supports deleting the execution log. */
extern int target_supports_delete_record (void);
--
1.8.1.4