summaryrefslogtreecommitdiff
path: root/gdbserver/target.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-10-25 14:33:55 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-10-25 14:33:55 -0400
commit61d7f128e6ea37af805be4e365f5879b0d42bb93 (patch)
treec581803312ce6dcb9b37ef348c37367090ea293e /gdbserver/target.h
parentb3a9fe6f51fd3922ce7978b6ba5ce0cbdf33885e (diff)
downloadbinutils-gdb-61d7f128e6ea37af805be4e365f5879b0d42bb93.tar.gz
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/target.h')
-rw-r--r--gdbserver/target.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 2c4393ec8c6..6c863c84666 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -702,6 +702,6 @@ int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);
int set_desired_thread ();
-const char *target_pid_to_str (ptid_t);
+std::string target_pid_to_str (ptid_t);
#endif /* GDBSERVER_TARGET_H */