[0/4] Various build fixes for NetBSD

Message ID 20170719105938.GB24855@SDF.ORG
State New, archived
Headers

Commit Message

coypu July 19, 2017, 10:59 a.m. UTC
  On Sat, Jul 15, 2017 at 10:20:17AM -0700, John Baldwin wrote:
> I have build tested this in a NetBSD/amd64 7.1 VM.  The KVM target
> built for me, but I have not tested it.  The debug registers changes
> in NetBSD are newer than 7.1 so I was not able to build test those.
> 
> coypu, can you please test this on your end and verify the debug
> registers work on NetBSD/i386 or NetBSD/amd64?  Can you also do some
> simple testing of the KVM target on amd64?

I had trouble with just those patches and had to make some changes.
_KMEMUSER needs to be defined before all includes

I also needed this change for dbregs (they would not work on 7.x I
guess)





KVM target did not work. it claims it's not supported, but it might be
misuse on my part:

(gdb) target kvm /dev/kmem
Undefined target command: "kvm /dev/kmem".  Try "help target".

it's how I would use it on netbsd's variant of gdb.

I don't know how to use debug registers, I'll ask around for more details.

I've only tested amd64. I'll try to do more architectures later.
thanks for your effort.
  

Comments

John Baldwin July 19, 2017, 9:45 p.m. UTC | #1
On Wednesday, July 19, 2017 10:59:38 AM coypu@sdf.org wrote:
> On Sat, Jul 15, 2017 at 10:20:17AM -0700, John Baldwin wrote:
> > I have build tested this in a NetBSD/amd64 7.1 VM.  The KVM target
> > built for me, but I have not tested it.  The debug registers changes
> > in NetBSD are newer than 7.1 so I was not able to build test those.
> > 
> > coypu, can you please test this on your end and verify the debug
> > registers work on NetBSD/i386 or NetBSD/amd64?  Can you also do some
> > simple testing of the KVM target on amd64?
> 
> I had trouble with just those patches and had to make some changes.
> _KMEMUSER needs to be defined before all includes

Ok.  Just in bsd-kvm.c, yes?

> I also needed this change for dbregs (they would not work on 7.x I
> guess)
> 
> diff --git a/gdb/configure.nat b/gdb/configure.nat
> index d649c29f..db021a09 100644
> --- a/gdb/configure.nat
> +++ b/gdb/configure.nat
> @@ -339,7 +339,7 @@ case ${gdb_host} in
>             i386)
>                 # Host: NetBSD/amd64
>                 NATDEPFILES="${NATDEPFILES} nbsd-nat.o amd64-nat.o \
> -               x86-bsd-nat.o amd64-bsd-nat.o amd64-nbsd-nat.o bsd-kvm.o x86-dregs.o"
> +               x86-bsd-nat.o amd64-bsd-nat.o x86-nat.o amd64-nbsd-nat.o bsd-kvm.o x86-dregs.o"
>                 LOADLIBES='-lkvm'
>                 ;;
>             sparc)

Probably need this for NetBSD/i386 as well then.

> KVM target did not work. it claims it's not supported, but it might be
> misuse on my part:
> 
> (gdb) target kvm /dev/kmem
> Undefined target command: "kvm /dev/kmem".  Try "help target".
> 
> it's how I would use it on netbsd's variant of gdb.

I looked again and amd64-nbsd-nat.c doesn't have the 'supply_pcb' hook that
bsd-kvm.c requires, so I will drop the patch that enables kvm on NetBSD/amd64.

> I don't know how to use debug registers, I'll ask around for more details.

Just set a watch point.  GDB will report it as being set as a hardware watchpoint
in the CLI (and also via info watch).

> I've only tested amd64. I'll try to do more architectures later.
> thanks for your effort.
  

Patch

diff --git a/gdb/configure.nat b/gdb/configure.nat
index d649c29f..db021a09 100644
--- a/gdb/configure.nat
+++ b/gdb/configure.nat
@@ -339,7 +339,7 @@  case ${gdb_host} in
            i386)
                # Host: NetBSD/amd64
                NATDEPFILES="${NATDEPFILES} nbsd-nat.o amd64-nat.o \
-               x86-bsd-nat.o amd64-bsd-nat.o amd64-nbsd-nat.o bsd-kvm.o x86-dregs.o"
+               x86-bsd-nat.o amd64-bsd-nat.o x86-nat.o amd64-nbsd-nat.o bsd-kvm.o x86-dregs.o"
                LOADLIBES='-lkvm'
                ;;
            sparc)