How to determine contents of data segment?

This is a discussion on How to determine contents of data segment? within the Pascal forums in Programming Languages category; On Mar 3, 3:15 pm, Robert Riebisch <Robert.Riebi...@arcor.de> wrote: > Jim Leonard wrote: > > So, does anyone know of a nice .map analyzer utility out there, to > > prevent me from re-inventing the wheel? :-) > > Erm... What do you need this tool for? All info is already in the .map > file. Yes, but I am not going to visually inspect a ~200KB .MAP file looking for the largest chunks of the DATA segment. I will probably write a small utility to analyze the .MAP file, determine the sizes of every element, and then print out ...

Go Back   Application Development Forum > Programming Languages > Pascal

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #11  
Old 03-03-2008, 08:16 PM
Jim Leonard
Guest
 
Default Re: How to determine contents of data segment?

On Mar 3, 3:15 pm, Robert Riebisch <Robert.Riebi...@arcor.de> wrote:
> Jim Leonard wrote:
> > So, does anyone know of a nice .map analyzer utility out there, to
> > prevent me from re-inventing the wheel? :-)

>
> Erm... What do you need this tool for? All info is already in the .map
> file.


Yes, but I am not going to visually inspect a ~200KB .MAP file looking
for the largest chunks of the DATA segment.

I will probably write a small utility to analyze the .MAP file,
determine the sizes of every element, and then print out the 10
largest ones or something.
Reply With Quote
  #12  
Old 03-04-2008, 02:05 AM
Klaus Jorgensen
Guest
 
Default Re: How to determine contents of data segment?

Jim Leonard wrote :
>
> I will probably write a small utility to analyze the .MAP file,
> determine the sizes of every element, and then print out the 10
> largest ones or something.


Import the map file into an Excel sheet with the hex offsets in column
A and the symbol names in column B.
Then use the formula "=HEX2BIN(A2)-HEX2BIN(A1)" in column C - that is,
depending on which row is on top.
Copy column C to column D with values only - then sort on column D.

--

/klaus


Reply With Quote
  #13  
Old 03-04-2008, 10:30 AM
Jim Leonard
Guest
 
Default Re: How to determine contents of data segment?

On Mar 4, 1:05 am, Klaus Jorgensen <k...@no.spam> wrote:
> Import the map file into an Excel sheet with the hex offsets in column
> A and the symbol names in column B.
> Then use the formula "=HEX2BIN(A2)-HEX2BIN(A1)" in column C - that is,
> depending on which row is on top.
> Copy column C to column D with values only - then sort on column D.


I'll try that tonight, thanks very much!

Always learning, even after 20 years of working with TP... This
exercise has clued me into a few things:

- foo:string is the same as foo:string[255] (knew this already but
it's a good reminder never to use empty strings again)

- PChar arrays (aka defined as const foo:PChar='testing') take up
space in the data segment :-/

- The compiler takes advantage of the fact that PChar arrays are
pointers to null-terminated strings and is smart enough to optimize
100% identical contents by only having one copy and the others
reference it via pointers. I was not expecting that at all; that is
very cool.
Reply With Quote
  #14  
Old 03-05-2008, 10:12 AM
Jim Leonard
Guest
 
Default Re: How to determine contents of data segment?

On Mar 4, 1:05 am, Klaus Jorgensen <k...@no.spam> wrote:
> Then use the formula "=HEX2BIN(A2)-HEX2BIN(A1)" in column C - that is,


Hm... Excel 2003's HEX2BIN claims in the helpfile that it doesn't
support numbers over 1FF.

I'll write my utility anyway :-)
Reply With Quote
  #15  
Old 03-05-2008, 12:05 PM
Klaus Jorgensen
Guest
 
Default Re: How to determine contents of data segment?

Jim Leonard wrote :
> On Mar 4, 1:05 am, Klaus Jorgensen <k...@no.spam> wrote:
>> Then use the formula "=HEX2BIN(A2)-HEX2BIN(A1)" in column C - that is,

>
> Hm... Excel 2003's HEX2BIN claims in the helpfile that it doesn't
> support numbers over 1FF.
>
> I'll write my utility anyway :-)


Sorry - my fingers or keyboard must have had an off day....
Should have been HEX2DEC and not HEX2BIN.

--

/klaus


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:44 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.