aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
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/remote.c
parentfd2dec2a45a73154d9824071ebb8664a39a69174 (diff)
downloadfsf-binutils-gdb-11bd012ed256688f43d71dcc531c2f105a9c55dd.zip
fsf-binutils-gdb-11bd012ed256688f43d71dcc531c2f105a9c55dd.tar.gz
fsf-binutils-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/remote.c')
-rw-r--r--gdb/remote.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index dc3948b..552481f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10391,13 +10391,14 @@ remote_target::extended_remote_set_inferior_cwd ()
{
if (packet_support (PACKET_QSetWorkingDir) != PACKET_DISABLE)
{
- const char *inferior_cwd = current_inferior ()->cwd ();
+ const std::string &inferior_cwd = current_inferior ()->cwd ();
remote_state *rs = get_remote_state ();
- if (inferior_cwd != NULL)
+ if (!inferior_cwd.empty ())
{
- std::string hexpath = bin2hex ((const gdb_byte *) inferior_cwd,
- strlen (inferior_cwd));
+ std::string hexpath
+ = bin2hex ((const gdb_byte *) inferior_cwd.data (),
+ inferior_cwd.size ());
xsnprintf (rs->buf.data (), get_remote_packet_size (),
"QSetWorkingDir:%s", hexpath.c_str ());