diff mbox

[v2,1/2] Define _KMEMUSER before including BSD kernel headers.

Message ID 20170725165051.9132-2-jhb@FreeBSD.org
State New
Headers show

Commit Message

John Baldwin July 25, 2017, 4:50 p.m. UTC
Recent versions of NetBSD hide certain kernel structures needed by the
KVM target from userland unless this macro is defined.

gdb/ChangeLog:

	* bsd-kvm.o: Define _KMEMUSER.
	* configure.ac: Define _KMEMUSER when checking for "struct lwp".
	* configure: Regenerate.
---
 gdb/ChangeLog    | 6 ++++++
 gdb/bsd-kvm.c    | 1 +
 gdb/configure    | 1 +
 gdb/configure.ac | 1 +
 4 files changed, 9 insertions(+)
diff mbox

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b3f9c7b061..e06712d645 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2017-07-25  John Baldwin  <jhb@FreeBSD.org>
 
+	* bsd-kvm.o: Define _KMEMUSER.
+	* configure.ac: Define _KMEMUSER when checking for "struct lwp".
+	* configure: Regenerate.
+
+2017-07-25  John Baldwin  <jhb@FreeBSD.org>
+
 	* configure.nat: Add "-lkvm" for NetBSD/sparc64 and fix typo.
 
 2017-07-25  Yao Qi  <yao.qi@linaro.org>
diff --git a/gdb/bsd-kvm.c b/gdb/bsd-kvm.c
index 98e242836d..8c2139462d 100644
--- a/gdb/bsd-kvm.c
+++ b/gdb/bsd-kvm.c
@@ -17,6 +17,7 @@ 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#define _KMEMUSER
 #include "defs.h"
 #include "cli/cli-cmds.h"
 #include "command.h"
diff --git a/gdb/configure b/gdb/configure
index 755e3dccf1..c7746fc60f 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -13571,6 +13571,7 @@  else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/param.h>
+#define _KMEMUSER
 #include <sys/lwp.h>
 int
 main ()
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 10d2d10b12..b4d7a87701 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1434,6 +1434,7 @@  AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
 # See if <sys/lwp.h> defines `struct lwp`.
 AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
 [AC_TRY_COMPILE([#include <sys/param.h>
+#define _KMEMUSER
 #include <sys/lwp.h>], [struct lwp l;],
 gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
 if test $gdb_cv_struct_lwp = yes; then