From owner-freebsd-emulation Mon Sep 8 05:33:51 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id FAA27407 for emulation-outgoing; Mon, 8 Sep 1997 05:33:51 -0700 (PDT) Received: from zwei.siemens.at (zwei.siemens.at [193.81.246.12]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id FAA27397 for ; Mon, 8 Sep 1997 05:33:43 -0700 (PDT) Received: from p0.hai.siemens.co.at (root@firix [10.1.143.100]) by zwei.siemens.at with SMTP id OAA02780 for ; Mon, 8 Sep 1997 14:30:44 +0200 (MET DST) Received: from zerberus.hai.siemens.co.at by p0.hai.siemens.co.at with smtp (Smail3.1.28.1 #7 for ) id m0x82xp-00074OC; Mon, 8 Sep 97 14:30 MET DST Received: from zerberus (localhost) by zerberus.hai.siemens.co.at (4.1/SMI-4.1) id AA19325; Mon, 8 Sep 97 14:32:29 +0200 Message-Id: <3413F05C.41C67EA6@zerberus.hai.siemens.co.at> Date: Mon, 08 Sep 1997 14:32:28 +0200 From: Helmut Wirth Organization: Siemens AG. Österreich X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 4.1.4 sun4c) Mime-Version: 1.0 To: emulation@freebsd.org Subject: Doscmd, debugging with gdb Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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)