diff options
author | simokawa <simokawa@FreeBSD.org> | 2003-10-29 14:02:16 +0000 |
---|---|---|
committer | simokawa <simokawa@FreeBSD.org> | 2003-10-29 14:02:16 +0000 |
commit | 883f5b44508dcc09274e230ccb9114ace66a40cd (patch) | |
tree | e128b338a447ef6ab175c84a45ad27e4fc72b644 /lib/libkvm | |
parent | bba7295376b2141ebdef24d4c7d958c4b5a4d4a7 (diff) | |
download | FreeBSD-src-883f5b44508dcc09274e230ccb9114ace66a40cd.zip FreeBSD-src-883f5b44508dcc09274e230ccb9114ace66a40cd.tar.gz |
Allow to specify a character special device as a core file.
This enable us to use /dev/fwmem* as a core file.
e.g.
ps -M /dev/fwmem0.0 -N kernel.debug
dmesg -M /dev/fwmem0.0 -N kernel.debug
gdb -k -c /dev/fwmem0.0 kernel.debug
You need to set target EUI64 in hw.firewire.fwmem.eui64_hi/lo before
opening the device. On the target arch, (PCI) bus address must be
equivalent to physical address.
(We cannot use this for sparc64 because of IOMMU.)
No objection in: -audit
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index dfce727..8f9c5b3 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -192,11 +192,8 @@ _kvm_open(kd, uf, mf, flag, errout) */ if (strcmp(mf, _PATH_DEVNULL) == 0) { kd->vmfd = open(_PATH_DEVNULL, O_RDONLY); - } else if (strcmp(mf, _PATH_MEM) != 0) { - _kvm_err(kd, kd->program, - "%s: not physical memory device", mf); - goto failed; - } else { + return (kd); + } else if (strcmp(mf, _PATH_MEM) == 0) { if ((kd->vmfd = open(_PATH_KMEM, flag)) < 0) { _kvm_syserr(kd, kd->program, "%s", _PATH_KMEM); goto failed; @@ -205,24 +202,24 @@ _kvm_open(kd, uf, mf, flag, errout) _kvm_syserr(kd, kd->program, "%s", _PATH_KMEM); goto failed; } + return (kd); } - } else { - /* - * This is a crash dump. - * Initialize the virtual address translation machinery, - * but first setup the namelist fd. - */ - if ((kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { - _kvm_syserr(kd, kd->program, "%s", uf); - goto failed; - } - if (fcntl(kd->nlfd, F_SETFD, FD_CLOEXEC) < 0) { - _kvm_syserr(kd, kd->program, "%s", uf); - goto failed; - } - if (_kvm_initvtop(kd) < 0) - goto failed; } + /* + * This is a crash dump. + * Initialize the virtual address translation machinery, + * but first setup the namelist fd. + */ + if ((kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { + _kvm_syserr(kd, kd->program, "%s", uf); + goto failed; + } + if (fcntl(kd->nlfd, F_SETFD, FD_CLOEXEC) < 0) { + _kvm_syserr(kd, kd->program, "%s", uf); + goto failed; + } + if (_kvm_initvtop(kd) < 0) + goto failed; return (kd); failed: /* |