<?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: Software Breakpoints</title>
	<atom:link href="http://www.technochakra.com/software-breakpoints/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.technochakra.com/software-breakpoints/</link>
	<description>Wheels Of Technology</description>
	<lastBuildDate>Wed, 20 Jul 2011 18:43:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: tc</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-3807</link>
		<dc:creator>tc</dc:creator>
		<pubDate>Fri, 08 Oct 2010 13:08:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-3807</guid>
		<description>User level debugger requires permissions from the OS to be able to debug a child program (Windows debugging APIs / ptrace on Unix).  Whenever an int 3 instruction is executed, the control is passed to the operating system&#039;s interrupt vector.  The OS then notifies the debugger that the child it was monitoring has hit a breakpoint.  WaitForDebugEvent (Win) and waitpid (on Unix) calls are some ways how the OS notifies the  debugger.  The OS acts as the authority in order to grant debugging permissions and also routes the notifications back to the debugger.</description>
		<content:encoded><![CDATA[<p>User level debugger requires permissions from the OS to be able to debug a child program (Windows debugging APIs / ptrace on Unix).  Whenever an int 3 instruction is executed, the control is passed to the operating system&#8217;s interrupt vector.  The OS then notifies the debugger that the child it was monitoring has hit a breakpoint.  WaitForDebugEvent (Win) and waitpid (on Unix) calls are some ways how the OS notifies the  debugger.  The OS acts as the authority in order to grant debugging permissions and also routes the notifications back to the debugger.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumedh S</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-3799</link>
		<dc:creator>Sumedh S</dc:creator>
		<pubDate>Thu, 07 Oct 2010 22:21:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-3799</guid>
		<description>I guess the above thing I mentioned wont work, because, cc would call some routine described by segment descriptor in IDT for int3.
Will it be possible to modify the segment selector and offset for int3 segment and point it to our code.</description>
		<content:encoded><![CDATA[<p>I guess the above thing I mentioned wont work, because, cc would call some routine described by segment descriptor in IDT for int3.<br />
Will it be possible to modify the segment selector and offset for int3 segment and point it to our code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumedh</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-3798</link>
		<dc:creator>Sumedh</dc:creator>
		<pubDate>Thu, 07 Oct 2010 21:15:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-3798</guid>
		<description>In case one is writing a debugger,
our option would be to replace the instruction at an addr &#039;x&#039; with the opcode &#039;0xcc&#039;.
At the same time we should be having a debug exception handler in place.
so with the above opcode should we be replacing a &#039;call our_debug_handler&#039; instruction.
Our debug handler let says shows some values and then makes sure that the replaced instructions are brought back into the memory for resumed execution.
Am I right?</description>
		<content:encoded><![CDATA[<p>In case one is writing a debugger,<br />
our option would be to replace the instruction at an addr &#8216;x&#8217; with the opcode &#8217;0xcc&#8217;.<br />
At the same time we should be having a debug exception handler in place.<br />
so with the above opcode should we be replacing a &#8216;call our_debug_handler&#8217; instruction.<br />
Our debug handler let says shows some values and then makes sure that the replaced instructions are brought back into the memory for resumed execution.<br />
Am I right?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tsp</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-2278</link>
		<dc:creator>tsp</dc:creator>
		<pubDate>Tue, 20 Jul 2010 06:01:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-2278</guid>
		<description>At the run time, we are attaching a process to the GDB and at time time we are setting a break point (in a specified file and a specfic line number), how the GDB know the exact opcode in the ELF file.is there any mapping application is there inside GDB</description>
		<content:encoded><![CDATA[<p>At the run time, we are attaching a process to the GDB and at time time we are setting a break point (in a specified file and a specfic line number), how the GDB know the exact opcode in the ELF file.is there any mapping application is there inside GDB</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Debugging &#8211; Modifying Code At Runtime - technochakra.com</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-1519</link>
		<dc:creator>Debugging &#8211; Modifying Code At Runtime - technochakra.com</dc:creator>
		<pubDate>Sat, 09 Jan 2010 19:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-1519</guid>
		<description>[...] The debugger&#8217;s access to a program&#8217;s memory and registers not only allows users to view the state of the program but also set software breakpoints. Software breakpoints are set by altering and restoring the instructions in memory and has already been covered indepth in an earlier article. [...]</description>
		<content:encoded><![CDATA[<p>[...] The debugger&#8217;s access to a program&#8217;s memory and registers not only allows users to view the state of the program but also set software breakpoints. Software breakpoints are set by altering and restoring the instructions in memory and has already been covered indepth in an earlier article. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tc</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-1160</link>
		<dc:creator>tc</dc:creator>
		<pubDate>Fri, 04 Sep 2009 18:59:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-1160</guid>
		<description>@John, Nice approach.   It also does not assume Intel as the underlying platform so will work for a lot of Unix variants.</description>
		<content:encoded><![CDATA[<p>@John, Nice approach.   It also does not assume Intel as the underlying platform so will work for a lot of Unix variants.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-1159</link>
		<dc:creator>John</dc:creator>
		<pubDate>Fri, 04 Sep 2009 09:56:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-1159</guid>
		<description>For an alternative approach on a unix platform, assuming gdb, one can use raise(SIGTRAP). In fact, using a signal gives you a way to only stop execution if you are within gdb:

struct sigaction oldAct;
struct sigaction newAct;

newAct.sa_handler = SIG_IGN;
sigaction(SIGTRAP, &amp;newAct, &amp;oldAct);
raise(SIGTRAP);
sigaction(SIGTRAP, &amp;oldAct, NULL);

Wrap that up in a function which takes a bool, and the process will send itself a signal that it will ignore. Crucially, gdb will *not* ignore it, and will take a break.</description>
		<content:encoded><![CDATA[<p>For an alternative approach on a unix platform, assuming gdb, one can use raise(SIGTRAP). In fact, using a signal gives you a way to only stop execution if you are within gdb:</p>
<p>struct sigaction oldAct;<br />
struct sigaction newAct;</p>
<p>newAct.sa_handler = SIG_IGN;<br />
sigaction(SIGTRAP, &amp;newAct, &amp;oldAct);<br />
raise(SIGTRAP);<br />
sigaction(SIGTRAP, &amp;oldAct, NULL);</p>
<p>Wrap that up in a function which takes a bool, and the process will send itself a signal that it will ignore. Crucially, gdb will *not* ignore it, and will take a break.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tc</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-1065</link>
		<dc:creator>tc</dc:creator>
		<pubDate>Tue, 18 Aug 2009 18:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-1065</guid>
		<description>@Rohit,
I am assuming you are asking this for the Windows platform.
Inline assembly (__asm) is not allowed in Visual Studio&#039;s x64 bit compilers.  You can either create your own asm file with a function that invokes &quot;int 3&quot; and call that function from your C/C++ code or simply invoke the ::DebugBreak() Windows API that internally invokes &quot;int 3&quot;.</description>
		<content:encoded><![CDATA[<p>@Rohit,<br />
I am assuming you are asking this for the Windows platform.<br />
Inline assembly (__asm) is not allowed in Visual Studio&#8217;s x64 bit compilers.  You can either create your own asm file with a function that invokes &#8220;int 3&#8243; and call that function from your C/C++ code or simply invoke the ::DebugBreak() Windows API that internally invokes &#8220;int 3&#8243;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rohit Kulshreshtha</title>
		<link>http://www.technochakra.com/software-breakpoints/comment-page-1/#comment-1064</link>
		<dc:creator>Rohit Kulshreshtha</dc:creator>
		<pubDate>Tue, 18 Aug 2009 14:55:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.technochakra.com/?p=192#comment-1064</guid>
		<description>Any clue on how one may achieve this on x86_64?</description>
		<content:encoded><![CDATA[<p>Any clue on how one may achieve this on x86_64?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

