Date: Fri, 23 Jul 1999 03:13:37 +1000 From: Bruce Evans <bde@zeta.org.au> To: bde@zeta.org.au, cracauer@cons.org Cc: freebsd-current@FreeBSD.ORG Subject: Re: Using float emulator on a system with FPU? Message-ID: <199907221713.DAA03332@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>I am now able to switch "npx_exists" between npx_probe1() and >npx_attach(), which let me run with the emulator on a Pentium. > >But only from serial kgdb, since as you noted in your other message, >symbols are not available to ddb in ELF kernels started with -d. > >I assume you use kdb_init() from db_elf.c, you how do you call it >given that you neither have the symbol (not loaded yet) nor the >address (`nm /kernel` output not useful)? The boot loader passes the relevant addresses. To use this, replace ddb_kld.c by ddb_elf.c in /sys/conf/files. Bruce diff -c2 db_elf.c~ db_elf.c *** db_elf.c~ Thu Jan 28 22:05:22 1999 --- db_elf.c Sat May 8 15:58:30 1999 *************** *** 39,55 **** */ ! #if defined(__ELF__) && defined(__alpha__) #include "opt_ddb.h" - #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> - #include <sys/proc.h> ! #include <machine/db_machdep.h> #include <ddb/db_sym.h> - #include <ddb/db_output.h> #include <machine/elf.h> --- 39,53 ---- */ ! #ifdef __ELF__ #include "opt_ddb.h" #include <sys/param.h> #include <sys/systm.h> ! #include <machine/bootinfo.h> + #include <ddb/ddb.h> #include <ddb/db_sym.h> #include <machine/elf.h> *************** *** 81,88 **** --- 79,88 ---- int i; + #if 0 if (ALIGNED_POINTER(symtab, long) == 0) { printf("DDB: bad symbol table start address %p\n", symtab); return; } + #endif symtab_start = symtab_end = NULL; *************** *** 162,169 **** --- 162,171 ---- * Now, sanity check the symbols against the string table. */ + #if 0 if (symtab_start == NULL || strtab_start == NULL || ALIGNED_POINTER(symtab_start, long) == 0 || ALIGNED_POINTER(strtab_start, long) == 0) goto badheader; + #endif for (symp = symtab_start; symp < symtab_end; symp++) if (symp->st_name + strtab_start > strtab_end) *************** *** 216,220 **** * Lookup the symbol with the given name. */ ! db_sym_t X_db_lookup(stab, symstr) db_symtab_t *stab; --- 218,222 ---- * Lookup the symbol with the given name. */ ! c_db_sym_t X_db_lookup(stab, symstr) db_symtab_t *stab; *************** *** 228,231 **** --- 230,234 ---- strtab = db_elf_find_strtab(stab); + strtab = (char *)stab->end + 4; if (strtab == NULL) return ((db_sym_t)0); *************** *** 244,248 **** * provided threshold). */ ! db_sym_t X_db_search_symbol(symtab, off, strategy, diffp) db_symtab_t *symtab; --- 247,251 ---- * provided threshold). */ ! c_db_sym_t X_db_search_symbol(symtab, off, strategy, diffp) db_symtab_t *symtab; *************** *** 262,268 **** --- 265,273 ---- if (symp->st_name == 0) continue; + #if 0 if (ELF_ST_TYPE(symp->st_info) != STT_OBJECT && ELF_ST_TYPE(symp->st_info) != STT_FUNC) continue; + #endif if (off >= symp->st_value) { *************** *** 310,322 **** X_db_symbol_values(symtab, sym, namep, valuep) db_symtab_t *symtab; ! db_sym_t sym; const char **namep; db_expr_t *valuep; { ! Elf_Sym *symp = (Elf_Sym *)sym; char *strtab; if (namep) { strtab = db_elf_find_strtab(symtab); if (strtab == NULL) *namep = NULL; --- 315,328 ---- X_db_symbol_values(symtab, sym, namep, valuep) db_symtab_t *symtab; ! c_db_sym_t sym; const char **namep; db_expr_t *valuep; { ! const Elf_Sym *symp = (const Elf_Sym *)sym; char *strtab; if (namep) { strtab = db_elf_find_strtab(symtab); + strtab = (char *)symtab->end + 4; if (strtab == NULL) *namep = NULL; *************** *** 336,340 **** X_db_line_at_pc(symtab, cursym, filename, linenum, off) db_symtab_t *symtab; ! db_sym_t cursym; char **filename; int *linenum; --- 342,346 ---- X_db_line_at_pc(symtab, cursym, filename, linenum, off) db_symtab_t *symtab; ! c_db_sym_t cursym; char **filename; int *linenum; *************** *** 375,381 **** { if (ksym_end > ksym_start) X_db_sym_init(ksym_start, ksym_end, "kernel"); } ! #endif --- 381,395 ---- { + #ifdef __i386__ + if (bootinfo.bi_esymtab != bootinfo.bi_symtab) + db_add_symbol_table( + (char *)bootinfo.bi_symtab + 4, + (char *)bootinfo.bi_symtab + 4 + *(int *)bootinfo.bi_symtab, + "kernel", (char *)bootinfo.bi_symtab); + #else if (ksym_end > ksym_start) X_db_sym_init(ksym_start, ksym_end, "kernel"); + #endif } ! #endif /* __ELF__ */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907221713.DAA03332>