=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/kdump/kdump.c,v retrieving revision 1.58 retrieving revision 1.59 diff -c -r1.58 -r1.59 *** src/usr.bin/kdump/kdump.c 2011/07/10 06:13:55 1.58 --- src/usr.bin/kdump/kdump.c 2011/07/17 06:55:25 1.59 *************** *** 1,4 **** ! /* $OpenBSD: kdump.c,v 1.58 2011/07/10 06:13:55 otto Exp $ */ /*- * Copyright (c) 1988, 1993 --- 1,4 ---- ! /* $OpenBSD: kdump.c,v 1.59 2011/07/17 06:55:25 otto Exp $ */ /*- * Copyright (c) 1988, 1993 *************** *** 107,115 **** { NULL, NULL, 0 } }; ! struct emulation *current; static char *ptrace_ops[] = { "PT_TRACE_ME", "PT_READ_I", "PT_READ_D", "PT_READ_U", "PT_WRITE_I", "PT_WRITE_D", "PT_WRITE_U", "PT_CONTINUE", --- 107,123 ---- { NULL, NULL, 0 } }; ! static struct emulation *current; + struct pid_emul { + struct emulation *e; + pid_t p; + }; + static struct pid_emul *pe_table; + static size_t pe_size; + + static char *ptrace_ops[] = { "PT_TRACE_ME", "PT_READ_I", "PT_READ_D", "PT_READ_U", "PT_WRITE_I", "PT_WRITE_D", "PT_WRITE_U", "PT_CONTINUE", *************** *** 120,125 **** --- 128,135 ---- static register_t *ap; static char sep; + static void mappidtoemul(pid_t, struct emulation *); + static struct emulation * findemul(pid_t); static int fread_tail(void *, size_t, size_t); static void dumpheader(struct ktr_header *); static void ktrcsw(struct ktr_csw *); *************** *** 199,204 **** --- 209,216 ---- err(1, "%s", tracefile); while (fread_tail(&ktr_header, sizeof(struct ktr_header), 1)) { silent = 0; + if (pe_size == 0) + mappidtoemul(ktr_header.ktr_pid, current); if (pid != -1 && pid != ktr_header.ktr_pid) silent = 1; if (silent == 0 && trpoints & (1<= current->nsysnames || code < 0) (void)printf("[%d] ", code); ! else (void)printf("%s ", current->sysnames[code]); if (error == 0) { if (fancy) { --- 752,765 ---- if (code >= current->nsysnames || code < 0) (void)printf("[%d] ", code); ! else { (void)printf("%s ", current->sysnames[code]); + if (ret > 0 && (strcmp(current->sysnames[code], "fork") == 0 || + strcmp(current->sysnames[code], "vfork") == 0 || + strcmp(current->sysnames[code], "rfork") == 0 || + strcmp(current->sysnames[code], "clone") == 0)) + mappidtoemul(ret, current); + } if (error == 0) { if (fancy) {