delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/04/27/05:25:17

Date: Fri, 27 Apr 2001 11:05:17 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <2950-Fri27Apr2001110516+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp-workers AT delorie DOT com, Charles Sandmann <sandmann AT clio DOT rice DOT edu>
In-reply-to: <Pine.LNX.4.10.10104261844250.592-100000@acp3bf> (message from
Hans-Bernhard Broeker on Thu, 26 Apr 2001 18:49:02 +0200 (MET DST))
Subject: Re: sbrk() storing the size of memory blocks
References: <Pine DOT LNX DOT 4 DOT 10 DOT 10104261844250 DOT 592-100000 AT acp3bf>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Thu, 26 Apr 2001 18:49:02 +0200 (MET DST)
> From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
> 
> > You could always cast the references with the appropriate type, of
> > course.  
> 
> I tried that, but for some reason I couldn't quite make out, it didn't
> seem to work.

Something like this should do, put it into gdb.ini:

    define memory_handle
    echo {\ 
    output/x *(long *)((char *)&__djgpp_memory_handle_list + 8*$arg0)
    echo ,
    output/x *(unsigned *)((char *)&__djgpp_memory_handle_list + 8*$arg0 + 4)
    echo }\n
    end
    document memory_handle
    Usage: memory_handle N
    Print the contents of the memory handle structure whose index
    in the __djgpp_memory_handle_list[] array is given as an argument.
    end

Note that the first handle is for the stub, and all the others list
the addresses relative to the DS base address.  In a program that uses
Unixy sbrk algorithm, you will probably see only 1 handle; unused ones
are zeroed.

Btw, the `handle' member of the structure seems to have its MSB set,
at least on Windows (that's why I used "output/x").  So its
declaration in crt0.h should probably changed to unsigned instead of
long.  Charles, am I right?

- Raw text -


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