Changes between Version 1 and Version 2 of TBR/Review/Debugging/Start


Ignore:
Timestamp:
Oct 4, 2005, 7:49:01 PM (15 years ago)
Author:
JoelSherrill
Comment:

/* How much memory is left in the C Program Heap? */

Legend:

Unmodified
Added
Removed
Modified
  • TBR/Review/Debugging/Start

    v1 v2  
    4848
    4949{{{
    50   (gdb) p '''((Region''Control ''')''Region''Information->local''table<nowiki>[</nowiki>1])->Memory->first
    51   $9 <tt> {back''flag </tt> 1, front''flag <tt> 8058280, next </tt> 0x7ea5b4, previous = 0x7ea5b0}
     50  (gdb) p ((Region_Control *)_Region_Information->local_table[1])->Memory->first
     51  $9 {back_flag=1, front_flag=8058280, next=0x7ea5b4, previous=0x7ea5b0}
    5252}}}
    5353
    5454Let's look at that gdb command in more detail.
    5555
    56  * ''Region''Information_ contains the information used to manage Region objects.
    57  * ''Region''Information->local_table is the object pointer table for Regions.  It is
     56 * ''_Region_Information'' contains the information used to manage Region objects.
     57 * ''_Region_Information->local_table'' is the object pointer table for Regions.  It is
    5858  indexed by the ''object index'' portion of the object ID.
    59  * ''Region''Information->local''table<nowiki>[</nowiki>1] points to the first Region object.  It is of type ''(Region''Control *)''.
    60  * ((Region''Control *)''Region''Information->local''table<nowiki>[</nowiki>1])->Memory points to the Heap control portion of this Region's control block.
    61  * '''((Region''Control ''')''Region''Information->local''table<nowiki>[</nowiki>1])->Memory->first references the contents of the first ''heap block'' on this Heap.
     59 * ''Region_Information->local_table'' points to the first Region object.  It is of type ''(Region_Control *)''.
     60 * ''((Region_Control *)_Region_Information->local_table[1])->Memory'' points to the Heap control portion of this Region's control block.
     61 * ''((Region_Control *)_Region_Information->local_table[1])->Memory->first'' references the contents of the first ''heap block'' on this Heap.
    6262
    63 Notice that the ''front''flag'' is displayed as ''8058280''.  This is in decimal since we used ''p'' not ''p/x'' to gdb.  Since this number is even, we know the ''in use bit_ is 0 and the block is free.  Thus the first block on the heap is 8,058,280 bytes and there are at least that many bytes left.
     63Notice that the ''front_flag'' is displayed as ''8058280''.  This is in decimal since we used ''p'' not ''p/x'' to gdb.  Since this number is even, we know the in use bit is 0 and the block is free.  Thus the first block on the heap is 8,058,280 bytes and there are at least that many bytes left.
    6464
    6565'''NOTE:''' This is really a crude estimate.
     
    114114     $free, $numfree
    115115 end
    116 
    117116= How much memory is left in the RTEMS Workspace? =
    118117