aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat/linux-ptrace.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-01-17 12:33:57 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2018-01-17 12:34:50 -0500
commit4d9b86e17505063c96a01d40cdf5b4fc2080a798 (patch)
treee345594b4540d2b6a7cfa773eb972d17507731cd /gdb/nat/linux-ptrace.h
parenta7b2d0fbeb4ca22ffbf56d19d06b7d1cb774e383 (diff)
downloadfsf-binutils-gdb-4d9b86e17505063c96a01d40cdf5b4fc2080a798.zip
fsf-binutils-gdb-4d9b86e17505063c96a01d40cdf5b4fc2080a798.tar.gz
fsf-binutils-gdb-4d9b86e17505063c96a01d40cdf5b4fc2080a798.tar.bz2
Make linux_ptrace_attach_fail_reason return an std::string
This patch makes linux_ptrace_attach_fail_reason and linux_ptrace_attach_fail_reason_string return std::string. It also replaces usages of struct buffer with std::string. This allows getting rid of a cleanup in in linux_ptrace_attach_fail_reason_string and simplifies the code in general. Something that looks odd to me is that in linux_ptrace_attach_fail_reason, if the two messages are appended, there is no separating space or \n, so the result won't be very nice. I left it as-is for now though. gdb/ChangeLog: * nat/linux-ptrace.h (linux_ptrace_attach_fail_reason): Return std::string. (linux_ptrace_attach_fail_reason_string): Likewise. * nat/linux-ptrace.c (linux_ptrace_attach_fail_reason): Likewise. (linux_ptrace_attach_fail_reason_string): Likewise. * linux-nat.c (attach_proc_task_lwp_callback): Adjust. gdb/gdbserver/ChangeLog: * linux-low.c (attach_proc_task_lwp_callback): Adjust to linux_ptrace_attach_fail_reason_string now returning an std::string. (linux_attach): Likewise. * thread-db.c (attach_thread): Likewise.
Diffstat (limited to 'gdb/nat/linux-ptrace.h')
-rw-r--r--gdb/nat/linux-ptrace.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
index 1f960ed..60967a3 100644
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -180,14 +180,12 @@ struct buffer;
# define TRAP_HWBKPT 4
#endif
-extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer);
+extern std::string linux_ptrace_attach_fail_reason (pid_t pid);
/* Find all possible reasons we could have failed to attach to PTID
and return them as a string. ERR is the error PTRACE_ATTACH failed
- with (an errno). The result is stored in a static buffer. This
- string should be copied into a buffer by the client if the string
- will not be immediately used, or if it must persist. */
-extern char *linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
+ with (an errno). */
+extern std::string linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
extern void linux_ptrace_init_warnings (void);
extern void linux_check_ptrace_features (void);