From 701b4372e1a13208ccea12b9ed5b3e3deb7ef158 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 26 Aug 2009 00:02:05 -0700 Subject: [PATCH] AMD64 - Fix minor issues. * Stop kgdb from looping forever if it comes across a bad address during the thread scan. * livkvm prints the correct address for the invalid address message instead of truncating it to 32 bits. --- gnu/usr.bin/gdb/kgdb/kthr.c | 7 +++++-- lib/libkvm/kvm_amd64.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gnu/usr.bin/gdb/kgdb/kthr.c b/gnu/usr.bin/gdb/kgdb/kthr.c index f1f2520d0b..e0db928c11 100644 --- a/gnu/usr.bin/gdb/kgdb/kthr.c +++ b/gnu/usr.bin/gdb/kgdb/kthr.c @@ -119,8 +119,11 @@ kgdb_thr_init(void) addr = (uintptr_t)TAILQ_FIRST(&gd.mi.gd_tdallq); while (addr != 0) { - if (kvm_read(kvm, addr, &td, sizeof(td)) != sizeof(td)) - warnx("kvm_read: %s", kvm_geterr(kvm)); + if (kvm_read(kvm, addr, &td, sizeof(td)) != sizeof(td)) { + warnx("kvm_read: %s, while accessing thread", + kvm_geterr(kvm)); + break; + } kt = malloc(sizeof(*kt)); kt->next = first; kt->kaddr = addr; diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index 33e73f1cc6..be28db154f 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -226,7 +226,7 @@ _kvm_vatop(kvm_t *kd, u_long va, u_long *pa) return (PAGE_SIZE - offset); invalid: - _kvm_err(kd, 0, "invalid address (%x)", va); + _kvm_err(kd, 0, "invalid address (%jx)", (intmax_t)va); return (0); } -- 2.41.0