This content is not currently approved and is visible here for review only.

Library tutorials & articles

Disclose Program’s Code and Static Data Size

Page 2 of 2
  1. State of the art
  2. Code/Data Size Analyzer

Code/Data Size Analyzer

Sections in map file

 

·        Executable code section, .text

We may disclose the object code size based on this section.

 

·        Data sections, .bss, .rdata, .data

The .bss section represents un-initialized data for the application, including all variables declared as static within a function or source module.

 

The .rdata section represents read-only data, such as literal strings, constants, and debug directory information.

 

All other variables (except automatic variables, which appear on the stack) are stored in the .data section. Basically, these are application or module global variables.

 

·        Resources section, .rsrc

The .rsrc section contains resource information for a module. It begins with a resource directory structure like most other sections, but this section's data is further structured into a resource tree.

 

·        Export data section, .edata

The .edata section contains export data for an application or DLL. When present, this section contains an export directory for getting to the export information.

 

·        Import data section, .idata

The .idata section is import data, including the import directory and import address name table.

.CRT is another initialized data section utilized by the Microsoft C/C++ run-time libraries (hence the name).

 

II. The contribution of code/data size analyzer in StateWizard

 

As you can notice, map file is a mine of informations about code and data size used by your programs but the problem whith such files is that they are so complicated and long that their analysis is rarely fruitful. Such a job has to be automated .

 

The contrubution of this feature of  UML StateWizard is to automate the analysis of map files which are generally very long and complicated to be analysed manually. In other words, it summerises the contents of the map file generated in linking in a very clear and useful way.

 

This tool discloses your program's code size, read-only data, un-initialized data and writable data usage for each object based on the generated map file. Further more, this tool can uncover every variable data length in detail.

 

    * Object Name

    * Code Length

    * Read-only Size

    * Writable Data Size

    * Un-initialized Data Size

 

The output of the code/data size analyzer

 

                       

UML StateWizard Code/Data Analyzer presents a detailed report about your programs memory allocation as follows :

 

*** UML StateWizard Code/Data Analyzer ***

 

Map File Name: <input map file name>

 

Code/Data Size in Bytes:

************************************************************************************

Object Name                               Code        ReadOnly  Un-initialized        Writable        Code Addr

-------------------------------------------------------------------------------------------------------------------

<object name>                              <#>              <#>           <#>                  <#>                   <#>

-------------------------------------------------------------------------------------------------------------------

Total Size                                     <Code>         <#>           <#>                  <#>

 

Readonly Data Size in Detail:

************************************************************************************

Object Name                    Variable                    Size               Start Address

-------------------------------------------------------------------------------------------------------------------

<object name>                  <variable>                 <#>              <#H>

-------------------------------------------------------------------------------------------------------------------

Total in Object                                                    <#>

 

 

Un-initialized Data Size in Detail:

************************************************************************************

Object Name                    Variable                    Size               Start Address

-------------------------------------------------------------------------------------------------------------------

<object name>                  <variable>                 <#>              <#H>

-------------------------------------------------------------------------------------------------------------------

Total in Object                                                    <#>

 

 

Writable Data Size in Detail:

************************************************************************************

Object Name                    Variable                    Size               Start Address

-------------------------------------------------------------------------------------------------------------------

<object name>                  <variable>                 <#>              <#H>

-------------------------------------------------------------------------------------------------------------------

Total in Object                                                    <#>

 

About UML StateWizard

 

This article presents the Code/Data Analyzer  functionality of UML StateWizard,  a round-trip UML dynamic modeling and development tool running as an add-in to most popular IDEs. StateWizard aims at provide a concurrent, distributed and real-time oriented application development tool.

 

You may download more information at http://www.intelliwizard.com/ the official site of the UML StateWizard open source project under LGPL license.

 

StateWizard Quick Usual Manual

 

StateWizard is a pop-menu driven IDE add-in. After installing StateWizard. For VC6/EVC4, open add-in manager through Tool/Customize/Add-ins. If you have gotten the Toolbar, please close the current workspace if a workspace is open. And then reopen a VC6 workspace, you will get the StateTree tab window, because the StateWizard create StateTree tab window on workspace creating.

 

For VS2003/VS2005, this add-in is automatically enabled. And then StateWizard will provide a tool bar for you. Click "Show" button in the StateWizard tool bar, StateWizard will show the StateTree window. In the StateTree window, you can create a new state machine application into the seclected project; you can add a new state into the selected application or state. Futher more you can construct a state machine using the StateChart too.

 

Download StateWizard

http://www.intelliwizard.com/down/StateWizard.zip

 

 

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Disclose Program’s Code and Static Data Size.

Leave a comment

Sign in or Join us (it's free).

AddThis