debuggercdi/com.nokia.carbide.cpp.debug.crashdebugger/html/DebuggingInformation/CrashDebuggerExaminingMemory.guide02.html
author timkelly
Thu, 10 Dec 2009 13:45:47 -0600
branchRCL_2_4
changeset 671 80524b72f957
parent 0 fb279309251b
child 990 5d016a880824
child 1024 48b401835d0a
permissions -rw-r--r--
Add S60 5.2 support.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
	<html><head>
	<title>Dumping the Contents of Classes</title>
	<link href="sysdoc-eclipse.css" type="text/css" rel="stylesheet" media="screen">
	<link href="sysdoc-eclipse.css" type="text/css" rel="stylesheet" media="print">
	<link href="../../book.css" type="text/css" rel="stylesheet" >
<div class="Head1">

<h2>Dumping the Contents of Classes</h2>
</div>
<div>
<p>You can use the
<a href="CrashDebugger_cmd_m.guide.html" title="The debug monitor and command syntax / m - do a memory dump">m</a> command to
inspect the contents of structures and class instances, but you need to be
aware of a few things about the memory layout:</p>
<ul>
<li>
<p>Symbian OS is little-endian, which means that all values are
stored so that the least significant bytes are stored at the lower addresses in
memory (or &#8220;backwards&#8221; as commonly perceived).</p>
<p>For example, the value 0x1234ABCD would be shown in the memory
dump as:</p>
<p class="listing">CD AB 34 12</p>
</li>
<li>
<p>The compiler may add padding between variables either to speed
up access or to avoid alignment restrictions; for example, words cannot be on
odd addresses. </p>
<p>As an example, the following struct:</p>
<p class="listing">struct SExample<br>
  &nbsp;&nbsp;&nbsp;&nbsp;{<br>
  &nbsp;&nbsp;&nbsp;&nbsp;TUint8&nbsp;&nbsp;iByte;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;TInt&nbsp;&nbsp;&nbsp;&nbsp;iInteger;<br>
  &nbsp;&nbsp;&nbsp;&nbsp;};</p>
<p>would be laid out in memory as:</p>
<p class="listing">+0(1)&nbsp;&nbsp;&nbsp;iByte<br>
  +1(3)&nbsp;&nbsp;&nbsp;padding<br>
  +4(4)&nbsp;&nbsp;&nbsp;iInteger</p>
<p>The padding and alignment is compiler-dependent. Generally,
fields must be aligned on a boundary equal to their size; for example, a TUint32 is 4 bytes wide so it must lie on a 4-byte
boundary, i.e. the least significant two bits of the address must be
zero.</p>
<p>When using GCC, classes which derive from CBase will have a virtual table pointer as the first word
in the class data and classes which derive from DBase will
have a virtual table pointer as the second word in the class data.</p>
<p>When using an EABI-compliant compiler, the virtual table
pointer is always the first word of the class.</p>
</li>
</ul> 

</div>
<div id="footer">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. <br>License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></div>
	   </body>
	   </html>