Dynamically adapt to kernbase changes on crashdumps, falling back to

KERNBASE if the "kernbase" symbol is not present on older kernels.
This commit is contained in:
Peter Wemm 2001-08-24 09:12:04 +00:00
parent f85f304006
commit fd131b1483
2 changed files with 38 additions and 2 deletions

View File

@ -449,7 +449,25 @@ xfer_umem (memaddr, myaddr, len, write)
return n;
}
#define KERNOFF ((unsigned)KERNBASE)
static CORE_ADDR
ksym_kernbase()
{
static CORE_ADDR kernbase;
struct minimal_symbol *sym;
if (kernbase == 0)
{
sym = lookup_minimal_symbol ("kernbase", NULL, NULL);
if (sym == NULL) {
kernbase = KERNBASE;
} else {
kernbase = SYMBOL_VALUE_ADDRESS (sym);
}
}
return kernbase;
}
#define KERNOFF (ksym_kernbase())
#define INKERNEL(x) ((x) >= KERNOFF)
static CORE_ADDR sbr;

View File

@ -449,7 +449,25 @@ xfer_umem (memaddr, myaddr, len, write)
return n;
}
#define KERNOFF ((unsigned)KERNBASE)
static CORE_ADDR
ksym_kernbase()
{
static CORE_ADDR kernbase;
struct minimal_symbol *sym;
if (kernbase == 0)
{
sym = lookup_minimal_symbol ("kernbase", NULL, NULL);
if (sym == NULL) {
kernbase = KERNBASE;
} else {
kernbase = SYMBOL_VALUE_ADDRESS (sym);
}
}
return kernbase;
}
#define KERNOFF (ksym_kernbase())
#define INKERNEL(x) ((x) >= KERNOFF)
static CORE_ADDR sbr;