Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Sep 1997 14:32:28 +0200
From:      Helmut Wirth <wirth@zerberus.hai.siemens.co.at>
To:        emulation@freebsd.org
Subject:   Doscmd, debugging with gdb
Message-ID:  <3413F05C.41C67EA6@zerberus.hai.siemens.co.at>

next in thread | raw e-mail | index | archive | help
Hello,
I have problems debugging doscmd with gdb. I would appreciate any hints
how to do this. Here is the situation:

Doscdm needs the lowest 1MB of virtual addresses for the DOS (VM86) -
applikations to run. The emulator therefore resides at addresses higher
than 1MB. This is done with a trick: A doscmd loader is started (this
is the command one types in) and the loader in turn expands its data
area and loads the doscmd.kernel starting over 1MB (actually its start
address is 0x110000). doscmd.kernel is the emulator itself, it then
proceeds to initialize the VM86 system. (In future we may need to load
doscmd.kernel even higher, when DPMI emulation runs).

The problem: Starting doscmd under gdb loads the symboltable of the
loader, not of doscmd.kernel. This is easy to solve (symbol-file ..).
There are other troubles (with the signals, for example,..) but there
are solutions for this too. I can trace into doscmd.kernel, load its
symbols, list the functions, handle the signals correctly (nostop, pass
for SIGBUS) and continue the program. But I cannot set breakpoints!

I tried the following:
1) load doscmd under gdb, set breakpoint before call to doscmd.kernel
   entry, step into doscmd.kernel. If I then try to set a breakpoint
   gdb accepts it, but when I tell it to continue, it cannot set the
   breakpoint. ("Cannot set breakpoint, bad address 0x....).
2) Attach to the running doscmd. gdb attaches fine, I can read the 
   symbol table using the symbol-file command or the -symbol option.
   Doscmd stops when gdb attaches itself, and I can examine the 
   registers and memory. But again it cannot set any breakpoints, the
   same error as under 1) occurs.

I think the reason for this is, that ptrace knows the text segment of
the original loader, and it refuses to set breakpoints into what it 
sees as the data area of a program.

Btw: doscmd.loader is linked as a normal ZMAGIC process, doscmd.kernel
is linked as NMAGIC process.

Has somebody an idea how to solve this? It would greatly enhance my
productivity :-).

Thank you
-- 
Helmut F. Wirth                          
---------------
E-mail:           hfwirth@ping.at
E-mail (at work): wirth@zerberus.hai.siemens.co.at 
Tel.  :           +43-1-1707-37610 (at work)		 
FAX   :           +43-1-1707-57602 (at work)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3413F05C.41C67EA6>