aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-02-27 14:30:08 +0000
committerPedro Alves <palves@redhat.com>2014-02-27 14:30:08 +0000
commitd632a0971cf9c8044e2b59da45ba6bbc27714c84 (patch)
treec25bc84fafba4b81ff1704912fe19529503dbcef /gdb
parent2ebd5a35208e40dab7df46c7d6d58f4d614c6e21 (diff)
downloadgdb-d632a0971cf9c8044e2b59da45ba6bbc27714c84.zip
gdb-d632a0971cf9c8044e2b59da45ba6bbc27714c84.tar.gz
gdb-d632a0971cf9c8044e2b59da45ba6bbc27714c84.tar.bz2
Move linux-nat.c:status_to_str to nat/linux-waitpid.c.
So that gdbserver's Linux backend can use it too. gdb/ 2014-02-27 Pedro Alves <palves@redhat.com> PR 12702 * linux-nat.c (status_to_str): Moved to nat/linux-waitpid.c. * nat/linux-waitpid.c: Include string.h. (status_to_str): Moved here and made extern. * nat/linux-waitpid.h (status_to_str): New declaration.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/linux-nat.c25
-rw-r--r--gdb/nat/linux-waitpid.c28
-rw-r--r--gdb/nat/linux-waitpid.h4
4 files changed, 40 insertions, 25 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ad08c8e..bb5f5aa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2014-02-27 Pedro Alves <palves@redhat.com>
+
+ PR 12702
+ * linux-nat.c (status_to_str): Moved to nat/linux-waitpid.c.
+ * nat/linux-waitpid.c: Include string.h.
+ (status_to_str): Moved here and made extern.
+ * nat/linux-waitpid.h (status_to_str): New declaration.
+
2014-02-27 Hui Zhu <hui@codesourcery.com>
PR 12702
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 0066141..5535462 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -848,31 +848,6 @@ static int linux_thread_alive (ptid_t ptid);
static char *linux_child_pid_to_exec_file (struct target_ops *self, int pid);
-/* Convert wait status STATUS to a string. Used for printing debug
- messages only. */
-
-static char *
-status_to_str (int status)
-{
- static char buf[64];
-
- if (WIFSTOPPED (status))
- {
- if (WSTOPSIG (status) == SYSCALL_SIGTRAP)
- snprintf (buf, sizeof (buf), "%s (stopped at syscall)",
- strsignal (SIGTRAP));
- else
- snprintf (buf, sizeof (buf), "%s (stopped)",
- strsignal (WSTOPSIG (status)));
- }
- else if (WIFSIGNALED (status))
- snprintf (buf, sizeof (buf), "%s (terminated)",
- strsignal (WTERMSIG (status)));
- else
- snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
-
- return buf;
-}
/* Destroy and free LP. */
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index 433efe7..e9e69db 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -28,6 +28,8 @@
#include "nat/linux-waitpid.h"
#include "gdb_wait.h"
+#include <string.h>
+
/* Print debugging output based on the format string FORMAT and
its parameters. */
@@ -47,6 +49,32 @@ linux_debug (const char *format, ...)
#endif
}
+/* Convert wait status STATUS to a string. Used for printing debug
+ messages only. */
+
+char *
+status_to_str (int status)
+{
+ static char buf[64];
+
+ if (WIFSTOPPED (status))
+ {
+ if (WSTOPSIG (status) == SYSCALL_SIGTRAP)
+ snprintf (buf, sizeof (buf), "%s (stopped at syscall)",
+ strsignal (SIGTRAP));
+ else
+ snprintf (buf, sizeof (buf), "%s (stopped)",
+ strsignal (WSTOPSIG (status)));
+ }
+ else if (WIFSIGNALED (status))
+ snprintf (buf, sizeof (buf), "%s (terminated)",
+ strsignal (WTERMSIG (status)));
+ else
+ snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
+
+ return buf;
+}
+
/* Wrapper function for waitpid which handles EINTR, and emulates
__WALL for systems where that is not available. */
diff --git a/gdb/nat/linux-waitpid.h b/gdb/nat/linux-waitpid.h
index ae90e50..cac38db 100644
--- a/gdb/nat/linux-waitpid.h
+++ b/gdb/nat/linux-waitpid.h
@@ -24,4 +24,8 @@
__WALL for systems where that is not available. */
extern int my_waitpid (int pid, int *status, int flags);
+/* Convert wait status STATUS to a string. Used for printing debug
+ messages only. */
+extern char *status_to_str (int status);
+
#endif /* LINUX_WAITPID_H */