Content-type: text/html Manpage of GDB2NDI


Section: User Commands (1)
Updated: September 2004
Index Return to Main Contents


gdb2ndi - gdb2ndi  


usage: gdb2ndi [OPTION].. [-g gdb-executable gdb-options...]

gdb2ndi translates the gdb remote debugger protocol to the netware server remote debugger protocol (ndi).

The nlm-name (from the servers point of view) and the ip-address assigned to RDedbug/DBNet (or the serial port) has to be specified, the other parameters are optional

-p, --listen-port
specifies the ip port to listen, gdb has to connect to this port (target remote ip:port) default: 15000
-d, --gdb-debug-level
increase debug level for gdb communication
-D, --ndi-debug-level
increase debug level for nw-server communication
-n, --nlm=name
nlm name for the server (i.e. sys:test/test.nlm)
-a, --attach
Attach to loaded nlm
-r, --server-ip=name or ip
rdebug/dbnet ip address of the server
-x, --exit-ndi-host
exit server remote debugger after session
-t, --auto-activate
auto activate rdebug dbnet on the server, gdbhelp.nlm needs to be loaded
-l, --auto-load
auto load the nlm, can only be used with -a and -t The nlm will be loaded via gdbhelp.nlm, needed for the broken debugger on netware 6.5 sp2+sp3
-c, --disable-mem-cache
disable gdb2ndi memory read cache
start gdb, this has to be the last parameter. The first parameter after -g has to be name of the gdb executable, all other parameters following will be passed to gdb. If -g is not specified, gdb2ndi waits until gdb has closed the connecion or the nlm has been unloaded
-P, --serial-port=comX
Specifies com port to be used for serial connection
-B, --baud=x
Baudrate for Serial connection, default 115200 The baudrate has also be specified on the Server with rdebug serial com1 baud=x
-V, --version
Output version information and exit


gdb2ndi -n sys:test/hello.nlm -r -p 5555

Load the nlm sys:test/hello.nlm, connect to RDebug/DBNet at and wait for a gdb connection on port 5555

or Serial:

gdb2ndi --nlm=sys:test/hello.nlm --serial-port=/dev/ttyS0 --baud=115200

Load the nlm sys:test/hello.nlm, connect to RDebug/DBNet via Serial Port com1 at 115200 baud and wait for a gdb connection on port 5555



gdb2ndi supports the following gdb remote commands:

g read registers

c continue
     c address continue at address

s step

s address step from address

m address,length read memory, a maximum length of 1024 bytes per call is supported. gdb2ndi implements a simple cache, it will try to read 256 bytes from ndi and buffer that. (Because gdb always reads only one byte). The cache will be flushed by c,s and M. Cache can be disabled with the -c switch.

M address,length write memory, a maximum length of 1024 bytes per call is supported

Z0,z0 set/clear breakpont

Z2,z2 set/clear Hardware write watchpoint

Z3,z3 set/clear Hardware read watchpoint. Because i dont know if a read watchpoint works, z3 sets a read/write watchpoint

Z4,z4 set/clear Hardware read/write watchpoint

? Indicate the reason the target halted

qThreadExtraInfo Returns information for the specified thread

qOffsets Returns Text, Data and Bss address of the loaded nlm

qfThreadInfo Threadlist first (a maximum number of 16 threads will be delivered per call)

qsThreadInfo Threadlist next (a maximum number of 16 threads will be delivered per call)

qC return current thread

Hc set thread (Continue/Step). Not supported but gdb2ndi returns OK

Hg set thread (Other operations). Not supported but gdb2ndi returns OK

Gdb does not work with thread numbers greater 0x7ffffff and (at least on my netware 6 testserver) all netware thread ids are greater. gdb2nlm reports threads beginning with 1 to gdb. These numbers are unique in a gdb session, newly created threads will be reported with a number greater than the last used one.  


Enter the internal Debugger

Enter the debugger by pressing shift shift alt esc.

Start serial

Enter rdebug serial baud=115200 in case the server responds with Serial Port Address error, try rdebug serial port=3f8 baud=115200 for com1 or rdebug serial port=2f8 baud=115200 for com2

At least netware6.5, 6.0 and 5.1 provides debug output for rdebug, try rdebug help

The parameters after rdebug have to be provided only once. The second time you can enter and it will start with the same parameters. You can also save the parameters in the file rdebug.cfg (has to be on the dos partition in the same path as server.exe)

Please note that the serial communication will not work correct when rdebug debug or rdebug low is active. This is because the server will flush the input buffer after processing a packet. I assume that the screen output will take some time so that in case two packets will be send, the start of the second packet will be lost. gdb2ndi will retry the command but that makes the communication very slow.

I have tested serial communication with netware 6.0 sp2 and netware 5.1 sp5.

Start over Ethernet

The netware internal debugger provides support for ne2000 and compatible isa cards only. Other cards can be used with dbnet5/dbnet6.nlm.

Enter the internal debugger and start rdebug with rdebug ne2000 ip= port=320

Replace the ip with one address of your subnet and the port with the i/o port your ne2000 is configured.

I have tested ethernet communication with netware 6 sp2 and netware 4.11. For netware 4.11 you have to load rdebug.nlm, only netware 5 and up has internal support for ne2000 cards. For other cards DBNET5/DBNET6.NLM has to be used. DBNETx.NLM has to be loaded with the parameter /ndi and the command would be "rdebug dbnet".

Netware 6.5 sp2 and sp3 beta will not work the standard way because of bugs in the internal debugger. gdb2ndi provides a workaround. You have to use the -a (attach) parameter and load the nlm manual via the load command at the server console. To do this automaticly (also with auto invoke of rdebug dbnet) you can load gdbhelp.nlm on the server and use the -t and -l switch in addition to -a. gdbhelp is a simple nlm that waits for a tcp connection on port 15001. I accepts a text with the value "EnterDebugger" and optional "EnterDebugger NLM=NlmToLoad". It will post "rdebug dbnet" to the internal debugger and invoke it. Next it will do a SYSTEM "load NlmToLoad". Because of that really simple nature, never load gdbhelp on a production server.  


Lets assume we are using ethernet and the server has the ip The nlm we want to debug is sys:test/hello.nlm. We will run gdb2ndi in a separate console to see what happens.

First start rdebug on the server so that the server will wait for incoming rdebug connections over ethernet.

start gdb2ndi

gdb2ndi --listen-port=12000 -d -d -D -D --nlm=sys:test/hello.nlm --server-ip=

or with auto debugger invoke and autoload of the nlm with loaded gdbhelp.nlm:

gdb2ndi --listen-port=12000 -d -d -D -D --nlm=sys:test/hello.nlm --server-ip= --attach --auto-activate --auto-load

you will something like this:

connected to netware debugger on server "FS-NW65"
ndi server verion: 1.3 local api version: 1.0
loading sys:test/hello.nlm ....
EVENT_NLM_LOAD: NlmH:0xd7a6b21 CodeStart:0xd0a9e000 CodeSize:127248
DataStart:0xd172a000 DataSize:281288 StartAddr:0xd0a9e01d
DebugFlag:0 name: "HELLO.NLM"
current ndi thread: 0xd09cb3e0
got ndi-Event: EVENT_EXCEPTION SOFT_BREAKPOINT lastSignal:5 Thread:0xd09cb3e0
connected to netware debugger on server FS-NW65
sys:test/hello.nlm loaded and executed to thread start-address at 0xd17b80a0
sys:test/hello.nlm loaded, waiting for gdb connection on port 12000

All messages except first two and the last one will only be shown with activated debug options.

now you can start gdb (you need a version with netware support compiled in, see COMPILING GDB). I have named my version gdbnw.

gdbnw hello.nlm
GNU gdb Novell Netware (5.3-1)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-redhat-linux --target=i386-netware"...
(gdb) target remote localhost:12000
Remote debugging using localhost:12000
$d17b80a0 in ?? ()
(gdb) break main
Breakpoint 1 at $d0abcf2b: file hello.pas, line 49.
(gdb) cont

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at hello.pas:49
49 System.NetwareCodeStartAddress := 0; // disable lineinfo for now


Its simple, configure gdb with


configure --target=i386-pc-netware

and start make. Some gdb-versions will stop in the directory gdb/nlm with errors (GDBSERVE does not support this target). We dont need this, it is the old gdbserver.nlm. In that case, edit the file gdb/configure.tgt, search for nlm and remove nlm in all configdirs.


configdirs=${configdirs} nlm ;;


configdirs=${configdirs} ;;

gdb/ needs a similar change, search for nlm: and remove the nlm subdir in the next line


... DO=all DODIRS=nlm subdir_do


... DO=all DODIRS=subdir_do

now do configure --target=i386-pc-netware and make. I have compiled gdb for netware for redhat linux and cygwin win32.  


Currently i dont know the structure for the floating point registers returned by ndi. st0 to st7 are sent to gdb and they are shown in gdb exactly like the RF command on the server but the rest is missing.  


Report bugs to <>



configure --target=i386-pc-netware
configdirs=${configdirs} nlm ;;
configdirs=${configdirs} ;;
... DO=all DODIRS=nlm subdir_do
... DO=all DODIRS=subdir_do

This document was created by man2html using the manual pages.
Time: 20:09:41 GMT, September 25, 2004