<?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>iamstuffed.com &#187; jni</title>
	<atom:link href="http://iamstuffed.com/blog/tag/jni/feed/" rel="self" type="application/rss+xml" />
	<link>http://iamstuffed.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 16 Apr 2010 01:36:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Debugging JNI code in Java using GDB</title>
		<link>http://iamstuffed.com/blog/2009/02/13/debugging-jni-code-in-java-using-gdb/</link>
		<comments>http://iamstuffed.com/blog/2009/02/13/debugging-jni-code-in-java-using-gdb/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:40:25 +0000</pubDate>
		<dc:creator>iamstuffed</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jni]]></category>

		<guid isPermaLink="false">http://iamstuffed.com/blog/?p=125</guid>
		<description><![CDATA[Lately, I&#8217;ve had to debug JNI code used by my Java Web Start application. Some of the issues I&#8217;ve dealt with did not show up until the code was combined and used in the resulting application. The following was how I used GDB to debug the code. First, start the application as usual.  I was [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I&#8217;ve had to debug JNI code used by my Java Web Start application.  Some of the issues I&#8217;ve dealt with did not show up until the code was combined and used in the resulting application.  The following was how I used GDB to debug the code.</p>
<p>First, start the application as usual.  I was debugging a java web start application, so my command will be slightly different, but the debugging procedure will work regardless of what java program you are running.  At the command line, you can type the following to launch the jnlp file:</p>
<p><code>javaws &lt; location of jnlp file &gt;</code></p>
<p>The jnlp file can be local or a remote file, just as long as it references and loads the code you are debugging.  After it loads, the process ID needs to be found.  Usually, I&#8217;ll just look at all the java processes running and can figure out which one is the application I&#8217;m interetesd in:</p>
<p><code>pa aux | grep java</code></p>
<p>Once the process ID has been identified, gdb can be launched and attached to the running process:</p>
<p><code>gdb -p &lt; PID &gt;</code></p>
<p>This starts gdb and attaches to the java program.  At this point, the execution blocks until you do something with it.  Just type &#8220;continue&#8221; and run the program as usual.  When or if the program causes a segmentation fault, the debugger will block; you can then do a backtrace and see exactly what file and what line caused the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://iamstuffed.com/blog/2009/02/13/debugging-jni-code-in-java-using-gdb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

