diff options
Diffstat (limited to 'sys')
31 files changed, 1075 insertions, 81 deletions
diff --git a/sys/arch/alpha/conf/Makefile.alpha b/sys/arch/alpha/conf/Makefile.alpha index 9859cc78cf7..87fcceee8be 100644 --- a/sys/arch/alpha/conf/Makefile.alpha +++ b/sys/arch/alpha/conf/Makefile.alpha @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.alpha,v 1.44 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.alpha,v 1.45 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.alpha,v 1.27 1996/12/01 06:12:25 jonathan Exp $ # Makefile for OpenBSD @@ -46,6 +46,12 @@ AFLAGS= -traditional -D_LOCORE LINKFLAGS= -N -Ttext fffffc0000230000 -e __start -G 4 STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -115,7 +121,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ @@ -135,7 +141,7 @@ links: SRCS= ${ALPHA}/alpha/locore.s param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${ALPHA}/alpha/cpuconf.c +.depend: ${SRCS} assym.h param.c ${ALPHA}/alpha/cpuconf.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/cpuconf.c \ param.c ioconf.c ${CFILES} @@ -146,6 +152,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/amd64/conf/Makefile.amd64 b/sys/arch/amd64/conf/Makefile.amd64 index 07d6902b428..08d56696af2 100644 --- a/sys/arch/amd64/conf/Makefile.amd64 +++ b/sys/arch/amd64/conf/Makefile.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.amd64,v 1.17 2009/07/10 13:51:47 jsg Exp $ +# $OpenBSD: Makefile.amd64,v 1.18 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -52,6 +52,12 @@ AFLAGS= -x assembler-with-cpp -D_LOCORE LINKFLAGS= -Ttext 0xffffffff801001e0 -e start -X STRIPFLAGS= -g -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -129,7 +135,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -151,7 +157,7 @@ AFILES= ${AMD64}/amd64/locore.S ${AMD64}/amd64/vector.S ${AMD64}/amd64/copy.S \ ${AMD64}/amd64/spl.S SRCS= param.c ioconf.c ${AFILES} ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${AFILES} ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -161,6 +167,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/armish/conf/Makefile.armish b/sys/arch/armish/conf/Makefile.armish index b9782cffd15..dd6eedb0f6c 100644 --- a/sys/arch/armish/conf/Makefile.armish +++ b/sys/arch/armish/conf/Makefile.armish @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.armish,v 1.10 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.armish,v 1.11 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.i386,v 1.67 1996/05/11 16:12:11 mycroft Exp $ # Makefile for OpenBSD @@ -57,6 +57,12 @@ LINKFLAGS= -T ldscript LINKFLAGS+= --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -143,7 +149,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -164,7 +170,7 @@ links: SRCS= ${ARM}/arm/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -177,6 +183,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/aviion/conf/Makefile.aviion b/sys/arch/aviion/conf/Makefile.aviion index 0b5d1280aea..6b41a389097 100644 --- a/sys/arch/aviion/conf/Makefile.aviion +++ b/sys/arch/aviion/conf/Makefile.aviion @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.aviion,v 1.8 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.aviion,v 1.9 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD # @@ -52,6 +52,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE ${CMACHFLAGS} LINKFLAGS= -Ttext 0x1000 -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS?=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS?= ${CFLAGS} @@ -128,7 +134,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -150,7 +156,7 @@ links: SRCS= param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if !empty(SFILES) ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -161,6 +167,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/beagle/conf/Makefile.beagle b/sys/arch/beagle/conf/Makefile.beagle index 7c1093df1ff..d45eef3478d 100644 --- a/sys/arch/beagle/conf/Makefile.beagle +++ b/sys/arch/beagle/conf/Makefile.beagle @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.beagle,v 1.2 2009/05/24 21:02:48 drahn Exp $ +# $OpenBSD: Makefile.beagle,v 1.3 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -55,6 +55,12 @@ LINKFLAGS= -T ldscript LINKFLAGS+= --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -139,7 +145,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -160,7 +166,7 @@ links: SRCS= ${ARM}/arm/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -172,6 +178,11 @@ depend:: .depend @sed -e 's/.*\.o:.* /assym.h: /' < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/gumstix/conf/Makefile.gumstix b/sys/arch/gumstix/conf/Makefile.gumstix index 9255edc4769..0aea374f3f6 100644 --- a/sys/arch/gumstix/conf/Makefile.gumstix +++ b/sys/arch/gumstix/conf/Makefile.gumstix @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.gumstix,v 1.2 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.gumstix,v 1.3 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.i386,v 1.67 1996/05/11 16:12:11 mycroft Exp $ # Makefile for OpenBSD @@ -57,6 +57,12 @@ LINKFLAGS= -T ldscript LINKFLAGS+= --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -141,7 +147,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -162,7 +168,7 @@ links: SRCS= ${ARM}/arm/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -175,6 +181,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300 index 4f7ed93ade4..c4e560eae09 100644 --- a/sys/arch/hp300/conf/Makefile.hp300 +++ b/sys/arch/hp300/conf/Makefile.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.hp300,v 1.45 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.hp300,v 1.46 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.hp300,v 1.54 1997/04/01 23:16:41 scottr Exp $ # Makefile for OpenBSD @@ -51,6 +51,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -161,7 +167,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ @@ -182,7 +188,7 @@ links: SRCS= ${HP300}/hp300/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} -if test -n "${SFILES}"; then \ @@ -194,6 +200,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/hppa/conf/Makefile.hppa b/sys/arch/hppa/conf/Makefile.hppa index c6b468c9f32..4c66591f8fe 100644 --- a/sys/arch/hppa/conf/Makefile.hppa +++ b/sys/arch/hppa/conf/Makefile.hppa @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.hppa,v 1.35 2009/08/09 21:33:36 miod Exp $ +# $OpenBSD: Makefile.hppa,v 1.36 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -69,6 +69,12 @@ LIBSPMATH= ${SPMATH_PROF} .endif .endif +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -140,7 +146,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ @@ -160,7 +166,7 @@ links: SRCS= ${HPPA}/hppa/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${HPPA}/hppa/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} -if test -n "${SFILES}"; then \ @@ -172,6 +178,11 @@ SRCS= ${HPPA}/hppa/locore.S \ < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/hppa64/conf/Makefile.hppa64 b/sys/arch/hppa64/conf/Makefile.hppa64 index 8b764075ebc..29894d638e5 100644 --- a/sys/arch/hppa64/conf/Makefile.hppa64 +++ b/sys/arch/hppa64/conf/Makefile.hppa64 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.hppa64,v 1.9 2009/08/09 21:33:38 miod Exp $ +# $OpenBSD: Makefile.hppa64,v 1.10 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -51,6 +51,12 @@ STRIPFLAGS= -g -x CFLAGS+= -fno-omit-frame-pointer .endif +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -124,7 +130,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ @@ -144,7 +150,7 @@ links: SRCS= ${HPPA}/hppa64/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${HPPA}/hppa64/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} -if test -n "${SFILES}"; then \ @@ -156,6 +162,11 @@ SRCS= ${HPPA}/hppa64/locore.S \ < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/i386/conf/Makefile.i386 b/sys/arch/i386/conf/Makefile.i386 index abfc61545cc..25a5609b156 100644 --- a/sys/arch/i386/conf/Makefile.i386 +++ b/sys/arch/i386/conf/Makefile.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.i386,v 1.52 2009/07/10 13:51:47 jsg Exp $ +# $OpenBSD: Makefile.i386,v 1.53 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -56,6 +56,12 @@ AFLAGS+=-m32 LINKFLAGS+=-melf_i386_obsd .endif +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -133,7 +139,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -154,7 +160,7 @@ links: SRCS= ${I386}/i386/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -164,6 +170,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/landisk/conf/Makefile.landisk b/sys/arch/landisk/conf/Makefile.landisk index 80c9014d7fc..86b804ef8ec 100644 --- a/sys/arch/landisk/conf/Makefile.landisk +++ b/sys/arch/landisk/conf/Makefile.landisk @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.landisk,v 1.10 2009/08/09 21:33:38 miod Exp $ +# $OpenBSD: Makefile.landisk,v 1.11 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD/landisk # @@ -52,6 +52,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-little LINKFLAGS= -N -Ttext 0x8c002000 -e start --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -129,7 +135,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ @@ -150,7 +156,7 @@ links: SRCS= ${LANDISK}/landisk/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${LANDISK}/landisk/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -162,6 +168,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/luna88k/conf/Makefile.luna88k b/sys/arch/luna88k/conf/Makefile.luna88k index 261dc7dea01..a2d0cf53238 100644 --- a/sys/arch/luna88k/conf/Makefile.luna88k +++ b/sys/arch/luna88k/conf/Makefile.luna88k @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.luna88k,v 1.14 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.luna88k,v 1.15 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD # @@ -50,6 +50,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE ${CMACHFLAGS} LINKFLAGS= -N -Ttext 0x20000 -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS?=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS?= ${CFLAGS} @@ -124,7 +130,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -146,7 +152,7 @@ links: SRCS= param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if !empty(SFILES) ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -157,6 +163,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/mac68k/conf/Makefile.mac68k b/sys/arch/mac68k/conf/Makefile.mac68k index 0c48b1d377a..8a9544c301f 100644 --- a/sys/arch/mac68k/conf/Makefile.mac68k +++ b/sys/arch/mac68k/conf/Makefile.mac68k @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.mac68k,v 1.42 2009/08/09 21:33:38 miod Exp $ +# $OpenBSD: Makefile.mac68k,v 1.43 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.mac68k,v 1.53 1997/04/15 06:11:38 scottr Exp $ # Makefile for OpenBSD @@ -51,6 +51,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -132,7 +138,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -153,7 +159,7 @@ links: SRCS= ${MAC68K}/mac68k/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MAC68K}/mac68k/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -166,6 +172,10 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o # depend on root or device configuration diff --git a/sys/arch/macppc/conf/Makefile.macppc b/sys/arch/macppc/conf/Makefile.macppc index ae7c6af1381..721c713def3 100644 --- a/sys/arch/macppc/conf/Makefile.macppc +++ b/sys/arch/macppc/conf/Makefile.macppc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.macppc,v 1.31 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.macppc,v 1.32 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD PowerPC # @@ -51,6 +51,12 @@ AFLAGS= -D_LOCORE -Wa,-many LINKFLAGS= -N -Ttext 100114 -e start --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -126,7 +132,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ @@ -147,7 +153,7 @@ links: SRCS= ${MACPPC}/macppc/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MACPPC}/macppc/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -159,6 +165,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/moko/conf/Makefile.moko b/sys/arch/moko/conf/Makefile.moko index c14097e0af2..90b878f491a 100644 --- a/sys/arch/moko/conf/Makefile.moko +++ b/sys/arch/moko/conf/Makefile.moko @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.moko,v 1.2 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.moko,v 1.3 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -56,6 +56,12 @@ LINKFLAGS= -T ldscript LINKFLAGS+= --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -140,7 +146,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -161,7 +167,7 @@ links: SRCS= ${ARM}/arm/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -174,6 +180,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/mvme68k/conf/Makefile.mvme68k b/sys/arch/mvme68k/conf/Makefile.mvme68k index 0871cbb2cbf..c227f1705ce 100644 --- a/sys/arch/mvme68k/conf/Makefile.mvme68k +++ b/sys/arch/mvme68k/conf/Makefile.mvme68k @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.mvme68k,v 1.34 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.mvme68k,v 1.35 2009/08/09 23:04:49 miod Exp $ # This makefile is constructed from a machine description: # config machineid @@ -50,6 +50,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -Ttext 0x10000 -z -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -126,7 +132,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: /tmp param.c @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ @@ -148,7 +154,7 @@ links: SRCS= ${MVME68K}/mvme68k/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -158,6 +164,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/mvme88k/conf/Makefile.mvme88k b/sys/arch/mvme88k/conf/Makefile.mvme88k index bc6f06f942d..7bcdbfbf545 100644 --- a/sys/arch/mvme88k/conf/Makefile.mvme88k +++ b/sys/arch/mvme88k/conf/Makefile.mvme88k @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.mvme88k,v 1.45 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.mvme88k,v 1.46 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD # @@ -50,6 +50,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE ${CMACHFLAGS} LINKFLAGS= -Ttext 0x10000 -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS?=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS?= ${CFLAGS} @@ -127,7 +133,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -149,7 +155,7 @@ links: SRCS= param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if !empty(SFILES) ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -160,6 +166,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/mvmeppc/conf/Makefile.mvmeppc b/sys/arch/mvmeppc/conf/Makefile.mvmeppc index db542cd0d2d..3facc2dae59 100644 --- a/sys/arch/mvmeppc/conf/Makefile.mvmeppc +++ b/sys/arch/mvmeppc/conf/Makefile.mvmeppc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.mvmeppc,v 1.29 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.mvmeppc,v 1.30 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD PowerPC # @@ -51,6 +51,12 @@ AFLAGS= -D_LOCORE LINKFLAGS= -N -Ttext 100114 -e start --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -126,7 +132,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ @@ -147,7 +153,7 @@ links: SRCS= ${MVMEPPC}/mvmeppc/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVMEPPC}/mvmeppc/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -159,6 +165,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/sgi/conf/Makefile.sgi b/sys/arch/sgi/conf/Makefile.sgi index b3d156431c2..434ef5af0c1 100644 --- a/sys/arch/sgi/conf/Makefile.sgi +++ b/sys/arch/sgi/conf/Makefile.sgi @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.sgi,v 1.23 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.sgi,v 1.24 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -60,6 +60,12 @@ CFLAGS= ${DEBUG} ${CDIAGFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE} AFLAGS= -x assembler-with-cpp -mno-abicalls ${ABI} -D_LOCORE STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< @@ -108,7 +114,7 @@ newvers: clean:: rm -f eddep bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: /tmp param.c @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ @@ -168,7 +174,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} SRCS= ${SGI}/sgi/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SGI}/sgi/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -178,6 +184,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # The install target can be redefined by putting a # install-kernel-${MACHINE_NAME} target into /etc/mk.conf MACHINE_NAME!= uname -n diff --git a/sys/arch/socppc/conf/Makefile.socppc b/sys/arch/socppc/conf/Makefile.socppc index 0d5b92fc285..b13f33fb9be 100644 --- a/sys/arch/socppc/conf/Makefile.socppc +++ b/sys/arch/socppc/conf/Makefile.socppc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.socppc,v 1.3 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.socppc,v 1.4 2009/08/09 23:04:49 miod Exp $ # # Makefile for OpenBSD PowerPC # @@ -51,6 +51,12 @@ AFLAGS= -D_LOCORE -Wa,-many LINKFLAGS= -N -Ttext 200000 -e start --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC?= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -126,7 +132,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB ${CFILES} \ @@ -147,7 +153,7 @@ links: SRCS= ${SOCPPC}/socppc/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SOCPPC}/socppc/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -159,6 +165,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/solbourne/conf/Makefile.solbourne b/sys/arch/solbourne/conf/Makefile.solbourne index 1e8cf824423..b18234ad9b4 100644 --- a/sys/arch/solbourne/conf/Makefile.solbourne +++ b/sys/arch/solbourne/conf/Makefile.solbourne @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.solbourne,v 1.10 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.solbourne,v 1.11 2009/08/09 23:04:49 miod Exp $ # Makefile for OpenBSD # @@ -52,6 +52,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -e start -T ${SOLBOURNE}/conf/ld.script -Ttext FD084000 STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -129,7 +135,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd *bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -150,7 +156,7 @@ links: SRCS= ${SOLBOURNE}/solbourne/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SOLBOURNE}/solbourne/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if !empty(SFILES) @@ -162,6 +168,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + locore.o: ${SOLBOURNE}/solbourne/locore.s assym.h ${NORMAL_S} diff --git a/sys/arch/sparc/conf/Makefile.sparc b/sys/arch/sparc/conf/Makefile.sparc index 6945522d931..7f1674c93a5 100644 --- a/sys/arch/sparc/conf/Makefile.sparc +++ b/sys/arch/sparc/conf/Makefile.sparc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.sparc,v 1.46 2009/08/09 21:33:39 miod Exp $ +# $OpenBSD: Makefile.sparc,v 1.47 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.sparc,v 1.32.4.1 1996/06/12 20:26:32 pk Exp $ # Makefile for OpenBSD @@ -58,6 +58,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -e start -Ttext F8004000 STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -135,7 +141,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd *bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -156,7 +162,7 @@ links: SRCS= ${SPARC}/sparc/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC}/sparc/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if !empty(SFILES) @@ -168,6 +174,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/sparc64/conf/Makefile.sparc64 b/sys/arch/sparc64/conf/Makefile.sparc64 index fbd4a01d8c0..0087d1244f0 100644 --- a/sys/arch/sparc64/conf/Makefile.sparc64 +++ b/sys/arch/sparc64/conf/Makefile.sparc64 @@ -29,6 +29,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9b LINKFLAGS= -n -Ttext 01000000 -Tdata 01800000 -e start -N STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -106,7 +112,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd *bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -127,7 +133,7 @@ links: SRCS= ${SPARC64}/sparc64/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if !empty(SFILES) @@ -139,6 +145,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + locore.o: ${SPARC64}/sparc64/locore.s assym.h ${NORMAL_S} diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax index ca1b279da76..11e75ab8abd 100644 --- a/sys/arch/vax/conf/Makefile.vax +++ b/sys/arch/vax/conf/Makefile.vax @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.vax,v 1.33 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.vax,v 1.34 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.vax,v 1.49 1999/07/26 05:20:49 cgd Exp $ # Makefile for OpenBSD/vax @@ -77,6 +77,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -Ttext 80000000 -e start STRIPFLAGS= -d +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -141,7 +147,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: cleankernel cleankernel: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ @@ -164,7 +170,7 @@ SRCS= ${VAX}/vax/intvec.s ${VAX}/vax/subr.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c +.depend: ${SRCS} assym.h param.c ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} @@ -174,6 +180,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/arch/zaurus/conf/Makefile.zaurus b/sys/arch/zaurus/conf/Makefile.zaurus index 4c971954f04..47e655fe4ef 100644 --- a/sys/arch/zaurus/conf/Makefile.zaurus +++ b/sys/arch/zaurus/conf/Makefile.zaurus @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.zaurus,v 1.13 2009/01/11 21:02:03 pirofti Exp $ +# $OpenBSD: Makefile.zaurus,v 1.14 2009/08/09 23:04:49 miod Exp $ # $NetBSD: Makefile.i386,v 1.67 1996/05/11 16:12:11 mycroft Exp $ # Makefile for OpenBSD @@ -57,6 +57,12 @@ LINKFLAGS= -T ldscript LINKFLAGS+= --warn-common STRIPFLAGS= -g -X -x +.if ${IDENT:M-DDDB_STRUCT} +DB_STRUCTINFO= db_structinfo.h +.else +DB_STRUCTINFO= +.endif + HOSTCC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} @@ -141,7 +147,7 @@ newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} clean:: rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ - [Ee]rrs linterrs makelinks assym.h + [Ee]rrs linterrs makelinks assym.h ${DB_STRUCTINFO} lint: @lint -hbxncez -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ @@ -162,7 +168,7 @@ links: SRCS= ${ARM}/arm/locore.S \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend -.depend: ${SRCS} assym.h param.c ${APMINC} +.depend: ${SRCS} assym.h param.c ${APMINC} ${DB_STRUCTINFO} ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm/locore.S ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} .if ${SFILES} != "" @@ -175,6 +181,11 @@ depend:: .depend < assym.dep >> .depend @rm -f assym.dep +db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.awk + ${CC} ${CFLAGS} ${CPPFLAGS} -gstabs -c $S/ddb/db_structinfo.c + objdump -g db_structinfo.o | awk -f $S/ddb/parse_structinfo.awk > $@ + rm -f db_structinfo.o + # depend on root or device configuration autoconf.o conf.o: Makefile diff --git a/sys/conf/files b/sys/conf/files index 90f9e43b00b..bbfedc902bd 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.469 2009/08/09 12:47:23 dlg Exp $ +# $OpenBSD: files,v 1.470 2009/08/09 23:04:49 miod Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -545,18 +545,19 @@ file ddb/db_command.c ddb file ddb/db_elf.c ddb file ddb/db_examine.c ddb file ddb/db_expr.c ddb +file ddb/db_hangman.c ddb file ddb/db_input.c ddb file ddb/db_lex.c ddb file ddb/db_output.c ddb file ddb/db_print.c ddb file ddb/db_run.c ddb | kgdb +file ddb/db_struct.c ddb & ddb_struct file ddb/db_sym.c ddb file ddb/db_trap.c ddb file ddb/db_variables.c ddb file ddb/db_watch.c ddb file ddb/db_write_cmd.c ddb file ddb/db_usrreq.c ddb -file ddb/db_hangman.c ddb file dev/auconv.c auconv file dev/audio.c audio needs-flag file dev/ccd.c ccd needs-flag diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 8e4b9239b38..cdfbb648979 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_command.c,v 1.55 2009/08/08 15:04:43 beck Exp $ */ +/* $OpenBSD: db_command.c,v 1.56 2009/08/09 23:04:49 miod Exp $ */ /* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */ /* @@ -472,17 +472,23 @@ struct db_command db_show_cmds[] = { { "malloc", db_malloc_print_cmd, 0, NULL }, { "map", db_map_print_cmd, 0, NULL }, { "mount", db_mount_print_cmd, 0, NULL }, +#ifdef NFSCLIENT + { "nfsreq", db_nfsreq_print_cmd, 0, NULL }, +#endif { "object", db_object_print_cmd, 0, NULL }, +#ifdef DDB_STRUCT_INFORMATION + { "offset", db_struct_offset_cmd, CS_OWN, NULL }, +#endif { "page", db_page_print_cmd, 0, NULL }, { "panic", db_show_panic_cmd, 0, NULL }, { "pool", db_pool_print_cmd, 0, NULL }, { "proc", db_proc_print_cmd, 0, NULL }, { "registers", db_show_regs, 0, NULL }, +#ifdef DDB_STRUCT_INFORMATION + { "struct", db_struct_layout_cmd, CS_OWN, NULL }, +#endif { "uvmexp", db_uvmexp_print_cmd, 0, NULL }, { "vnode", db_vnode_print_cmd, 0, NULL }, -#ifdef NFSCLIENT - { "nfsreq", db_nfsreq_print_cmd, 0, NULL }, -#endif { "watches", db_listwatch_cmd, 0, NULL }, { NULL, NULL, 0, NULL } }; diff --git a/sys/ddb/db_command.h b/sys/ddb/db_command.h index a2d7bde4c92..5350d8204ec 100644 --- a/sys/ddb/db_command.h +++ b/sys/ddb/db_command.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_command.h,v 1.25 2009/08/08 15:04:43 beck Exp $ */ +/* $OpenBSD: db_command.h,v 1.26 2009/08/09 23:04:49 miod Exp $ */ /* $NetBSD: db_command.h,v 1.8 1996/02/05 01:56:55 christos Exp $ */ /* @@ -66,6 +66,8 @@ void db_stack_trace_cmd(db_expr_t, int, db_expr_t, char *); void db_dmesg_cmd(db_expr_t, int, db_expr_t, char *); void db_show_panic_cmd(db_expr_t, int, db_expr_t, char *); void db_bcstats_print_cmd(db_expr_t, int, db_expr_t, char *); +void db_struct_offset_cmd(db_expr_t, int, db_expr_t, char *); +void db_struct_layout_cmd(db_expr_t, int, db_expr_t, char *); extern db_addr_t db_dot, db_last_addr, db_prev, db_next; diff --git a/sys/ddb/db_struct.c b/sys/ddb/db_struct.c new file mode 100644 index 00000000000..373cd2c53eb --- /dev/null +++ b/sys/ddb/db_struct.c @@ -0,0 +1,271 @@ +/* $OpenBSD: db_struct.c,v 1.1 2009/08/09 23:04:49 miod Exp $ */ + +/* + * Copyright (c) 2009 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * ddb routines to describe struct information + */ + +#include <sys/param.h> +#include <sys/systm.h> + +#include <machine/db_machdep.h> + +#include <ddb/db_lex.h> +#include <ddb/db_output.h> +#include <ddb/db_access.h> +#include <ddb/db_command.h> +#include <ddb/db_extern.h> +#include <ddb/db_interface.h> +#include <ddb/db_var.h> + +#include "db_structinfo.h" + +void db_struct_print_field(uint, int, db_expr_t); + +/* + * Flags to pass db_struct_printf(). + */ + +#define DBSP_STRUCT_NAME 0x01 /* prepend struct name */ +#define DBSP_VALUE 0x02 /* display field value */ + +void +db_struct_print_field(uint fidx, int flags, db_expr_t baseaddr) +{ + const struct ddb_field_info *field; + const struct ddb_struct_info *struc; + db_expr_t value; + uint tmp; + size_t namelen; + int width, basecol, curcol; + char tmpfmt[28]; + + field = &ddb_field_info[fidx]; + basecol = 0; + + if (ISSET(flags, DBSP_STRUCT_NAME)) { + struc = &ddb_struct_info[field->sidx]; + namelen = strlen(struc->name); + db_printf("%-30s ", struc->name); + if (namelen > 30) + basecol += namelen + 1; + else + basecol += 30 + 1; + } + + namelen = strlen(field->name); + if (field->nitems == 1) { + db_printf("%-30s ", field->name); + if (namelen > 30) + basecol += namelen + 1; + else + basecol += 30 + 1; + } else { + width = 30 - 2; + tmp = field->nitems; + while (tmp != 0) { + width--; + tmp /= 10; + } + if (namelen >= width) { + db_printf("%s[%zu] ", field->name, field->nitems); + basecol += namelen + (30 - width) + 1; + } else { + db_printf("%s[%zu]%*s ", field->name, field->nitems, + width - (int)namelen, ""); + /* namelen + (30-width) + (width-namelen) + 1 */ + basecol += 30 + 1; + } + } + + if (field->size == 0) { + db_printf("bitfield"); + /* basecol irrelevant from there on */ + } else { + snprintf(tmpfmt, sizeof tmpfmt, "%zu", field->size); + basecol += strlen(tmpfmt) + 1; + db_printf("%s ", tmpfmt); + } + + if (ISSET(flags, DBSP_VALUE)) { + /* only print the field value if it has a friendly size. */ + switch (field->size) { + case 1: + width = 4; + break; + case 2: + width = 8; + break; + case 4: + width = 12; + break; +#ifdef __LP64__ + case 8: + width = 20; + break; +#endif + default: + width = 0; + } + if (width != 0) { + baseaddr += field->offs; + curcol = basecol; + for (tmp = field->nitems; tmp != 0; tmp--) { + value = db_get_value(baseaddr, field->size, + FALSE); /* assume unsigned */ + db_format(tmpfmt, sizeof tmpfmt, (long)value, + DB_FORMAT_N, 0, width); + if (field->nitems > 1) + db_printf("%s", tmpfmt); + else + db_printf("%20s", tmpfmt); + baseaddr += field->size; + + /* + * Try to fit array elements on as few lines + * as possible. + */ + if (field->nitems > 1 && tmp > 1) { + curcol += width + 1; + if (basecol >= db_max_width || + curcol + width >= db_max_width) { + /* new line */ + db_printf("\n"); + if (basecol + width >= + db_max_width) { + db_printf("\t"); + curcol = 8; + } else { + db_printf("%*s", + basecol, ""); + curcol = basecol; + } + } else + db_printf(" "); + } + } + } + } + + db_printf("\n"); +} + + +/* + * show offset <value>: displays the list of struct fields which exist + * at that particular offset from the beginning of the struct. + */ +void +db_struct_offset_cmd(db_expr_t addr, int have_addr, db_expr_t count, + char *modifiers) +{ + db_expr_t offset = 0; + const struct ddb_field_offsets *field; + const uint *fidx; + uint oidx; + int width; + char tmpfmt[28]; + + /* + * Read the offset from the debuggger input. + * We don't want to get it from the standard parsing code, because + * this would set `dot' to this value, which doesn't make sense. + */ + + if (!db_expression(&offset) || offset < 0) { + db_printf("not a valid offset\n"); + db_flush_lex(); + return; + } + + db_skip_to_eol(); + + for (field = ddb_field_offsets, oidx = 0; oidx < NOFFS; field++, oidx++) + if (field->offs == (size_t)offset) + break; + + if (oidx == NOFFS) { + db_format(tmpfmt, sizeof tmpfmt, (long)offset, + DB_FORMAT_N, 0, width); + db_printf("no known structure element at offset %-*s\n", + width, tmpfmt); + db_flush_lex(); + return; + } + + db_printf("%-30s %-30s size\n", "struct", "member"); + for (fidx = field->list; *fidx != 0; fidx++) + db_struct_print_field(*fidx, DBSP_STRUCT_NAME, 0); +} + +/* + * show struct <struct name> [addr]: displays the data starting at addr + * (`dot' if unspecified) as a struct of the given type. + */ +void +db_struct_layout_cmd(db_expr_t addr, int have_addr, db_expr_t count, + char *modifiers) +{ + const struct ddb_struct_info *struc; + uint sidx, fidx; + int t; + + /* + * Read the struct name from the debugger input. + */ + + t = db_read_token(); + if (t != tIDENT) { + db_printf("Bad struct name\n"); + db_flush_lex(); + return; + } + + for (struc = ddb_struct_info, sidx = 0; sidx < NSTRUCT; + struc++, sidx++) + if (strcmp(struc->name, db_tok_string) == 0) + break; + + if (sidx == NSTRUCT) { + db_printf("unknown struct %s\n", db_tok_string); + db_flush_lex(); + return; + } + + /* + * Read the address, if any, from the debugger input. + * In that case, update `dot' value. + */ + + if (db_expression(&addr)) { + db_dot = (db_addr_t)addr; + db_last_addr = db_dot; + } else + addr = (db_expr_t)db_dot; + + db_skip_to_eol(); + + /* + * Display the structure contents. + */ + + db_printf("struct %s at %p (%zu bytes)\n", struc->name, (vaddr_t)addr, + struc->size); + for (fidx = struc->fmin; fidx <= struc->fmax; fidx++) + db_struct_print_field(fidx, DBSP_VALUE, addr); +} diff --git a/sys/ddb/db_structinfo.c b/sys/ddb/db_structinfo.c new file mode 100644 index 00000000000..6fd189c31fb --- /dev/null +++ b/sys/ddb/db_structinfo.c @@ -0,0 +1,122 @@ +/* $OpenBSD: db_structinfo.c,v 1.1 2009/08/09 23:04:49 miod Exp $ */ +/* public domain */ +/* + * This file is intended to be compiled with debug information, + * which is then translated by parse_debug.awk into support data + * for ddb. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/cdefs.h> + +#include <sys/device.h> +#include <sys/user.h> +#include <sys/proc.h> +#include <sys/acct.h> +#include <sys/buf.h> +#include <sys/conf.h> +#include <sys/core.h> +#include <sys/disk.h> +#include <sys/disklabel.h> +#include <sys/dirent.h> +#include <sys/dkbad.h> +#include <sys/dkstat.h> +#include <sys/evcount.h> +#include <sys/event.h> +#include <sys/eventvar.h> +#include <sys/exec.h> +#include <sys/extent.h> +#include <sys/fcntl.h> +#include <sys/file.h> +#include <sys/filedesc.h> +#include <sys/gpio.h> +#include <sys/hash.h> +#include <sys/hotplug.h> +#include <sys/ipc.h> +#include <sys/kcore.h> +#include <sys/kthread.h> +#include <sys/ktrace.h> +#include <sys/localedef.h> +#include <sys/lock.h> +#include <sys/lockf.h> +#include <sys/malloc.h> +#include <sys/mbuf.h> +#include <sys/memrange.h> +#include <sys/mman.h> +#include <sys/mount.h> +#include <sys/msg.h> +#include <sys/msgbuf.h> +#include <sys/namei.h> +#include <sys/pipe.h> +#include <sys/pool.h> +#include <sys/protosw.h> +#include <sys/ptrace.h> +#include <sys/queue.h> +#include <sys/resource.h> +#include <sys/resourcevar.h> +#include <sys/rwlock.h> +#include <sys/sched.h> +#include <sys/select.h> +#include <sys/selinfo.h> +#include <sys/sem.h> +#include <sys/sensors.h> +#include <sys/shm.h> +#include <sys/siginfo.h> +#include <sys/signal.h> +#include <sys/signalvar.h> +#include <sys/socket.h> +#include <sys/socketvar.h> +#include <sys/stat.h> +#include <sys/statvfs.h> +#include <sys/swap.h> +#include <sys/syscall.h> +#include <sys/syscallargs.h> +#include <sys/sysctl.h> +#include <sys/syslog.h> +#include <sys/termios.h> +#include <sys/time.h> +#include <sys/timeb.h> +#include <sys/timeout.h> +#include <sys/times.h> +#include <sys/timetc.h> +#include <sys/tprintf.h> +#include <sys/tree.h> +#include <sys/tty.h> +#include <sys/ttydev.h> +#include <sys/ucred.h> +#include <sys/uio.h> +#include <sys/un.h> +#include <sys/unpcb.h> +#include <sys/utsname.h> +#include <sys/vmmeter.h> +#include <sys/vnode.h> +#include <sys/wait.h> +#include <sys/workq.h> + +#include <machine/cpu.h> +#include <machine/conf.h> +#include <machine/mutex.h> + +#include <uvm/uvm.h> + +/* XXX add filesystem includes there */ + +#include <sys/agpio.h> +#include <sys/ataio.h> +#include <sys/audioio.h> +#include <sys/cdio.h> +#include <sys/chio.h> +#include <sys/dkio.h> +#include <sys/midiio.h> +#include <sys/filio.h> +#include <sys/mtio.h> +#include <sys/pciio.h> +#include <sys/radioio.h> +#include <sys/scanio.h> +#include <sys/scsiio.h> +#include <sys/sockio.h> +/* videoio.h uses anonymous unions which gcc2 doesn't support */ +#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__PCC__) +#include <sys/videoio.h> +#endif diff --git a/sys/ddb/parse_structinfo.awk b/sys/ddb/parse_structinfo.awk new file mode 100644 index 00000000000..b4e03b20252 --- /dev/null +++ b/sys/ddb/parse_structinfo.awk @@ -0,0 +1,318 @@ +# $OpenBSD: parse_structinfo.awk,v 1.1 2009/08/09 23:04:49 miod Exp $ +# +# Copyright (c) 2009 Miodrag Vallat. +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +# This ugly script parses the output of objdump -g in order to extract +# structure layout information, to be used by ddb. +# +# The output of this script is the following static data: +# - for each struct: +# - its name +# - its size (individual element size if an array) +# - the number of elements in the array (1 if not) +# - its first and last field indexes +# - for each field: +# - its name +# - its offset and size +# - the index of the struct it is member of +# This allows fast struct -> field information retrieval. +# +# To retrieve information from a field size or offset, we also output +# the following reverse arrays: +# - for each offset, in ascending order, a variable length list of field +# indexes. +# - for each size, in ascending order, a variable length list of field +# indexes. +# +# The compromise here is that I want to minimize linear searches. Memory +# use is considered secondary, hence the back `pointer' to the struct in the +# fields array. +# +# No attempt is made to share name pointers when multiple fields share +# the same name. Rewriting this script in perl, or any other language +# with hash data structures, would be a good time to add this. + +BEGIN { + depth = 0; + ignore = 0; + scnt = 0; # current struct count + sidx = -1; # current struct index + # field index #0 is used as a sentinel. + fcnt = 1; # current field count + fidx = 0; # current field index + ocnt = 0; # current offset count + zcnt = 0; # current size count + +} +/^struct / { + depth = 1; + sidx = scnt; + sname[sidx] = $2; + ssize[sidx] = $6; + sfieldmin[sidx] = fcnt; + scnt++; + #printf("struct %d %s (size %d)\n", sidx, $2, $6); + next; +} +/^};/ { + if (depth != 0) { + depth = 0; + if (fcnt == sfieldmin[sidx]) # empty struct, ignore it + scnt--; + else + sfieldmax[sidx] = fidx; + } else + ignore--; + next; +} +/{.*}/ { + # single line enum + next; +} +/{/ { + # subcomponent + if (depth != 0) { + depth++; + } else { + ignore++; + } + next; +} +/}/ { + if (ignore != 0) { + ignore--; + next; + } else { + depth--; + } + if (depth != 1) + next; + # FALLTHROUGH +} +/bitsize/ { + if (ignore != 0) + next; + if (depth != 1) + next; + + # Bitfields are a PITA... From a ddb point of view, we can't really + # access storage units smaller than a byte. + # So we'll report all bitfields as having size 0, and the + # rounded down byte position where they start. + cursize = int($(NF - 3)); + curoffs = int($(NF - 1) / 8); + if ((cursize % 8) != 0) + cursize = 0; + else + cursize /= 8; + + # try and gather the field name. + field = $(NF - 6); + if (field == "};") { + # anonymous union. discard it. + next; + } + if (field == "*/);") { + field = $(NF - 9); # function pointer + # remove enclosing braces + field = substr(field, 2, length(field) - 2); + } + colon = index(field, ":"); + if (colon != 0) + field = substr(field, 1, colon - 1); + else if (substr(field, length(field), 1) == ";") + field = substr(field, 1, length(field) - 1); + + while (index(field, "*") == 1) + field = substr(field, 2); + + # This could be an array. If it is, we need to trim the field + # name and update its size to a single member size. + obracket = index(field, "["); + cbracket = index(field, "]"); + if (obracket != 0) { + obracket++; + nitems = substr(field, obracket, cbracket - obracket); + field = substr(field, 1, obracket - 2); + cursize /= nitems; + } else + nitems = 1; + + fidx = fcnt; + fname[fidx] = field; + foffs[fidx] = curoffs; + fsize[fidx] = cursize; + fitems[fidx] = nitems; + fstruct[fidx] = sidx; + fcnt++; + #printf(" %s at %d len %d\n", field, curoffs, cursize); + + # Remember size and offset if not found yet + + for (i = 0; i < ocnt; i++) + if (offs[i] == curoffs) + break; + if (i == ocnt) { + # keep array sorted + for (i = 0; i < ocnt; i++) + if (offs[i] > curoffs) + break; + if (i < ocnt) { + for (j = ocnt + 1; j > i; j--) + offs[j] = offs[j - 1]; + } + offs[i] = curoffs; + ocnt++; + } + + for (i = 0; i < zcnt; i++) + if (sizes[i] == cursize) + break; + if (i == zcnt) { + # keep array sorted + for (i = 0; i < zcnt; i++) + if (sizes[i] > cursize) + break; + if (i < zcnt) { + for (j = zcnt + 1; j > i; j--) + sizes[j] = sizes[j - 1]; + } + sizes[i] = cursize; + zcnt++; + } +} +END { + printf("/*\n"); + printf(" * THIS IS A GENERATED FILE. DO NOT EDIT!\n"); + printf(" */\n\n"); + + printf("#include <sys/param.h>\n"); + printf("#include <sys/types.h>\n"); + printf("\n"); + + # structure definitions + + printf("struct ddb_struct_info {\n"); + printf("\tconst char *name;\n"); + printf("\tsize_t size;\n"); + printf("\tuint fmin, fmax;\n"); + printf("};\n"); + + printf("struct ddb_field_info {\n"); + printf("\tconst char *name;\n"); + printf("\tuint sidx;\n"); + printf("\tsize_t offs;\n"); + printf("\tsize_t size;\n"); + printf("\tuint nitems;\n"); + printf("};\n"); + + printf("struct ddb_field_offsets {\n"); + printf("\tsize_t offs;\n"); + printf("\tconst uint *list;\n"); + printf("};\n"); + + printf("struct ddb_field_sizes {\n"); + printf("\tsize_t size;\n"); + printf("\tconst uint *list;\n"); + printf("};\n"); + + # forward arrays + + printf("#define NSTRUCT %d\n", scnt); + printf("static const struct ddb_struct_info ddb_struct_info[NSTRUCT] = {\n"); + for (i = 0; i < scnt; i++) { + printf("\t{ \"%s\", %d, %d, %d },\n", + sname[i], ssize[i], sfieldmin[i], sfieldmax[i]); + } + printf("};\n\n"); + + printf("#define NFIELD %d\n", fcnt); + printf("static const struct ddb_field_info ddb_field_info[NFIELD] = {\n"); + printf("\t{ NULL, 0, 0, 0 },\n"); + for (i = 1; i < fcnt; i++) { + printf("\t{ \"%s\", %d, %d, %d, %d },\n", + fname[i], fstruct[i], foffs[i], fsize[i], fitems[i]); + } + printf("};\n\n"); + + # reverse arrays + + printf("static const uint ddb_fields_by_offset[] = {\n"); + w = 0; + for (i = 0; i < ocnt; i++) { + cmp = offs[i]; + ohead[i] = w; + for (f = 1; f < fcnt; f++) + if (foffs[f] == cmp) { + if ((w % 10) == 0) + printf("\t"); + printf("%d, ", f); + w++; + if ((w % 10) == 0) + printf("\n"); + } + if ((w % 10) == 0) + printf("\t"); + printf("0, "); + w++; + if ((w % 10) == 0) + printf("\n"); + } + if ((w % 10) != 0) + printf("\n"); + printf("};\n\n"); + + printf("#define NOFFS %d\n", ocnt); + printf("static const struct ddb_field_offsets ddb_field_offsets[NOFFS] = {\n"); + for (i = 0; i < ocnt; i++) { + printf("\t{ %d, ddb_fields_by_offset + %d },\n", + offs[i], ohead[i]); + } + printf("};\n\n"); + + printf("static const uint ddb_fields_by_size[] = {\n"); + w = 0; + for (i = 0; i < zcnt; i++) { + cmp = sizes[i]; + zhead[i] = w; + for (f = 1; f < fcnt; f++) + if (fsize[f] == cmp) { + if ((w % 10) == 0) + printf("\t"); + printf("%d, ", f); + w++; + if ((w % 10) == 0) + printf("\n"); + } + if ((w % 10) == 0) + printf("\t"); + printf("0, "); + w++; + if ((w % 10) == 0) + printf("\n"); + } + if ((w % 10) != 0) + printf("\n"); + printf("};\n\n"); + + printf("#define NSIZES %d\n", zcnt); + printf("static const struct ddb_field_sizes ddb_field_sizes[NSIZES] = {\n"); + for (i = 0; i < zcnt; i++) { + printf("\t{ %d, ddb_fields_by_size + %d },\n", + sizes[i], zhead[i]); + } + printf("};\n"); +} |