aboutsummaryrefslogtreecommitdiff
path: root/gdb/inferior.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-06-25 21:57:56 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-07-23 15:38:54 -0400
commit90cc31c9e59a75122c2371fdf43f53d91e6ad5d6 (patch)
treee8cd9164ce1dd466ab94de2040f5d8172c3b84bc /gdb/inferior.h
parente51695253e5594ea7fda3c52aa9126ee4f9e9fc2 (diff)
downloadfsf-binutils-gdb-90cc31c9e59a75122c2371fdf43f53d91e6ad5d6.zip
fsf-binutils-gdb-90cc31c9e59a75122c2371fdf43f53d91e6ad5d6.tar.gz
fsf-binutils-gdb-90cc31c9e59a75122c2371fdf43f53d91e6ad5d6.tar.bz2
gdb: add setter/getter for inferior cwd
Add cwd/set_cwd to the inferior class, remove set_inferior_args. Keep get_inferior_args, because it is used from fork_inferior, in shared code. The cwd could eventually be passed as a parameter eventually, though, I think that would be cleaner. Change-Id: Ifb72ea865d7e6f9a491308f0d5c1595579d8427e
Diffstat (limited to 'gdb/inferior.h')
-rw-r--r--gdb/inferior.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 445b566..fb57df7 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -466,6 +466,25 @@ public:
return m_args.get ();
}
+ /* Set the inferior current working directory.
+
+ If CWD is NULL, unset the directory. */
+ void set_cwd (const char *cwd)
+ {
+ if (cwd == NULL)
+ m_cwd.reset ();
+ else
+ m_cwd.reset (xstrdup (cwd));
+ }
+
+ /* Get the inferior current working directory.
+
+ Return nullptr if the current working directory is not specified. */
+ const char *cwd () const
+ {
+ return m_cwd.get ();
+ }
+
/* Convenient handle (GDB inferior id). Unique across all
inferiors. */
int num = 0;
@@ -495,10 +514,6 @@ public:
/* The program space bound to this inferior. */
struct program_space *pspace = NULL;
- /* The current working directory that will be used when starting
- this inferior. */
- gdb::unique_xmalloc_ptr<char> cwd;
-
/* The terminal state as set by the last target_terminal::terminal_*
call. */
target_terminal_state terminal_state = target_terminal_state::is_ours;
@@ -591,6 +606,10 @@ private:
This is nullptr when there are not args. */
gdb::unique_xmalloc_ptr<char> m_args;
+
+ /* The current working directory that will be used when starting
+ this inferior. */
+ gdb::unique_xmalloc_ptr<char> m_cwd;
};
/* Keep a registry of per-inferior data-pointers required by other GDB