CORE_ADDR kgdb_lookup(const char *sym) { CORE_ADDR addr; char *name; asprintf(&name, "&%s", sym); addr = kgdb_parse(name); free(name); return (addr); }
CORE_ADDR kgdb_trgt_core_pcb(u_int cpuid) { CORE_ADDR addr; char *expr; asprintf(&expr, "&cpuid_to_pcpu[%d]->pc_md.pcb", cpuid); addr = kgdb_parse(expr); free(expr); return (addr); }
void kgdb_dmesg(void) { CORE_ADDR bufp; int size, rseq, wseq; char c; /* * Display the unread portion of the message buffer. This gives the * user a some initial data to work from. */ if (quiet) return; bufp = kgdb_parse("msgbufp->msg_ptr"); size = (int)kgdb_parse("msgbufp->msg_size"); if (bufp == 0 || size == 0) return; rseq = (int)kgdb_parse("msgbufp->msg_rseq"); wseq = (int)kgdb_parse("msgbufp->msg_wseq"); rseq = MSGBUF_SEQ_TO_POS(size, rseq); wseq = MSGBUF_SEQ_TO_POS(size, wseq); if (rseq == wseq) return; printf("\nUnread portion of the kernel message buffer:\n"); while (rseq < wseq) { read_memory(bufp + rseq, &c, 1); putchar(c); rseq++; if (rseq == size) rseq = 0; } if (c != '\n') putchar('\n'); putchar('\n'); }
void kgdb_trgt_new_objfile(struct objfile *objfile) { /* * In revision 1.117 of i386/i386/exception.S trap handlers * were changed to pass trapframes by reference rather than * by value. Detect this by seeing if the first instruction * at the 'calltrap' label is a "push %esp" which has the * opcode 0x54. */ if (kgdb_parse("((char *)calltrap)[0]") == 0x54) ofs_fix = 4; else ofs_fix = 0; }