<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Miha Valencic &#187; Uncategorized</title>
	<atom:link href="http://www.mihavalencic.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mihavalencic.com</link>
	<description>Solving IT Challenges</description>
	<lastBuildDate>Tue, 25 Oct 2011 06:32:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Android and stack traces</title>
		<link>http://www.mihavalencic.com/2011/10/18/android-and-stack-traces/</link>
		<comments>http://www.mihavalencic.com/2011/10/18/android-and-stack-traces/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 10:27:33 +0000</pubDate>
		<dc:creator>miha</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.mihavalencic.com/?p=329</guid>
		<description><![CDATA[While doing native development for the Android platform, native segmentation faults happen. And they are not very descriptive to the usual developer (which includes me, of course). You would see something along those lines: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'samsung/GT-I9100/GT-I9100:2.3.3/GINGERBREAD/XWKE2:user/release-keys' pid: 3833, [...]]]></description>
			<content:encoded><![CDATA[<p>While doing native development for the <a href="http://www.android.com/">Android</a> platform, native segmentation faults happen. And they are not very descriptive to the usual developer (which includes me, of course). You would see something along those lines:<span id="more-329"></span><br />
<code><br />
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***<br />
Build fingerprint: 'samsung/GT-I9100/GT-I9100:2.3.3/GINGERBREAD/XWKE2:user/release-keys'<br />
pid: 3833, tid: 4464  >>> your.project.name <<<<br />
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad<br />
 r0 00000027  r1 deadbaad  r2 a0000000  r3 00000000<br />
 r4 00000001  r5 00000000  r6 00000000  r7 00000004<br />
 r8 00000001  r9 47e279dc  10 47e279e0  fp 47e270b4<br />
 ip afd46688  sp 47e27048  lr afd19471  pc afd15f40  cpsr 60000030<br />
 d0  0000009643160000  d1  3ff0000043160000<br />
 d2  0000000000000000  d3  0000000000000000<br />
 d4  bf80000000000000  d5  0000000000000000<br />
 d6  3f80000000000000  d7  4080000000000000<br />
 d8  4100000044228000  d9  c42cc000429c0000<br />
 d10 3fd3441341600000  d11 bfe3441350ad386e<br />
 d12 3ddb7cdfd9d7bdbb  d13 0000000000000000<br />
 d14 0000000000000000  d15 0000000000000000<br />
 d16 0000000700000037  d17 3ff0000000000000<br />
 d18 3ff0000000000000  d19 0000000000000000<br />
 d20 0000000000000000  d21 0000000000000000<br />
 d22 3ff0000000000000  d23 0000000000000000<br />
 d24 3ff0000000000000  d25 0000000000000000<br />
 d26 0000000000000000  d27 0000000000000000<br />
 d28 bffe0d01b7ee0434  d29 3ff0000000000000<br />
 d30 0000000000000000  d31 3ff0000000000000<br />
 scr 60000013<br />
         #00  pc 00015f40  /system/lib/libc.so<br />
         #01  pc 000140a4  /system/lib/libc.so<br />
         #02  pc 0001475a  /system/lib/libc.so<br />
</code><br />
Now this is not very helpful, BUT, you can use <a href="http://stackoverflow.com/questions/3696978/where-is-the-stack-tool-for-android-dev-to-help-debug-native-c-code">the stack tool</a> (but in my case, stack tool breaks on one too many variables (I have a custom build, with different library paths, etc)) or you can manually translate the location of PC with a tool called addr2line (in my case arm-linux-androideabi-addr2line - use something like
<pre>find . | grep addr2line</pre>
<p> in your Android NDK directory). You can find the function name by setting a couple of parameters to addr2line. In the output<br />
<code><br />
#00  pc 00015f40  /system/lib/libc.so<br />
</code><br />
you see the address (00015f40) and the library name (/system/lib/libc.so). You can use addr2line tool to show the function name:<br />
<code><br />
./addr2line -f -e /path/to/libc.so 0x00015f40<br />
</code><br />
and the output will be<br />
<code><br />
__sfvwrite<br />
</code><br />
Also, a helpful article on <a href="http://bootloader.wikidot.com/linux:android:crashlog">analyzing Android seg faults</a>.</p>
<p>Another useful tool for analyzing stack traces is also <a href="http://code.google.com/p/android-ndk-stacktrace-analyzer/">android ndk stacktrace analyzer</a>. Additional thing to note is, that if you have addresses in the upper range (0x8xxxxxxx), you can <a href="http://groups.google.com/group/android-ndk/browse_thread/thread/4c0cc8bd9891ff29">subtract 0x81800000 from that address</a> and use addr2line tool for that.</p>
<p>Hopefully, this helps someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihavalencic.com/2011/10/18/android-and-stack-traces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

