aboutsummaryrefslogtreecommitdiff
path: root/gdb/inferior.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-06-25 18:07:54 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-07-23 15:38:54 -0400
commit11bd012ed256688f43d71dcc531c2f105a9c55dd (patch)
treeeeff398be94163b59fc0f261615449bd9dbeaeb1 /gdb/inferior.h
parentfd2dec2a45a73154d9824071ebb8664a39a69174 (diff)
downloadgdb-11bd012ed256688f43d71dcc531c2f105a9c55dd.zip
gdb-11bd012ed256688f43d71dcc531c2f105a9c55dd.tar.gz
gdb-11bd012ed256688f43d71dcc531c2f105a9c55dd.tar.bz2
gdb: make inferior::m_cwd an std::string
Same idea as the previous patch, but for m_cwd. To keep things consistent across the board, change get_inferior_cwd as well, which is shared with GDBserver. So update the related GDBserver code too. Change-Id: Ia2c047fda738d45f3d18bc999eb67ceb8400ce4e
Diffstat (limited to 'gdb/inferior.h')
-rw-r--r--gdb/inferior.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 72f2c29..5cd36f4 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -460,21 +460,19 @@ public:
/* Set the inferior current working directory.
- If CWD is NULL, unset the directory. */
- void set_cwd (const char *cwd)
+ If CWD is empty, unset the directory. */
+ void set_cwd (std::string cwd)
{
- if (cwd == NULL)
- m_cwd.reset ();
- else
- m_cwd.reset (xstrdup (cwd));
+ m_cwd = std::move (cwd);
}
/* Get the inferior current working directory.
- Return nullptr if the current working directory is not specified. */
- const char *cwd () const
+ Return an empty string if the current working directory is not
+ specified. */
+ const std::string &cwd () const
{
- return m_cwd.get ();
+ return m_cwd;
}
/* Convenient handle (GDB inferior id). Unique across all
@@ -599,7 +597,7 @@ private:
/* The current working directory that will be used when starting
this inferior. */
- gdb::unique_xmalloc_ptr<char> m_cwd;
+ std::string m_cwd;
};
/* Keep a registry of per-inferior data-pointers required by other GDB