diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-05-29 03:28:46 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-05-29 03:28:46 +0000 |
commit | ec236415c2913111858b014c71682bfae1db83e1 (patch) | |
tree | 9bde07b9dfbf6d7203a4e3b552120c9e66ef64c7 /sys/ddb | |
parent | 47fbf830fdaea6d0c3f97d0122948ab9b5cce3a6 (diff) |
futher support for kernfs......
Diffstat (limited to 'sys/ddb')
-rw-r--r-- | sys/ddb/db_aout.c | 64 | ||||
-rw-r--r-- | sys/ddb/db_extern.h | 4 | ||||
-rw-r--r-- | sys/ddb/db_sym.c | 24 | ||||
-rw-r--r-- | sys/ddb/db_sym.h | 4 |
4 files changed, 85 insertions, 11 deletions
diff --git a/sys/ddb/db_aout.c b/sys/ddb/db_aout.c index 706136de845..de7ec32ba5a 100644 --- a/sys/ddb/db_aout.c +++ b/sys/ddb/db_aout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_aout.c,v 1.15 1997/02/07 08:32:15 mickey Exp $ */ +/* $OpenBSD: db_aout.c,v 1.16 1997/05/29 03:28:43 mickey Exp $ */ /* $NetBSD: db_aout.c,v 1.14 1996/02/27 20:54:43 gwr Exp $ */ /* @@ -31,7 +31,9 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> -#include <sys/exec_aout.h> +#include <sys/exec.h> +#include <sys/conf.h> +#include <sys/lkm.h> #include <machine/db_machdep.h> /* data types */ @@ -359,10 +361,60 @@ X_db_stub_xh(sym, xh) { extern char kernel_text[]; - bzero(xh, sizeof(*xh)); - xh->a_midmag = htonl((((0 << 10) | MID_ZERO) << 16) | ZMAGIC); - xh->a_syms = *sym->private; - xh->a_entry = (u_long)kernel_text; + bcopy(kernel_text, xh, sizeof(*xh)); + xh->a_syms = *(int *)sym->private; + xh->a_data = 0; + if (sym->id != 0) { /* lkm */ + struct lkm_table *p; + for (p = lkm_list(NULL); + p != NULL && p->sym_id != sym->id; p = lkm_list(p)) + ; + if (p != NULL) { + xh->a_entry = (u_long)p->entry; + xh->a_syms = p->sym_symsize; + } +#ifdef DIAGNOSTIC + else + printf("X_db_stub_xh: no lkm for symtab (ghost?)\n"); +#endif + } +} + +int +X_db_symtablen(sym) + db_symtab_t sym; +{ + return sym->rend - sym->start; +} + +int +X_db_symatoff(sym, off, buf, len) + db_symtab_t sym; + int off; + void *buf; + int *len; +{ + /* symtab */ + if (off < (sym->end - sym->start)) { + struct nlist n; + + bcopy (&((struct nlist *)sym->start)[off / sizeof(n)], + &n, sizeof(n)); + n.n_un.n_strx = n.n_un.n_name - sym->end; + *len = min(*len, sizeof(n) - off % sizeof(n)); + bcopy ((u_int8_t*)&n + off % sizeof(n), buf, *len); + } else { + /* strtab */ + off -= sym->end - sym->start; + if (off < (sym->rend - sym->end)) { + /* no preprocessing for string table */ + *len = min(*len, (sym->rend - sym->end - off)); + bcopy(sym->end + off, buf, *len); + } else + return -1; + } + + return 0; } /* diff --git a/sys/ddb/db_extern.h b/sys/ddb/db_extern.h index e690d76cf7f..145f6254e8d 100644 --- a/sys/ddb/db_extern.h +++ b/sys/ddb/db_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_extern.h,v 1.7 1997/02/07 06:18:46 mickey Exp $ */ +/* $OpenBSD: db_extern.h,v 1.8 1997/05/29 03:28:44 mickey Exp $ */ /* $NetBSD: db_extern.h,v 1.1 1996/02/05 01:57:00 christos Exp $ */ /* @@ -46,6 +46,8 @@ boolean_t X_db_line_at_pc __P((db_symtab_t, db_sym_t, char **, int X_db_sym_numargs __P((db_symtab_t, db_sym_t, int *, char **)); struct exec; void X_db_stub_xh __P((db_symtab_t, struct exec *)); +int X_db_symtablen __P((db_symtab_t)); +int X_db_symatoff __P((db_symtab_t, int, void*, int*)); void ddb_init __P((void)); /* db_examine.c */ diff --git a/sys/ddb/db_sym.c b/sys/ddb/db_sym.c index ae119ac978a..d39bd76ea14 100644 --- a/sys/ddb/db_sym.c +++ b/sys/ddb/db_sym.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_sym.c,v 1.18 1997/02/07 07:03:40 mickey Exp $ */ +/* $OpenBSD: db_sym.c,v 1.19 1997/05/29 03:28:44 mickey Exp $ */ /* $NetBSD: db_sym.c,v 1.12 1996/02/05 01:57:15 christos Exp $ */ /* @@ -82,7 +82,7 @@ db_add_symbol_table(start, end, name, ref, rend) new->id = db_nsymtabs; TAILQ_INSERT_TAIL(&db_symtabs, new, list); - return ++db_nsymtabs; + return db_nsymtabs++; } /* @@ -170,6 +170,7 @@ db_eqname(src, dst, c) return (FALSE); } +#ifdef DDB boolean_t db_value_of_name(name, valuep) char *name; @@ -184,7 +185,6 @@ db_value_of_name(name, valuep) return (TRUE); } - /* * Lookup a symbol. * If the symbol has a qualifier (e.g., ux:vm_map), @@ -234,6 +234,7 @@ db_lookup(symstr) return sp; } +#endif /* * Does this symbol name appear in more than one symbol table? @@ -399,3 +400,20 @@ db_stub_xh(sym, xh) { X_db_stub_xh(sym, xh); } + +int +db_symtablen(sym) + db_symtab_t sym; +{ + return X_db_symtablen(sym); +} + +int +db_symatoff(sym, off, buf, len) + db_symtab_t sym; + int off; + void *buf; + int *len; +{ + return X_db_symatoff(sym, off, buf, len); +} diff --git a/sys/ddb/db_sym.h b/sys/ddb/db_sym.h index 0a12e4e518b..a1dc5c0548f 100644 --- a/sys/ddb/db_sym.h +++ b/sys/ddb/db_sym.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_sym.h,v 1.10 1997/02/07 07:03:41 mickey Exp $ */ +/* $OpenBSD: db_sym.h,v 1.11 1997/05/29 03:28:45 mickey Exp $ */ /* $NetBSD: db_sym.h,v 1.7 1996/02/05 01:57:16 christos Exp $ */ /* @@ -124,6 +124,8 @@ boolean_t db_line_at_pc __P((db_sym_t, char **, int *, db_expr_t)); int db_sym_numargs __P((db_sym_t, int *, char **)); struct exec; void db_stub_xh __P((db_symtab_t, struct exec *)); +int db_symtablen __P((db_symtab_t)); +int db_symatoff __P((db_symtab_t, int, void*, int*)); /* db_hangman.c */ void db_hangman __P((db_expr_t, int, db_expr_t, char *)); |