<?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>ものぐさ備忘録 &#187; crash</title>
	<atom:link href="http://www.ginriki.net/wd/category/crash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ginriki.net/wd</link>
	<description>ソフトウェア関係の話を中心とした備忘録的日記</description>
	<lastBuildDate>Sun, 16 Jan 2011 20:07:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>crashコマンド使ってみた</title>
		<link>http://www.ginriki.net/wd/2009/07/13/58/</link>
		<comments>http://www.ginriki.net/wd/2009/07/13/58/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 17:37:05 +0000</pubDate>
		<dc:creator>ginriki</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[GDB]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ginriki.net/wd/?p=58</guid>
		<description><![CDATA[Kernelのコアダンプファイルを解析するのに、crashコマンドが便利だという話を聞いたので、練習として触ってみました。
手元にCentOS 5のマシンがあるので、それを使います。
解析にあたってkernelのデバッグ情報がいるので、debuginfoのRPMをインストール]]></description>
			<content:encoded><![CDATA[<p>Kernelのコアダンプファイルを解析するのに、crashコマンドが便利だという話を聞いたので、練習として触ってみました。</p>
<p>手元にCentOS 5のマシンがあるので、それを使います。</p>
<p>解析にあたってkernelのデバッグ情報がいるので、debuginfoのRPMをインストールします<sup>1</sup>。</p>
<pre>
 $ uname -a
Linux localhost.localdomain 2.6.18-128.1.16.el5 #1 SMP Tue Jun 30 06:10:28 EDT 2009 i686 i686 i386 GNU/Linux

 $ wget http://debuginfo.centos.org/5/i386/kernel-debuginfo-2.6.18-128.1.16.el5.i686.rpm
 $ wget http://debuginfo.centos.org/5/i386/kernel-debuginfo-common-2.6.18-128.1.16.el5.i686.rpm
 $ rpm -ivh kernel-debuginfo-common-2.6.18-128.1.16.el5.i686.rpm kernel-debuginfo-2.6.18-128.1.16.el5.i686.rpm
</pre>
<p>んで、crashコマンド実行。<br />
SVR4 UNIXのcrashコマンドをベースにGDBを統合したやつだそうで<sup>2</sup>、GDBになじんでる私には結構使いやすいです。</p>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showPlainTxt('code-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ crash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; KERNEL: /usr/lib/debug/lib/modules/<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">6</span>.<span style="color:#800000;color:#800000;">18</span>-<span style="color:#800000;color:#800000;">128</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">16</span>.<span style="">el5</span>/vmlinux</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; DUMPFILE: /dev/crash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; CPUS: <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; DATE: Mon Jul <span style="color:#800000;color:#800000;">13</span> <span style="color:#800000;color:#800000;">02</span>:<span style="color:#800000;color:#800000;">17</span>:<span style="color:#800000;color:#800000;">05</span> <span style="color:#800000;color:#800000;">2009</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; UPTIME: <span style="color:#800000;color:#800000;">06</span>:<span style="color:#800000;color:#800000;">52</span>:<span style="color:#800000;color:#800000;">42</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LOAD AVERAGE: <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">16</span>, <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">03</span>, <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">01</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;TASKS: <span style="color:#800000;color:#800000;">86</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; NODENAME: localhost.<span style="">localdomain</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;RELEASE: <span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">6</span>.<span style="color:#800000;color:#800000;">18</span>-<span style="color:#800000;color:#800000;">128</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">16</span>.<span style="">el5</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;VERSION: #1 SMP Tue Jun <span style="color:#800000;color:#800000;">30</span> <span style="color:#800000;color:#800000;">06</span>:<span style="color:#800000;color:#800000;">10</span>:<span style="color:#800000;color:#800000;">28</span> EDT <span style="color:#800000;color:#800000;">2009</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;MACHINE: i686&nbsp; <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">1197</span> Mhz<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; MEMORY: <span style="color:#800000;color:#800000;">758</span>.<span style="color:#800000;color:#800000;">9</span> MB</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PID: <span style="color:#800000;color:#800000;">3848</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;COMMAND: <span style="color:#CC0000;">"crash"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; TASK: ef67c000&nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>THREAD_INFO: d9120000<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CPU: <span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;STATE: TASK_RUNNING <span style="color:#006600; font-weight:bold;">&#40;</span>ACTIVE<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;crash&gt; set <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; PID: <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">COMMAND: <span style="color:#CC0000;">"init"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;TASK: c16f5aa0&nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>THREAD_INFO: c16f6000<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; CPU: <span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; STATE: TASK_INTERRUPTIBLE</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;crash&gt; p $tmp = jiffies</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; $<span style="color:#800000;color:#800000;">1</span> = <span style="color:#800000;color:#800000;">24873000</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;crash&gt; x modprobe_path</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; 0xc0680be0 &lt;modprobe_path&gt;:&nbsp; &nbsp; &nbsp;das</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;crash&gt; show convenience</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;$tmp = <span style="color:#800000;color:#800000;">24873000</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;$__ = void</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;$_ = <span style="color:#006600; font-weight:bold;">&#40;</span>examine_i_type *<span style="color:#006600; font-weight:bold;">&#41;</span> 0xc0680be0 <span style="color:#CC0000;">"/sbin/modprobe"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;crash&gt; exit </div>
</li>
</ol>
</div>
</div>
</div>
<p>
gdbスクリプトをsourceで読み込むこともできる。<br />
まだ、まともな使い方は全然してないけど、Debug Hacksにいろいろ書いてあるので、それを読みながらやる予定。<br />
<table class="amazonBanner amazonTable" summary="Debug Hacks -デバッグを極めるテクニック&amp;ツール">
	<tbody>
		<tr>
			<td rowspan="4" class="amazonImageTable"><a href="http://ecx.images-amazon.com/images/I/41TmOAawDsL.jpg" title="Debug Hacks -デバッグを極めるテクニック&amp;ツール"><img src="http://ecx.images-amazon.com/images/I/41TmOAawDsL._SL160_.jpg" alt="Debug Hacks -デバッグを極めるテクニック&amp;ツール" style="border:none ! important; width:100px;" /></a></td> 
			<td style="height:36px;" class="amazonName"><a href="http://www.amazon.co.jp/Debug-Hacks-%E3%83%87%E3%83%90%E3%83%83%E3%82%B0%E3%82%92%E6%A5%B5%E3%82%81%E3%82%8B%E3%83%86%E3%82%AF%E3%83%8B%E3%83%83%E3%82%AF-%E3%83%84%E3%83%BC%E3%83%AB-%E5%90%89%E5%B2%A1/dp/4873114047%3FSubscriptionId%3DAKIAJCPLMOWTU2MWO7FQ%26tag%3Dgikogeek-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873114047" title="Debug Hacks -デバッグを極めるテクニック&amp;ツール">Debug Hacks -デバッグを極めるテクニック&amp;ツール</a></td>
		</tr>
		<tr>
			<td style="height:36px;"><a href="http://www.amazon.co.jp/review/product/4873114047%3FSubscriptionId%3DAKIAJCPLMOWTU2MWO7FQ%26tag%3Dgikogeek-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D5143%26creativeASIN%3D4873114047" title="Debug Hacks -デバッグを極めるテクニック&amp;ツール" class="bold">レビューを見る </a></td>
		</tr>
		<tr>
			<td style="height:36px;"><a href="http://www.amazon.co.jp/gp/registry/wishlist/add-item.html%3Fasin.0%3D4873114047%26SubscriptionId%3DAKIAJCPLMOWTU2MWO7FQ%26tag%3Dgikogeek-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D5143%26creativeASIN%3D4873114047" title="Debug Hacks -デバッグを極めるテクニック&amp;ツール">欲しいものリストに追加</a></td>
		</tr>
		<tr>
			<td style="height:36px;"><span class="amazonPrice">価格:3360円 在庫あり。</span><span class="amazonCopy"><small>powered by <a href="http://www.amazon.co.jp/">Amazon.co.jp</a></small></span></td>
		</tr>
	</tbody>
</table></p>
<ol class="footnotes"><li id="footnote_0_58" class="footnote">最初、yumでinstallしたら、なぜか2.6.18-92.1.6.el5.centos.plusが入りました。kernelバージョンと合ってないので、rpmコマンドで入れなおし。</li><li id="footnote_1_58" class="footnote"><a href="http://people.redhat.com/anderson/crash_whitepaper/">Crash Whitepaper</a>のAbstract参照</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.ginriki.net/wd/2009/07/13/58/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

