Date: Fri, 27 Apr 2001 11:05:17 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Hans-Bernhard Broeker 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 In-reply-to: (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: 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 Precedence: bulk > Date: Thu, 26 Apr 2001 18:49:02 +0200 (MET DST) > From: Hans-Bernhard Broeker > > > 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?