delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/10/28/11:11:07

Date: Mon, 28 Oct 1996 18:04:58 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Robert Hoehne <robert DOT hoehne AT mathematik DOT tu-chemnitz DOT de>
Cc: DJGPP workers <djgpp-workers AT delorie DOT com>,
Charles Sandmann <sandmann AT clio DOT rice DOT edu>
Subject: Re: function _exit() and about dbgcom.c
In-Reply-To: <Pine.HPP.3.95.961028104536.27613A-100000@newton.mathematik.tu-chemnitz.de>
Message-Id: <Pine.SUN.3.91.961028174640.17468D-100000@is>
Mime-Version: 1.0

On Mon, 28 Oct 1996, Robert Hoehne wrote:

> As far as I understood the code in dbgcom.c NO. The v2loadimage()
> creates a new PSP for the image and puts it in the stubinfo or

Charles already confirmed what I suspected: that's a fake PSP which is 
only good enough if neither the debuggee nor the debugger do anything 
that changes the contents of the PSP.  In particular, if any one of them 
crosses the 20 open files threshold, which causes DOS to allocate a 
larger table for the handles, the fake PSP will still hold a pointer to 
an old table.  (Hmm... this means that after that, `fstat' in the 
debuggee won't work... seems like a subtle bug to me.)

> But I'm not so familiar with this low level DOS programming. I have
> looked also in the code of stat() and fstat() where are some code
> with the filehandle table, but I didn't understand it yet in
> all details.

Since I wrote that code, I hope I can explain everything there 8-).  Just
ask what you want to know.  I still don't understand how would you know
which handle belongs to the debugger and which to the debuggee, though. 
In fact, I don't even see how can the debugger access the handles used by
the debuggee.  They use different instances of the data structures inside
file-oriented libc functions (since each has its own copy of the libc
functions), and so a file handle that was open by the debuggee might be
invalid for the debugger, and vice versa. 

Maybe if I understood better the problem that you are trying to solve, I 
could think about a way to overcome these difficulties.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019