title: How to decode stack trace for a userspace process crash printed in kernel logs
body: <p>I have native sources compiling with Android NDK tool chain. This shared library is loaded by the mediaserver process running on the android device. Usually when any of the user space process crashes, the debugger daemon in android takes the stack trace of the crashing process and print it in logcat messages. But sometimes, I see mediaserver process crashes, with no stack traces in the logcat logs, but the kernel logs print out the stack trace saying there is a page fault in the mediaserver process. It prints out PC, LR and other registers. So how do I decode this info to locate the address in faulty code?</p>
  
  <p>Here is a sample trace:</p>
  
  <pre><code>&lt;7&gt;[  198.755417] mediaserver: unhandled page fault (11) at 0x7b969000, code 0x817
  &lt;1&gt;[  198.755424] pgd = e005c000
  &lt;1&gt;[  198.757092] [7b969000] *pgd=25865831, *pte=00000000, *ppte=00000000
  &lt;4&gt;[  198.764864] Pid: 1957, comm:          mediaserver
  &lt;4&gt;[  198.769647] CPU: 2    Tainted: G        W     (3.4.0-gf77558a-00009-gb024756 #2)
  &lt;4&gt;[  198.777010] PC is at 0x40082728
  &lt;4&gt;[  198.780007] LR is at 0x408
  &lt;4&gt;[  198.782702] pc : [&lt;40082728&gt;]    lr : [&lt;00000408&gt;]    psr: 20000010
  &lt;4&gt;[  198.782703] sp : 75393dd0  ip : 00001ba0  fp : 00000002
  &lt;4&gt;[  198.794310] r10: 483463c0  r9 : 00000000  r8 : 00001200
  &lt;4&gt;[  198.799373] r7 : 6afdf950  r6 : 6aff0db8  r5 : 412ef814  r4 : 7b68c008
  &lt;4&gt;[  198.806293] r3 : ff1b1517  r2 : 0034bc00  r1 : 48346000  r0 : 7b968fe8
  &lt;4&gt;[  198.812546] Flags: nzCv  IRQs on  FIQs on  Mode USER_32  ISA ARM  Segment user
  &lt;4&gt;[  198.819848] Control: 10c5787d  Table: 2805c06a  DAC: 00000015
  &lt;4&gt;[  198.825432] 
  &lt;4&gt;[  198.825433] R3: 0xff1b1497:
  &lt;4&gt;[  198.829572] 1494  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.837734] 14b4  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.845893] 14d4  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.854070] 14f4  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.862211] 1514  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.870371] 1534  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.878532] 1554  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.886693] 1574  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.894851] 1594  ******** ******** ******** ******** ******** ******** ******** ********
  &lt;4&gt;[  198.903028] [&lt;c0013da4&gt;] (unwind_backtrace+0x0/0x11c) from [&lt;c0019980&gt;] (__do_user_fault+0x110/0x15c)
  &lt;4&gt;[  198.912347] [&lt;c0019980&gt;] (__do_user_fault+0x110/0x15c) from [&lt;c0786384&gt;] (do_page_fault+0x380/0x3d0)
  &lt;4&gt;[  198.921358] [&lt;c0786384&gt;] (do_page_fault+0x380/0x3d0) from [&lt;c0008514&gt;] (do_DataAbort+0x134/0x1a8)
  &lt;4&gt;[  198.930251] [&lt;c0008514&gt;] (do_DataAbort+0x134/0x1a8) from [&lt;c0784bb4&gt;] (__dabt_usr+0x34/0x40)
  &lt;4&gt;[  198.938631] Exception stack(0xddd8bfb0 to 0xddd8bff8)
  &lt;4&gt;[  198.943658] bfa0:                                     7b968fe8 48346000 0034bc00 
  ff1b1517
  &lt;4&gt;[  198.951801] bfc0: 7b68c008 412ef814 6aff0db8 6afdf950 00001200 00000000 483463c0 00000002
  &lt;4&gt;[  198.960035] bfe0: 00001ba0 75393dd0 00000408 40082728 20000010 ffffffff
  </code></pre>