Date: Wed, 10 Mar 2004 21:31:28 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 48677 for review Message-ID: <200403110531.i2B5VSUZ098687@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=48677 Change 48677 by marcel@marcel_nfs on 2004/03/10 21:31:12 First draft of the KDB backend interface. Affected files ... .. //depot/projects/gdb/sys/kern/subr_kdb.c#3 edit .. //depot/projects/gdb/sys/sys/kdb.h#2 edit Differences ... ==== //depot/projects/gdb/sys/kern/subr_kdb.c#3 (text+ko) ==== @@ -30,10 +30,14 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kdb.h> +#include <sys/kernel.h> int kdb_active = 0; struct kdb_dbbe *kdb_cur = NULL; +KDB_BACKEND(null, NULL, NULL, NULL, NULL); +SET_DECLARE(kdb_dbbe_set, struct kdb_dbbe); + /* * Solaris implements a new BREAK which is initiated by a character sequence * CR ~ ^b which is similar to a familiar pattern used on Sun servers by the @@ -120,9 +124,30 @@ void kdb_init() { + struct kdb_dbbe *be, **iter; + int cur_pri, pri; kdb_active = 0; kdb_cur = NULL; + cur_pri = -1; + SET_FOREACH(iter, kdb_dbbe_set) { + be = *iter; + pri = (be->dbbe_init != NULL) ? be->dbbe_init() : -1; + if (pri >= 0) { + if (cur_pri == -1) + printf("KDB: debugger backends:"); + printf(" %s", be->dbbe_name); + if (pri > cur_pri) { + cur_pri = pri; + kdb_cur = be; + } + } + } + if (cur_pri != -1) { + printf("\n"); + printf("KDB: current=%s\n", kdb_cur->dbbe_name); + } else + printf("KDB: no debugger backends present\n"); } /* ==== //depot/projects/gdb/sys/sys/kdb.h#2 (text+ko) ==== @@ -44,6 +44,16 @@ dbbe_trap_f *dbbe_trap; }; +#define KDB_BACKEND(name, init, trace, enter, trap) \ + static struct kdb_dbbe name##_dbbe = { \ + .dbbe_name = #name, \ + .dbbe_enter = enter, \ + .dbbe_init = init, \ + .dbbe_trace = trace, \ + .dbbe_trap = trap \ + }; \ + DATA_SET(kdb_dbbe_set, name##_dbbe) + extern int kdb_active; /* Non-zero while in debugger. */ extern struct kdb_dbbe *kdb_cur; /* Default debugger backend or NULL. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403110531.i2B5VSUZ098687>