Banish hard-coded KERNBASE references from savecore. Dynamically
adjust to whatever kernbase is in the kernel that we are dumping.
This commit is contained in:
parent
fd131b1483
commit
241ca2287a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82265
@ -70,7 +70,7 @@ static const char rcsid[] =
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
#define ok(number) ((number) - KERNBASE)
|
||||
#define ok(number) ((number) - kernbase)
|
||||
#endif
|
||||
|
||||
struct nlist current_nl[] = { /* Namelist for currently running system. */
|
||||
@ -86,6 +86,8 @@ struct nlist current_nl[] = { /* Namelist for currently running system. */
|
||||
{ "_panicstr" },
|
||||
#define X_DUMPMAG 5
|
||||
{ "_dumpmag" },
|
||||
#define X_KERNBASE 6
|
||||
{ "_kernbase" },
|
||||
{ "" },
|
||||
};
|
||||
int cursyms[] = { X_DUMPLO, X_VERSION, X_DUMPMAG, -1 };
|
||||
@ -98,6 +100,7 @@ struct nlist dump_nl[] = { /* Name list for dumped system. */
|
||||
{ "_version" },
|
||||
{ "_panicstr" },
|
||||
{ "_dumpmag" },
|
||||
{ "_kernbase" },
|
||||
{ "" },
|
||||
};
|
||||
|
||||
@ -118,6 +121,10 @@ char panic_mesg[1024]; /* panic message */
|
||||
int panicstr; /* flag: dump was caused by panic */
|
||||
char vers[1024]; /* version of kernel that crashed */
|
||||
|
||||
#ifdef __i386__
|
||||
u_long kernbase; /* offset of kvm to core file */
|
||||
#endif
|
||||
|
||||
int clear, compress, force, verbose; /* flags */
|
||||
int keep; /* keep dump on device */
|
||||
|
||||
@ -251,6 +258,13 @@ kmem_setup()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
if (dump_nl[X_KERNBASE].n_value != 0)
|
||||
kernbase = dump_nl[X_KERNBASE].n_value;
|
||||
else
|
||||
kernbase = KERNBASE;
|
||||
#endif
|
||||
|
||||
len = sizeof dumpdev;
|
||||
if (sysctlbyname("kern.dumpdev", &dumpdev, &len, NULL, 0) == -1) {
|
||||
syslog(LOG_ERR, "sysctl: kern.dumpdev: %m");
|
||||
|
Loading…
Reference in New Issue
Block a user