diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-10-25 14:33:55 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-10-25 14:33:55 -0400 |
commit | 61d7f128e6ea37af805be4e365f5879b0d42bb93 (patch) | |
tree | c581803312ce6dcb9b37ef348c37367090ea293e /gdbserver/server.cc | |
parent | b3a9fe6f51fd3922ce7978b6ba5ce0cbdf33885e (diff) | |
download | gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.zip gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.tar.gz gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.tar.bz2 |
gdbserver: make target_pid_to_str return std::string
I wanted to write a warning that included two target_pid_to_str calls,
like this:
warning (_("Blabla %s, blabla %s"),
target_pid_to_str (ptid1),
target_pid_to_str (ptid2));
This doesn't work, because target_pid_to_str stores its result in a
static buffer, so my message would show twice the same ptid. Change
target_pid_to_str to return an std::string to avoid this. I don't think
we save much by using a static buffer, but it is more error-prone.
Change-Id: Ie3f649627686b84930529cc5c7c691ccf5d36dc2
Diffstat (limited to 'gdbserver/server.cc')
-rw-r--r-- | gdbserver/server.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 2cb378c..c58f7e0 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -3310,7 +3310,7 @@ queue_stop_reply_callback (thread_info *thread) = target_waitstatus_to_string (&thread->last_status); debug_printf ("Reporting thread %s as already stopped with %s\n", - target_pid_to_str (thread->id), + target_pid_to_str (thread->id).c_str (), status_string.c_str ()); } @@ -4640,7 +4640,7 @@ handle_target_event (int err, gdb_client_data client_data) debug_printf ("GDB not connected; forwarding event %d for" " [%s]\n", (int) cs.last_status.kind (), - target_pid_to_str (cs.last_ptid)); + target_pid_to_str (cs.last_ptid).c_str ()); if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED) signal = cs.last_status.sig (); |