<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Is your stacktrace really corrupted?</title>
	<atom:link href="http://www.iovene.com/34/feed" rel="self" type="application/rss+xml" />
	<link>http://www.iovene.com/34</link>
	<description>The thoughts of a computer programmer, open source supporter and free-thinker.</description>
	<lastBuildDate>Mon, 19 Jul 2010 23:38:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Eldar</title>
		<link>http://www.iovene.com/34#comment-105938</link>
		<dc:creator>Eldar</dc:creator>
		<pubDate>Tue, 01 Jun 2010 12:17:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.iovene.com/is-your-stacktrace-really-corrupted/#comment-105938</guid>
		<description>Cool article. You real help me :)
Thank you.</description>
		<content:encoded><![CDATA[<p>Cool article. You real help me <img src='http://www.iovene.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivers</title>
		<link>http://www.iovene.com/34#comment-36017</link>
		<dc:creator>Ivers</dc:creator>
		<pubDate>Thu, 25 Sep 2008 10:59:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.iovene.com/is-your-stacktrace-really-corrupted/#comment-36017</guid>
		<description>Real cool article... thank you.

I used your tips and found an improvement:

You can actually achieve this very fast by:

print the current stack frame:
x/20wx $esp 

print the previous stack frame:
x/20wx *(int *)$ebp

print the preprevious stack frame:
x/20wx **(int **)$ebp

cool, eh?

Addressing with registers turns out to be REALLY helpful. I&#039;m debugging a program without debug-symbols :-(.. and found e.g.:

display *(char *)($esp+4) 

to work real great!</description>
		<content:encoded><![CDATA[<p>Real cool article… thank you.</p>
<p>I used your tips and found an improvement:</p>
<p>You can actually achieve this very fast by:</p>
<p>print the current stack frame:<br />
x/20wx $esp </p>
<p>print the previous stack frame:<br />
x/20wx *(int *)$ebp</p>
<p>print the preprevious stack frame:<br />
x/20wx **(int **)$ebp</p>
<p>cool, eh?</p>
<p>Addressing with registers turns out to be REALLY helpful. I’m debugging a program without debug-symbols <img src='http://www.iovene.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> .. and found e.g.:</p>
<p>display *(char *)($esp+4) </p>
<p>to work real great!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: How to debug a corrupted stack &#171; Interview questions</title>
		<link>http://www.iovene.com/34#comment-32469</link>
		<dc:creator>How to debug a corrupted stack &#171; Interview questions</dc:creator>
		<pubDate>Sun, 14 Sep 2008 17:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.iovene.com/is-your-stacktrace-really-corrupted/#comment-32469</guid>
		<description>[...] to debug a corrupted&#160;stack Is your stacktrace really corrupted? byÂ Salvatore IoveneÂ on 17 October 2006 â€” Posted [...]</description>
		<content:encoded><![CDATA[<p>[…] to debug a corrupted stack Is your stacktrace really corrupted? byÂ Salvatore IoveneÂ on 17 October 2006 â€” Posted […]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Salvatore Iovene</title>
		<link>http://www.iovene.com/34#comment-45</link>
		<dc:creator>Salvatore Iovene</dc:creator>
		<pubDate>Mon, 05 Feb 2007 22:23:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.iovene.com/is-your-stacktrace-really-corrupted/#comment-45</guid>
		<description>Very interesting contribution, thank you!</description>
		<content:encoded><![CDATA[<p>Very interesting contribution, thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ionut Georgescu</title>
		<link>http://www.iovene.com/34#comment-43</link>
		<dc:creator>Ionut Georgescu</dc:creator>
		<pubDate>Mon, 05 Feb 2007 21:17:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.iovene.com/is-your-stacktrace-really-corrupted/#comment-43</guid>
		<description>I am not a GDB specialist, but I do not understand why GDB cannot trace back %esp if we can do it ...

However, great description of how one can shoot himself in the foot by overwriting the stack.

One can also find the symbols directly from within gdb

info symbol 

Of course, it is only reliable as long as we can trust gdb. On the other hand, it is the only way to get the symbol information if the bug is in some shared library, because objdump cannot tell at which address the library was or will be loaded. This address is a random number generated by the dynamic linker (ld-linux.so) when the program is loaded into memory.

In my case nothing worked, as the stack was heavily trashed by somebody :-)


(gdb) info registers esp
esp            0xaf970d94       0xaf970d94
(gdb) x/20xw 0xaf970d94
0xaf970d94:     0xaf970dac      0x00000006      0x00000e16      0xa7ae8811
0xaf970da4:     0xa7becff4      0xa7aada40      0xaf970ed8      0xa7ae9fb9
0xaf970db4:     0x00000006      0xaf970e4c      0x00000000      0x0000000d
0xaf970dc4:     0x00000023      0x0000002f      0x00000027      0x0000002d
0xaf970dd4:     0x00000022      0x00000016      0x00000036      0x0000002b
(gdb) info symbol 0xaf970dac
No symbol matches 0xaf970dac.
(gdb) disassemble 0xaf970dac
No function contains specified address.
(gdb)
</description>
		<content:encoded><![CDATA[<p>I am not a GDB specialist, but I do not understand why GDB cannot trace back %esp if we can do it …</p>
<p>However, great description of how one can shoot himself in the foot by overwriting the stack.</p>
<p>One can also find the symbols directly from within gdb</p>
<p>info symbol </p>
<p>Of course, it is only reliable as long as we can trust gdb. On the other hand, it is the only way to get the symbol information if the bug is in some shared library, because objdump cannot tell at which address the library was or will be loaded. This address is a random number generated by the dynamic linker (ld-linux.so) when the program is loaded into memory.</p>
<p>In my case nothing worked, as the stack was heavily trashed by somebody <img src='http://www.iovene.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>(gdb) info registers esp<br />
esp            0xaf970d94       0xaf970d94<br />
(gdb) x/20xw 0xaf970d94<br />
0xaf970d94:     0xaf970dac      0x00000006      0x00000e16      0xa7ae8811<br />
0xaf970da4:     0xa7becff4      0xa7aada40      0xaf970ed8      0xa7ae9fb9<br />
0xaf970db4:     0x00000006      0xaf970e4c      0x00000000      0x0000000d<br />
0xaf970dc4:     0x00000023      0x0000002f      0x00000027      0x0000002d<br />
0xaf970dd4:     0x00000022      0x00000016      0x00000036      0x0000002b<br />
(gdb) info symbol 0xaf970dac<br />
No symbol matches 0xaf970dac.<br />
(gdb) disassemble 0xaf970dac<br />
No function contains specified address.<br />
(gdb)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
