Subject: kern/33961: current amd64 GENERIC with KGDB fails to build
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <murray@river-styx.org>
List: netbsd-bugs
Date: 07/10/2006 03:55:00
>Number:         33961
>Category:       kern
>Synopsis:       current amd64 GENERIC with KGDB fails to build
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 10 03:55:00 +0000 2006
>Originator:     Murray Armfield
>Release:        NetBSD-current
>Organization:
N/A
>Environment:
NetBSD 3.99.21 amd64
>Description:
Trying to build an amd64 GENERIC kernel with DDB disabled and KGDB enabled as documented on "NetBSD kernel debugging with KGDB" web page from NetBSD web site fails to link kernel.

<snip from build log follows...>

#      link  GENERIC/netbsd
/usr/NetBSD/build/tools/bin/x86_64--netbsd-ld -T /usr/src/sys/arch/amd64/conf/kern.ldscript -Ttext 0xffffffff80100000 -e start -X -o netbsd ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
com.o: In function `comintr':
/usr/src/sys/dev/ic/com.c:2122: undefined reference to `kgdb_connect'
kgdb_stub.o: In function `kgdb_trap':
/usr/src/sys/kern/kgdb_stub.c:385: undefined reference to `kgdb_getregs'
/usr/src/sys/kern/kgdb_stub.c:408: undefined reference to `kgdb_signal'
/usr/src/sys/kern/kgdb_stub.c:380: undefined reference to `kgdb_signal'
/usr/src/sys/kern/kgdb_stub.c:444: undefined reference to `kgdb_acc'
/usr/src/sys/kern/kgdb_stub.c:423: undefined reference to `kgdb_setregs'
/usr/src/sys/kern/kgdb_stub.c:475: undefined reference to `kgdb_acc'
subr_prf.o: In function `panic':
/usr/src/sys/kern/subr_prf.c:220: undefined reference to `kgdb_panic'
/usr/src/sys/kern/subr_prf.c:220: undefined reference to `kgdb_panic'
machdep.o: In function `init_x86_64':
/usr/src/sys/arch/amd64/amd64/machdep.c:1540: undefined reference to `kgdb_connect'
wskbd.o: In function `wskbd_translate':
/usr/src/sys/dev/wscons/wskbd.c:1506: undefined reference to `kgdb_connect'

*** Failed target:  netbsd

</snip>
Then there is the big line echoing the failed command. I have left this out just because its quite long. If anyone would like it, just ask.
>How-To-Repeat:
see http://www.netbsd.org/Documentation/kernel/kgdb.html

<snip from web page follows...>

Comment out the following lines in the kernel config file for the TARGET machine: 

  #options 	DDB			# in-kernel debugger
  #options 	DDB_HISTORY_SIZE=100	# enable history editing 

and uncomment (or add) the following three lines:


  options 	KGDB		# remote debugger
  options 	"KGDB_DEVNAME=\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
  makeoptions	DEBUG="-g"	# compile full symbol table

</snip>

Then build the kernel...
./build.sh kernel=GENERIC
>Fix:
I haven't looked further