tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: savecore: default to -N /dev/ksyms?



On Thu, Feb 12, 2009 at 03:11:47PM -0500, Thor Simon wrote:
> It seems to me that these days /dev/ksyms is more likely to be present
> and working than /netbsd is to be a source of kernel symbols.
> 
> I'd like to change savecore's default source of kernel symbols, for that
> reason.

I'm going to check in the following patch and request a pullup, if nobody
has a persuasive objection in the near term (see also misc/38425):

Index: sbin/savecore/savecore.c
===================================================================
RCS file: /cvsroot/src/sbin/savecore/savecore.c,v
retrieving revision 1.76
diff -u -r1.76 savecore.c
--- sbin/savecore/savecore.c    20 Oct 2008 10:34:54 -0000      1.76
+++ sbin/savecore/savecore.c    20 Mar 2009 16:09:56 -0000
@@ -229,7 +229,11 @@
                dirname = argv[0];
 
        if (kernel == NULL) {
-               kernel = getbootfile();
+               if (access(_PATH_KSYMS, R_OK) == 0) {
+                       kernel = _PATH_KSYMS;
+               } else {
+                       kernel = getbootfile();
+               }
        }
 
        (void)time(&now);
Index: lib/libkvm/kvm.c
===================================================================
RCS file: /cvsroot/src/lib/libkvm/kvm.c,v
retrieving revision 1.92
diff -u -r1.92 kvm.c
--- lib/libkvm/kvm.c    15 Jan 2008 14:16:30 -0000      1.92
+++ lib/libkvm/kvm.c    20 Mar 2009 16:09:57 -0000
@@ -288,6 +288,10 @@
 
        ufgiven = (uf != NULL);
        if (!ufgiven) {
+               if (access(_PATH_KSYMS, R_OK) == 0) {
+                       uf = _PATH_KSYMS;
+                       goto got_symfile;
+               }
 #ifdef CPU_BOOTED_KERNEL
                /* 130 is 128 + '/' + '\0' */
                static char booted_kernel[130];
@@ -315,6 +319,7 @@
                _kvm_err(kd, kd->program, "exec file name too long");
                goto failed;
        }
+got_symfile:
        if (flag & ~O_RDWR) {
                _kvm_err(kd, kd->program, "bad flags arg");
                goto failed;



Home | Main Index | Thread Index | Old Index