aboutsummaryrefslogtreecommitdiff
path: root/gdb/inferior.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-05-18 22:02:47 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-07-23 15:38:54 -0400
commite51695253e5594ea7fda3c52aa9126ee4f9e9fc2 (patch)
treee5b3aaef55d3f3f35c132f135c844587141c0a9e /gdb/inferior.h
parenta69e37dc2b1dbb84a1ba924532cbaede648b69e8 (diff)
downloadbinutils-e51695253e5594ea7fda3c52aa9126ee4f9e9fc2.zip
binutils-e51695253e5594ea7fda3c52aa9126ee4f9e9fc2.tar.gz
binutils-e51695253e5594ea7fda3c52aa9126ee4f9e9fc2.tar.bz2
gdb: add setter/getter for inferior arguments
Add args/set_args to the inferior class, remove the set_inferior_args and get_inferior_args functions, that would just be wrappers around them. Change-Id: If87d52f3402ce08be26c32897ae8915d9f6d1ea3
Diffstat (limited to 'gdb/inferior.h')
-rw-r--r--gdb/inferior.h36
1 files changed, 29 insertions, 7 deletions
diff --git a/gdb/inferior.h b/gdb/inferior.h
index feb3686..445b566 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -204,10 +204,6 @@ extern void post_create_inferior (int from_tty);
extern void attach_command (const char *, int);
-extern const char *get_inferior_args (void);
-
-extern void set_inferior_args (const char *);
-
extern void set_inferior_args_vector (int, char **);
extern void registers_info (const char *, int);
@@ -446,6 +442,30 @@ public:
void set_tty (const char *terminal_name);
const char *tty ();
+ /* Set the argument string to use when running this inferior.
+
+ Either nullptr or an empty string can be used to represent "no
+ arguments". */
+ void set_args (const char *args)
+ {
+ if (args != nullptr && args[0] != '\0')
+ m_args = make_unique_xstrdup (args);
+ else
+ m_args.reset ();
+ };
+
+ /* Get the argument string to use when running this inferior.
+
+ The return value is always non-nullptr. No arguments is represented by
+ an empty string. */
+ const char *args () const
+ {
+ if (m_args == nullptr)
+ return "";
+
+ return m_args.get ();
+ }
+
/* Convenient handle (GDB inferior id). Unique across all
inferiors. */
int num = 0;
@@ -475,9 +495,6 @@ public:
/* The program space bound to this inferior. */
struct program_space *pspace = NULL;
- /* The arguments string to use when running. */
- gdb::unique_xmalloc_ptr<char> args;
-
/* The current working directory that will be used when starting
this inferior. */
gdb::unique_xmalloc_ptr<char> cwd;
@@ -569,6 +586,11 @@ private:
/* The list of continuations. */
std::list<std::function<void ()>> m_continuations;
+
+ /* The arguments string to use when running.
+
+ This is nullptr when there are not args. */
+ gdb::unique_xmalloc_ptr<char> m_args;
};
/* Keep a registry of per-inferior data-pointers required by other GDB