Rebase to FSF GDB 7.4.50.20120602.
- [testsuite] BuildRequire gcc-go. - Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763). - Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651). - Use librpm.so.3 for rpm-4.10.0 in Fedora 18. - Revert recent breakage of UNIX objfiles order for symbols lookup.
This commit is contained in:
parent
0c6cb6731e
commit
f8eee05550
75 changed files with 5799 additions and 22034 deletions
|
|
@ -37,53 +37,60 @@ gdb/gdbserver/
|
|||
(linux_create_inferior, linux_tracefork_child): Call it instead of
|
||||
direct ptrace.
|
||||
|
||||
--- a/gdb/common/linux-ptrace.c
|
||||
+++ b/gdb/common/linux-ptrace.c
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "linux-ptrace.h"
|
||||
Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.c
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.c 2012-03-13 16:02:23.000000000 +0100
|
||||
+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.c 2012-06-02 20:37:53.933828570 +0200
|
||||
@@ -27,6 +27,10 @@
|
||||
#include "linux-procfs.h"
|
||||
#include "buffer.h"
|
||||
|
||||
+#ifdef HAVE_SELINUX_SELINUX_H
|
||||
+# include <selinux/selinux.h>
|
||||
+#endif /* HAVE_SELINUX_SELINUX_H */
|
||||
+
|
||||
/* Print all possible reasons we could fail to attach PID. */
|
||||
|
||||
void
|
||||
@@ -41,4 +45,21 @@ linux_ptrace_attach_warnings (pid_t pid)
|
||||
if (linux_proc_pid_is_zombie (pid))
|
||||
warning (_("process %d is a zombie - the process has already terminated"),
|
||||
(int) pid);
|
||||
/* Find all possible reasons we could fail to attach PID and append these
|
||||
newline terminated reason strings to initialized BUFFER. '\0' termination
|
||||
of BUFFER must be done by the caller. */
|
||||
@@ -46,4 +50,22 @@ linux_ptrace_attach_warnings (pid_t pid,
|
||||
buffer_xml_printf (buffer, _("warning: process %d is a zombie "
|
||||
"- the process has already terminated\n"),
|
||||
(int) pid);
|
||||
+
|
||||
+ linux_ptrace_create_warnings ();
|
||||
+ linux_ptrace_create_warnings (buffer);
|
||||
+}
|
||||
+
|
||||
+/* Print all possible reasons we could fail to create a traced process. */
|
||||
+
|
||||
+void
|
||||
+linux_ptrace_create_warnings (void)
|
||||
+linux_ptrace_create_warnings (struct buffer *buffer)
|
||||
+{
|
||||
+#ifdef HAVE_LIBSELINUX
|
||||
+ /* -1 is returned for errors, 0 if it has no effect, 1 if PTRACE_ATTACH is
|
||||
+ forbidden. */
|
||||
+ if (security_get_boolean_active ("deny_ptrace") == 1)
|
||||
+ warning (_("the SELinux boolean 'deny_ptrace' is enabled, "
|
||||
+ "you can disable this process attach protection by: "
|
||||
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
|
||||
+ buffer_xml_printf (buffer,
|
||||
+ _("the SELinux boolean 'deny_ptrace' is enabled, "
|
||||
+ "you can disable this process attach protection by: "
|
||||
+ "(gdb) shell sudo setsebool deny_ptrace=0"));
|
||||
+#endif /* HAVE_LIBSELINUX */
|
||||
}
|
||||
--- a/gdb/common/linux-ptrace.h
|
||||
+++ b/gdb/common/linux-ptrace.h
|
||||
@@ -66,5 +66,6 @@
|
||||
Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.h
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.h 2012-03-13 16:02:23.000000000 +0100
|
||||
+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.h 2012-06-02 20:37:46.565831956 +0200
|
||||
@@ -68,5 +68,6 @@ struct buffer;
|
||||
#endif
|
||||
|
||||
extern void linux_ptrace_attach_warnings (pid_t pid);
|
||||
+extern void linux_ptrace_create_warnings (void);
|
||||
extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer);
|
||||
+extern void linux_ptrace_create_warnings (struct buffer *buffer);
|
||||
|
||||
#endif /* COMMON_LINUX_PTRACE_H */
|
||||
--- a/gdb/configure.ac
|
||||
+++ b/gdb/configure.ac
|
||||
@@ -1748,6 +1748,10 @@ then
|
||||
Index: gdb-7.4.50.20120602/gdb/configure.ac
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/configure.ac 2012-06-02 20:05:08.000000000 +0200
|
||||
+++ gdb-7.4.50.20120602/gdb/configure.ac 2012-06-02 20:35:06.379798726 +0200
|
||||
@@ -2002,6 +2002,10 @@ then
|
||||
[Define if you support the personality syscall.])
|
||||
fi
|
||||
|
||||
|
|
@ -94,9 +101,11 @@ gdb/gdbserver/
|
|||
dnl Handle optional features that can be enabled.
|
||||
|
||||
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
|
||||
--- a/gdb/gdbserver/configure.ac
|
||||
+++ b/gdb/gdbserver/configure.ac
|
||||
@@ -411,6 +411,10 @@ if $want_ipa ; then
|
||||
Index: gdb-7.4.50.20120602/gdb/gdbserver/configure.ac
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200
|
||||
+++ gdb-7.4.50.20120602/gdb/gdbserver/configure.ac 2012-06-02 20:35:06.408797663 +0200
|
||||
@@ -438,6 +438,10 @@ if $want_ipa ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
@ -107,9 +116,11 @@ gdb/gdbserver/
|
|||
AC_SUBST(GDBSERVER_DEPFILES)
|
||||
AC_SUBST(GDBSERVER_LIBS)
|
||||
AC_SUBST(USE_THREAD_DB)
|
||||
--- a/gdb/gdbserver/linux-low.c
|
||||
+++ b/gdb/gdbserver/linux-low.c
|
||||
@@ -550,6 +550,25 @@ add_lwp (ptid_t ptid)
|
||||
Index: gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/gdbserver/linux-low.c 2012-05-30 21:51:38.000000000 +0200
|
||||
+++ gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c 2012-06-02 20:39:49.886785355 +0200
|
||||
@@ -601,6 +601,28 @@ add_lwp (ptid_t ptid)
|
||||
return lwp;
|
||||
}
|
||||
|
||||
|
|
@ -119,15 +130,18 @@ gdb/gdbserver/
|
|||
+linux_traceme (const char *program)
|
||||
+{
|
||||
+ int save_errno;
|
||||
+ struct buffer buffer;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ if (ptrace (PTRACE_TRACEME, 0, NULL, NULL) == 0)
|
||||
+ return;
|
||||
+
|
||||
+ save_errno = errno;
|
||||
+ linux_ptrace_create_warnings ();
|
||||
+ fprintf (stderr, _("Cannot trace created process %s: %s.\n"), program,
|
||||
+ strerror (save_errno));
|
||||
+ buffer_init (&buffer);
|
||||
+ linux_ptrace_create_warnings (&buffer);
|
||||
+ buffer_grow_str0 (&buffer, "");
|
||||
+ fprintf (stderr, _("%sCannot trace created process %s: %s.\n"),
|
||||
+ buffer_finish (&buffer), program, strerror (save_errno));
|
||||
+ fflush (stderr);
|
||||
+ _exit (0177);
|
||||
+}
|
||||
|
|
@ -135,7 +149,7 @@ gdb/gdbserver/
|
|||
/* Start an inferior process and returns its pid.
|
||||
ALLARGS is a vector of program-name and args. */
|
||||
|
||||
@@ -590,7 +609,7 @@ linux_create_inferior (char *program, char **allargs)
|
||||
@@ -641,7 +663,7 @@ linux_create_inferior (char *program, ch
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
|
|
@ -144,7 +158,7 @@ gdb/gdbserver/
|
|||
|
||||
#ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */
|
||||
signal (__SIGRTMIN + 1, SIG_DFL);
|
||||
@@ -4386,7 +4405,7 @@ linux_tracefork_grandchild (void *arg)
|
||||
@@ -4567,7 +4589,7 @@ linux_tracefork_grandchild (void *arg)
|
||||
static int
|
||||
linux_tracefork_child (void *arg)
|
||||
{
|
||||
|
|
@ -153,8 +167,10 @@ gdb/gdbserver/
|
|||
kill (getpid (), SIGSTOP);
|
||||
|
||||
#if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
|
||||
--- a/gdb/inf-ptrace.c
|
||||
+++ b/gdb/inf-ptrace.c
|
||||
Index: gdb-7.4.50.20120602/gdb/inf-ptrace.c
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/inf-ptrace.c 2012-05-24 18:51:34.000000000 +0200
|
||||
+++ gdb-7.4.50.20120602/gdb/inf-ptrace.c 2012-06-02 20:35:06.428797311 +0200
|
||||
@@ -105,7 +105,15 @@ static void
|
||||
inf_ptrace_me (void)
|
||||
{
|
||||
|
|
@ -171,9 +187,11 @@ gdb/gdbserver/
|
|||
}
|
||||
|
||||
/* Start a new inferior Unix child process. EXEC_FILE is the file to
|
||||
--- a/gdb/linux-nat.c
|
||||
+++ b/gdb/linux-nat.c
|
||||
@@ -1570,6 +1570,7 @@ linux_nat_create_inferior (struct target_ops *ops,
|
||||
Index: gdb-7.4.50.20120602/gdb/linux-nat.c
|
||||
===================================================================
|
||||
--- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:01:38.000000000 +0200
|
||||
+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:41:18.101751186 +0200
|
||||
@@ -1572,6 +1572,7 @@ linux_nat_create_inferior (struct target
|
||||
#ifdef HAVE_PERSONALITY
|
||||
int personality_orig = 0, personality_set = 0;
|
||||
#endif /* HAVE_PERSONALITY */
|
||||
|
|
@ -181,7 +199,7 @@ gdb/gdbserver/
|
|||
|
||||
/* The fork_child mechanism is synchronous and calls target_wait, so
|
||||
we have to mask the async mode. */
|
||||
@@ -1594,7 +1595,10 @@ linux_nat_create_inferior (struct target_ops *ops,
|
||||
@@ -1596,7 +1597,10 @@ linux_nat_create_inferior (struct target
|
||||
/* Make sure we report all signals during startup. */
|
||||
linux_nat_pass_signals (0, NULL);
|
||||
|
||||
|
|
@ -193,17 +211,28 @@ gdb/gdbserver/
|
|||
|
||||
#ifdef HAVE_PERSONALITY
|
||||
if (personality_set)
|
||||
@@ -1606,6 +1610,12 @@ linux_nat_create_inferior (struct target_ops *ops,
|
||||
@@ -1608,6 +1612,24 @@ linux_nat_create_inferior (struct target
|
||||
safe_strerror (errno));
|
||||
}
|
||||
#endif /* HAVE_PERSONALITY */
|
||||
+
|
||||
+ if (ex.reason < 0)
|
||||
+ {
|
||||
+ linux_ptrace_create_warnings ();
|
||||
+ throw_exception (ex);
|
||||
+ struct buffer buffer;
|
||||
+ char *message, *buffer_s;
|
||||
+
|
||||
+ message = xstrdup (ex.message);
|
||||
+ make_cleanup (xfree, message);
|
||||
+
|
||||
+ buffer_init (&buffer);
|
||||
+ linux_ptrace_create_warnings (&buffer);
|
||||
+
|
||||
+ buffer_grow_str0 (&buffer, "");
|
||||
+ buffer_s = buffer_finish (&buffer);
|
||||
+ make_cleanup (xfree, buffer_s);
|
||||
+
|
||||
+ throw_error (ex.error, "%s%s", buffer_s, message);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue