debuggercdi/com.nokia.carbide.cpp.debug.crashdebugger/html/DebuggingInformation/CrashDebuggerCallStack.guide03.html
author tzelaw
Tue, 14 Apr 2009 15:03:19 -0500
changeset 94 d74b720418db
parent 2 d760517a8095
child 990 5d016a880824
child 1024 48b401835d0a
permissions -rw-r--r--
Test framework support: Ask debugger to remember DebugTarget so test framework can use it to setup test framework related utility. With this we can use the DebugUI way of launching while keeping test framework functionality
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
cawthron
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
cawthron
parents:
diff changeset
     2
	"http://www.w3.org/TR/html4/loose.dtd">
cawthron
parents:
diff changeset
     3
	<html><head>
cawthron
parents:
diff changeset
     4
	<title>Finding the Stack</title>
cawthron
parents:
diff changeset
     5
	<link href="sysdoc-eclipse.css" type="text/css" rel="stylesheet" >
cawthron
parents:
diff changeset
     6
	<link href="sysdoc-eclipse.css" type="text/css" rel="stylesheet" >
cawthron
parents:
diff changeset
     7
	<link href="../../book.css" type="text/css" rel="stylesheet" >
cawthron
parents:
diff changeset
     8
	<div class="Head2">
cawthron
parents:
diff changeset
     9
<h2>Finding the Stack</h2>
cawthron
parents:
diff changeset
    10
</div><div>
cawthron
parents:
diff changeset
    11
<p>To trace back through a thread&#8217;s kernel or user stack, you first
cawthron
parents:
diff changeset
    12
need to find the stack pointer value. On the ARM, R13 always
cawthron
parents:
diff changeset
    13
points to the stack, but there are different R13 registers for
cawthron
parents:
diff changeset
    14
each processor mode:</p>
cawthron
parents:
diff changeset
    15
<ul>
cawthron
parents:
diff changeset
    16
<li><p>In thread context:</p>
cawthron
parents:
diff changeset
    17
<ul>
cawthron
parents:
diff changeset
    18
<li>
cawthron
parents:
diff changeset
    19
<p>R13usr points to the thread&#8217;s user
cawthron
parents:
diff changeset
    20
stack,</p>
cawthron
parents:
diff changeset
    21
</li>
cawthron
parents:
diff changeset
    22
<li>
cawthron
parents:
diff changeset
    23
<p>R13svc points to the thread&#8217;s kernel
cawthron
parents:
diff changeset
    24
stack.</p>
cawthron
parents:
diff changeset
    25
</li>
cawthron
parents:
diff changeset
    26
</ul>
cawthron
parents:
diff changeset
    27
</li>
cawthron
parents:
diff changeset
    28
<li>
cawthron
parents:
diff changeset
    29
<p>When handling interrupts, dedicated stacks are used:</p>
cawthron
parents:
diff changeset
    30
<ul>
cawthron
parents:
diff changeset
    31
<li>
cawthron
parents:
diff changeset
    32
<p>R13Fiq points to the stack used when
cawthron
parents:
diff changeset
    33
processing fast interrupts (FIQ).</p>
cawthron
parents:
diff changeset
    34
</li>
cawthron
parents:
diff changeset
    35
<li>
cawthron
parents:
diff changeset
    36
<p>R13Irq points to the stack used when
cawthron
parents:
diff changeset
    37
processing general purpose interrupts (IRQ)</p>
cawthron
parents:
diff changeset
    38
</li>
cawthron
parents:
diff changeset
    39
</ul>
cawthron
parents:
diff changeset
    40
</li>
cawthron
parents:
diff changeset
    41
</ul>
cawthron
parents:
diff changeset
    42
<p>To find out which stack to inspect, you need to know what mode the
cawthron
parents:
diff changeset
    43
CPU was in when the fault occurred. The
cawthron
parents:
diff changeset
    44
<a href="CrashDebuggerARMexceptionsProcessorModes.guide.html" title="ARM Exception types, fault status register values, processor modes / ARM processor modes (CPSR register)">processor mode</a> is identified by the five least-significant bits of the CPSR
cawthron
parents:
diff changeset
    45
register. To get the value of the CPSR register:</p>
cawthron
parents:
diff changeset
    46
<ul>
cawthron
parents:
diff changeset
    47
<li>
cawthron
parents:
diff changeset
    48
<p>use the <a href="CrashDebugger_cmd_f.guide.html" title="The debug monitor and command syntax / f - display kernel fault information">f</a> command when the
cawthron
parents:
diff changeset
    49
debug monitor is triggered by a hardware exception.</p>
cawthron
parents:
diff changeset
    50
</li>
cawthron
parents:
diff changeset
    51
<li>
cawthron
parents:
diff changeset
    52
<p>use the <a href="CrashDebugger_cmd_r.guide.html" title="The debug monitor and command syntax / r - dump register contents">r</a> command when the
cawthron
parents:
diff changeset
    53
debug monitor is triggered by a panic.</p>
cawthron
parents:
diff changeset
    54
</li>
cawthron
parents:
diff changeset
    55
</ul>
cawthron
parents:
diff changeset
    56
<p>The following examples show how to find the stack(s):</p>
cawthron
parents:
diff changeset
    57
<ul>
cawthron
parents:
diff changeset
    58
<li>
cawthron
parents:
diff changeset
    59
<p><b><a href="CrashDebuggerCallStack.guide03.html#call01" title="Examining the call stack / Finding the stack / Kernel &amp; user stacks of the current thread after a hardware exception">Kernel &amp; user stacks of the current thread after a hardware exception</a></b></p>
cawthron
parents:
diff changeset
    60
</li>
cawthron
parents:
diff changeset
    61
<li class="style6">
cawthron
parents:
diff changeset
    62
<p><a href="CrashDebuggerCallStack.guide03.html#call02" title="Examining the call stack / Finding the stack / Kernel &amp; user stacks of the current thread after a panic">Kernel &amp; user stacks of the current thread after a panic</a></p>
cawthron
parents:
diff changeset
    63
</li>
cawthron
parents:
diff changeset
    64
<li class="style6">
cawthron
parents:
diff changeset
    65
<p><a href="CrashDebuggerCallStack.guide03.html#call03" title="Examining the call stack / Finding the stack / Interrupt stacks">Interrupt stacks</a></p>
cawthron
parents:
diff changeset
    66
</li>
cawthron
parents:
diff changeset
    67
<li>
cawthron
parents:
diff changeset
    68
<p><b><a href="CrashDebuggerCallStack.guide03.html#call04" title="Examining the call stack / Finding the stack / Kernel &amp; user stacks of a non-current thread">Kernel &amp; user stacks of a non-current thread</a></b></p>
cawthron
parents:
diff changeset
    69
</li>
cawthron
parents:
diff changeset
    70
</ul>
cawthron
parents:
diff changeset
    71
</div>
cawthron
parents:
diff changeset
    72
<div class="Head3">
cawthron
parents:
diff changeset
    73
<h3><a name="call01"></a>Kernel &amp; user stacks of the current thread after a
cawthron
parents:
diff changeset
    74
hardware exception</h3>
cawthron
parents:
diff changeset
    75
</div><div>
cawthron
parents:
diff changeset
    76
<p>Use the <a href="CrashDebugger_cmd_f.guide.html" title="The debug monitor and command syntax / f - display kernel fault information">f</a> command.</p>
cawthron
parents:
diff changeset
    77
<p class="CodeBlock">Fault Category: Exception  Fault Reason: 10000000<br>ExcId 00000001 CodeAddr f816c908 DataAddr 80000001 Extra c0007003<br>Exc 1 Cpsr=60000010 FAR=80000001 FSR=c0007003<br>&nbsp;R0=00000000  R1=00000000  R2=30000000  R3=80000001<br>&nbsp;R4=00000001  R5=00403d88  R6=00002000  R7=f816c768<br>&nbsp;R8=00000012  R9=00000040 R10=00000000 R11=00403fa4<br>R12=00403d5c R13=00403d70 R14=f80906f8 R15=f816c908<br>R13Svc=6571e000 R14Svc=f80074bc SpsrSvc=80000010</p>
cawthron
parents:
diff changeset
    78
<p>In this example:</p>
cawthron
parents:
diff changeset
    79
<ul>
cawthron
parents:
diff changeset
    80
<li>
cawthron
parents:
diff changeset
    81
<p>the kernel stack is the value of R13Svc, i.e.
cawthron
parents:
diff changeset
    82
0x6571e00.</p>
cawthron
parents:
diff changeset
    83
</li>
cawthron
parents:
diff changeset
    84
<li>
cawthron
parents:
diff changeset
    85
<p>the user stack is the value of R13, i.e.
cawthron
parents:
diff changeset
    86
0x00403d70.</p>
cawthron
parents:
diff changeset
    87
</li>
cawthron
parents:
diff changeset
    88
</ul>
cawthron
parents:
diff changeset
    89
</div>
cawthron
parents:
diff changeset
    90
<div class="Head3">
cawthron
parents:
diff changeset
    91
<h3><a name="call02" id="call02"></a>Kernel &amp; user stacks of the current thread after a
cawthron
parents:
diff changeset
    92
panic</h3>
cawthron
parents:
diff changeset
    93
</div><div>
cawthron
parents:
diff changeset
    94
<p>Use the <a href="CrashDebugger_cmd_r.guide.html" title="The debug monitor and command syntax / r - dump register contents">r</a> command.</p>
cawthron
parents:
diff changeset
    95
<p class="CodeBlock">MODE_USR:<br>&nbsp;R0=6571de54  R1=0000002a  R2=00000002  R3=ffffffff<br>&nbsp;R4=0000002a  R5=f8170414  R6=6571df14  R7=6403cc50<br>&nbsp;R8=00000001  R9=6403c44c R10=640002f8 R11=6571de70<br>R12=00000020 R13=00404e00 R14=f80818c0 R15=f800bfa8<br>CPSR=60000013<br>MODE_FIQ:<br>&nbsp;R8=00000000  R9=ffffffff R10=ffffffff R11=00000000<br>R12=00000000 R13=64000d0c R14=c080079c SPSR=e00000dc<br>MODE_IRQ:<br>R13=6400110c R14=00000013 SPSR=20000013<br>MODE_SVC:<br>R13=6571de54 R14=f80328bc SPSR=60000010<br>MODE_ABT:<br>R13=6400090c R14=ccbfd0e0 SPSR=b00000d9<br>MODE_UND:<br>R13=6400090c R14=b5a39950 SPSR=f000009d</p>
cawthron
parents:
diff changeset
    96
<p>In this example:</p>
cawthron
parents:
diff changeset
    97
<ul>
cawthron
parents:
diff changeset
    98
<li>
cawthron
parents:
diff changeset
    99
<p>the kernel stack is the value of R13 under
cawthron
parents:
diff changeset
   100
MODE_SVC:, i.e. 0x6571de54.</p>
cawthron
parents:
diff changeset
   101
</li>
cawthron
parents:
diff changeset
   102
<li>
cawthron
parents:
diff changeset
   103
<p>the user stack is the value of R13 under
cawthron
parents:
diff changeset
   104
MODE_USR:, i.e. 0x00404e00.</p>
cawthron
parents:
diff changeset
   105
</li>
cawthron
parents:
diff changeset
   106
</ul>
cawthron
parents:
diff changeset
   107
</div>
cawthron
parents:
diff changeset
   108
<div class="Head3">
cawthron
parents:
diff changeset
   109
<h3><a name="call03" id="call03"></a>Interrupt stacks</h3>
cawthron
parents:
diff changeset
   110
</div><div>
cawthron
parents:
diff changeset
   111
<p>Use the <a href="CrashDebugger_cmd_r.guide.html" title="The debug monitor and command syntax / r - dump register contents">r</a> command.</p>
cawthron
parents:
diff changeset
   112
<p class="CodeBlock">MODE_USR:<br>&nbsp;R0=6571de54  R1=0000002a  R2=00000002  R3=ffffffff<br>&nbsp;R4=0000002a  R5=f8170414  R6=6571df14  R7=6403cc50<br>&nbsp;R8=00000001  R9=6403c44c R10=640002f8 R11=6571de70<br>R12=00000020 R13=00404e00 R14=f80818c0 R15=f800bfa8<br>CPSR=60000013<br>MODE_FIQ:<br>&nbsp;R8=00000000  R9=ffffffff R10=ffffffff R11=00000000<br>R12=00000000 R13=64000d0c R14=c080079c SPSR=e00000dc<br>MODE_IRQ:<br>R13=6400110c R14=00000013 SPSR=20000013<br>MODE_SVC:<br>R13=6571de54 R14=f80328bc SPSR=60000010<br>MODE_ABT:<br>R13=6400090c R14=ccbfd0e0 SPSR=b00000d9<br>MODE_UND:<br>R13=6400090c R14=b5a39950 SPSR=f000009d</p>
cawthron
parents:
diff changeset
   113
<p>In this example:</p>
cawthron
parents:
diff changeset
   114
<ul>
cawthron
parents:
diff changeset
   115
<li>
cawthron
parents:
diff changeset
   116
<p>the IRQ stack is the value of R13 under
cawthron
parents:
diff changeset
   117
MODE_IRQ:, i.e. 0x6400110c.</p>
cawthron
parents:
diff changeset
   118
</li>
cawthron
parents:
diff changeset
   119
<li>
cawthron
parents:
diff changeset
   120
<p>the FRQ stack is the value of R13 under
cawthron
parents:
diff changeset
   121
MODE_FIQ:, i.e. 0x64000d0c.</p>
cawthron
parents:
diff changeset
   122
</li>
cawthron
parents:
diff changeset
   123
</ul>
cawthron
parents:
diff changeset
   124
</div>
cawthron
parents:
diff changeset
   125
<div class="Head3">
cawthron
parents:
diff changeset
   126
<h3><a name="call04" id="call04"></a>Kernel &amp; user stacks of a non-current
cawthron
parents:
diff changeset
   127
thread</h3>
cawthron
parents:
diff changeset
   128
</div><div>
cawthron
parents:
diff changeset
   129
<p>Use the output of the
cawthron
parents:
diff changeset
   130
<a href="CrashDebugger_cmd_i.guide.html" title="The debug monitor and command syntax / i - display information for the current process and thread">i</a>,
cawthron
parents:
diff changeset
   131
<a href="CrashDebugger_cmd_q.guide.html" title="The debug monitor and command syntax / q - display full DObject information">q</a> and
cawthron
parents:
diff changeset
   132
<a href="CrashDebugger_cmd_c.guide.html" title="The debug monitor and command syntax / c - display contents of object container">c</a>
cawthron
parents:
diff changeset
   133
commands.</p>
cawthron
parents:
diff changeset
   134
<p class="CodeBlock">THREAD at 6403c194 VPTR=f8046c18 AccessCount=5 Owner=6403bb4c<br>Full name t_dmasim::Main<br>Thread MState READY<br>Default priority 12 WaitLink Priority 12<br>ExitInfo 3,0,<br>Flags 00000002, Handles 6403b418<br>Supervisor stack base 6571d000 size 1000<br>User stack base 00403000 size 2000<br>Id=25, Alctr=00700000, Created alctr=00700000, Frame=00000000<br>Trap handler=00000000, ActiveScheduler=007000c8, Exception handler=00000000<br>TempObj=00000000 TempAlloc=00000000<br>NThread @ 6403c44c Pri 12 NState READY<br>Next=6403c44c Prev=6403c44c Att=03 iUserContextType=02<br>HeldFM=00000000 WaitFM=00000000 AddrSp=6403bb4c<br>Time=0 Timeslice=20 ReqCount=0<br>SuspendCount=0 CsCount=1 CsFunction=00000000<br>SavedSP=6571df98<br>DACR f800bd2c<br>R13_USR 0d404c38 R14_USR 00000001 SPSR_SVC 00000000<br>&nbsp;R4 f8022d84  R5 6571dfd4  R6 6571dfbc  R7 f8022db8<br>&nbsp;R8 f800bddc  R9 f800a454 R10 00000000 R11 f801daac<br>&nbsp;PC 60000010</p>
cawthron
parents:
diff changeset
   135
<p>In this example:</p>
cawthron
parents:
diff changeset
   136
<ul>
cawthron
parents:
diff changeset
   137
<li>
cawthron
parents:
diff changeset
   138
<p>the kernel stack is the value of SavedSP, i.e.
cawthron
parents:
diff changeset
   139
0x6571df98.</p>
cawthron
parents:
diff changeset
   140
</li>
cawthron
parents:
diff changeset
   141
<li>
cawthron
parents:
diff changeset
   142
<p>the user stack is the value of R13_USR, i.e.
cawthron
parents:
diff changeset
   143
0x0d404c38.</p>
cawthron
parents:
diff changeset
   144
</li>
cawthron
parents:
diff changeset
   145
</ul>
cawthron
parents:
diff changeset
   146
<h5>Related tasks</h5>
cawthron
parents:
diff changeset
   147
<ul>
cawthron
parents:
diff changeset
   148
  <li><a href="CrashDebuggerCallStack.guide02.html">General Points</a></li>
cawthron
parents:
diff changeset
   149
  <li><a href="CrashDebuggerCallStack.guide04.html">Tracing through the Call Stack Heuristically</a></li>
cawthron
parents:
diff changeset
   150
  <li><a href="CrashDebuggerCallStack.guide05.html">Walking through the Call Stack</a></li>
cawthron
parents:
diff changeset
   151
</ul>
cawthron
parents:
diff changeset
   152
<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>
cawthron
parents:
diff changeset
   153