Made this compile (but not work). This involved mainly const poisoning
and renaming ALIGNED_POINTER() to _ALIGNED_POINTER() plus the following hacks for i386's: - define _ALIGNED_POINTER() if it is not already defined. Most non-i386 arches define it <machine/param.h> define it in <machine/param.h>, although none actually used it in the kernel. - define ksym_start and ksym_end. Most non-i386 arches still define and initialize these in machdep.c although they didn't used them. Here is a better place to define them but not to initialize them.
This commit is contained in:
parent
5cd588cb14
commit
f05c39e9d5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103358
@ -51,11 +51,16 @@
|
|||||||
|
|
||||||
#include <machine/db_machdep.h>
|
#include <machine/db_machdep.h>
|
||||||
|
|
||||||
|
#include <ddb/ddb.h>
|
||||||
#include <ddb/db_sym.h>
|
#include <ddb/db_sym.h>
|
||||||
#include <ddb/db_output.h>
|
#include <ddb/db_output.h>
|
||||||
|
|
||||||
#include <machine/elf.h>
|
#include <machine/elf.h>
|
||||||
|
|
||||||
|
#ifndef _ALIGNED_POINTER
|
||||||
|
#define _ALIGNED_POINTER(ptr, type) 1
|
||||||
|
#endif
|
||||||
|
|
||||||
static char *db_elf_find_strtab(db_symtab_t *);
|
static char *db_elf_find_strtab(db_symtab_t *);
|
||||||
|
|
||||||
#define STAB_TO_SYMSTART(stab) ((Elf_Sym *)((stab)->start))
|
#define STAB_TO_SYMSTART(stab) ((Elf_Sym *)((stab)->start))
|
||||||
@ -82,7 +87,7 @@ X_db_sym_init(symtab, esymtab, name)
|
|||||||
char *strtab_start, *strtab_end;
|
char *strtab_start, *strtab_end;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ALIGNED_POINTER(symtab, long) == 0) {
|
if (_ALIGNED_POINTER(symtab, long) == 0) {
|
||||||
printf("DDB: bad symbol table start address %p\n", symtab);
|
printf("DDB: bad symbol table start address %p\n", symtab);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,8 +169,8 @@ X_db_sym_init(symtab, esymtab, name)
|
|||||||
* Now, sanity check the symbols against the string table.
|
* Now, sanity check the symbols against the string table.
|
||||||
*/
|
*/
|
||||||
if (symtab_start == NULL || strtab_start == NULL ||
|
if (symtab_start == NULL || strtab_start == NULL ||
|
||||||
ALIGNED_POINTER(symtab_start, long) == 0 ||
|
_ALIGNED_POINTER(symtab_start, long) == 0 ||
|
||||||
ALIGNED_POINTER(strtab_start, long) == 0)
|
_ALIGNED_POINTER(strtab_start, long) == 0)
|
||||||
goto badheader;
|
goto badheader;
|
||||||
for (symp = symtab_start; symp < symtab_end; symp++)
|
for (symp = symtab_start; symp < symtab_end; symp++)
|
||||||
if (symp->st_name + strtab_start > strtab_end)
|
if (symp->st_name + strtab_start > strtab_end)
|
||||||
@ -217,7 +222,7 @@ db_elf_find_strtab(stab)
|
|||||||
/*
|
/*
|
||||||
* Lookup the symbol with the given name.
|
* Lookup the symbol with the given name.
|
||||||
*/
|
*/
|
||||||
db_sym_t
|
c_db_sym_t
|
||||||
X_db_lookup(stab, symstr)
|
X_db_lookup(stab, symstr)
|
||||||
db_symtab_t *stab;
|
db_symtab_t *stab;
|
||||||
const char *symstr;
|
const char *symstr;
|
||||||
@ -245,7 +250,7 @@ X_db_lookup(stab, symstr)
|
|||||||
* Search for the symbol with the given address (matching within the
|
* Search for the symbol with the given address (matching within the
|
||||||
* provided threshold).
|
* provided threshold).
|
||||||
*/
|
*/
|
||||||
db_sym_t
|
c_db_sym_t
|
||||||
X_db_search_symbol(symtab, off, strategy, diffp)
|
X_db_search_symbol(symtab, off, strategy, diffp)
|
||||||
db_symtab_t *symtab;
|
db_symtab_t *symtab;
|
||||||
db_addr_t off;
|
db_addr_t off;
|
||||||
@ -311,11 +316,11 @@ X_db_search_symbol(symtab, off, strategy, diffp)
|
|||||||
void
|
void
|
||||||
X_db_symbol_values(symtab, sym, namep, valuep)
|
X_db_symbol_values(symtab, sym, namep, valuep)
|
||||||
db_symtab_t *symtab;
|
db_symtab_t *symtab;
|
||||||
db_sym_t sym;
|
c_db_sym_t sym;
|
||||||
const char **namep;
|
const char **namep;
|
||||||
db_expr_t *valuep;
|
db_expr_t *valuep;
|
||||||
{
|
{
|
||||||
Elf_Sym *symp = (Elf_Sym *)sym;
|
const Elf_Sym *symp = (const Elf_Sym *)sym;
|
||||||
char *strtab;
|
char *strtab;
|
||||||
|
|
||||||
if (namep) {
|
if (namep) {
|
||||||
@ -337,7 +342,7 @@ X_db_symbol_values(symtab, sym, namep, valuep)
|
|||||||
boolean_t
|
boolean_t
|
||||||
X_db_line_at_pc(symtab, cursym, filename, linenum, off)
|
X_db_line_at_pc(symtab, cursym, filename, linenum, off)
|
||||||
db_symtab_t *symtab;
|
db_symtab_t *symtab;
|
||||||
db_sym_t cursym;
|
c_db_sym_t cursym;
|
||||||
char **filename;
|
char **filename;
|
||||||
int *linenum;
|
int *linenum;
|
||||||
db_expr_t off;
|
db_expr_t off;
|
||||||
@ -370,7 +375,12 @@ X_db_sym_numargs(symtab, cursym, nargp, argnamep)
|
|||||||
/*
|
/*
|
||||||
* Initialization routine for Elf files.
|
* Initialization routine for Elf files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
void *ksym_start, *ksym_end;
|
||||||
|
#else
|
||||||
extern void *ksym_start, *ksym_end;
|
extern void *ksym_start, *ksym_end;
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
kdb_init(void)
|
kdb_init(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user