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.
+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
static char *linux_child_pid_to_exec_file (struct target_ops *self, int pid);
\f
-/* 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. */
#include "nat/linux-waitpid.h"
#include "gdb_wait.h"
+#include <string.h>
+
/* Print debugging output based on the format string FORMAT and
its parameters. */
#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. */
__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 */