# Trying to get kgdb over serial to work



## fflorens (Dec 3, 2017)

Hello everyone, im trying to launch a remote debug session on a freebsd host.
Both freebsd system are the exact same install (hardware and software, FreeBSD 11.1)
Kernel config is GENERIC with added debug options :


```
options     DDB
options     GDB
options     KDB_UNATTENDED
options     DEADLKRES 
options     INVARIANTS
options     INVARIANT_SUPPORT
options     WITNESS
options     WITNESS_SKIPSPIN
options     MALLOC_DEBUG_MAXZONES=8
```
flags for the uart serial console set to 0x80.
Serial connection is working (tried to echo from both machine and can read the results on the other one)

No matter if i break into ddb from boot using `boot -d` or using `sysctl debug.kdb.enter=1` i get this message on the remote debugger after issuing the `gdb` command on the debug target.


```
(kgdb) target remote /dev/cuau0
Remote debugging using /dev/cuau0
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Couldn't establish connection to remote target
Malformed response to offset query, timeout
(kgdb)
```
output of `uname -a` :

```
FreeBSD bsd-dev 11.1-RELEASE FreeBSD 11.1-RELEASE #2: Sat Dec  2 21:18:33 CET 2017     root@bsd-dev:/usr/obj/usr/src/sys/DEBUG  amd64
```
If anyone can shed some lights on this matter, i would really appreciate.

Regards,
fflorens


----------



## SirDice (Dec 6, 2017)

Have you looked at Developer's Handbook: 10.5. On-Line Kernel Debugging Using Remote GDB?


----------



## fflorens (Dec 8, 2017)

Yes followed the guide, when typing `gdb` inside ddb, it just outputs 
	
	



```
switching to gdb back-end
```
 and that's all, on the other side i recieve what i wrote in my first post.

Regards,
Florian.


----------



## fflorens (Dec 22, 2017)

Found out a few days ago, that kgdb over serial require a 32bits installation, reisntalling both sides with the i386 build of freebsd made it to work.
But im having issues loading the symbol table on the debugger side, does any one has experience with this ?


----------

