<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: python scripting in gdb update</title>
	<atom:link href="http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/</link>
	<description>incomplete and abridged</description>
	<lastBuildDate>Sat, 08 May 2010 06:36:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Sam</title>
		<link>http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/#comment-1512</link>
		<dc:creator><![CDATA[Sam]]></dc:creator>
		<pubDate>Thu, 06 Nov 2008 04:42:14 +0000</pubDate>
		<guid isPermaLink="false">http://bauermann.wordpress.com/?p=163#comment-1512</guid>
		<description><![CDATA[“Do you mean storing an expression and then being able to eventually
ask it to be evaluated by GDB? If so, would it solve your problem if
you could store an expression as a string, and then pass it to a
gdb.evaluate() function which would return a value for it?”

Although generating expression string and passing it to gdb.evaluate() looks little ugly, if it will work then I am happy with it.

What I tried was to print all elements in an AVL tree using python scripting.
The equivalent gdb user command(not working) is given below.  Although the following command to specific to my project, I hope it will better explain my requirement.

define descriptor
	set $arg0 = (VM_DESCRIPTOR_PTR)$arg0
	if ! IS_AVL_TREE_LEFT_LIST_END( $arg0-&gt;tree_node ) 
		set $left = STRUCT_ADDRESS_FROM_MEMBER( (AVL_TREE_PTR)AVL_TREE_LEFT_NODE( &amp;$arg0-&gt;tree_node ), VM_DESCRIPTOR, tree_node)
		descriptor $left
	end
	printf &quot;%3d  %10p %10p %10p %4d &quot;, $arg0-&gt;reference_count, $arg0-&gt;start, $arg0-&gt;end, $arg0-&gt;unit, ($arg0-&gt;end-$arg0-&gt;start)/PAGE_SIZE
	vm_prot &amp;$arg0-&gt;protection.user_write
	printf &quot;\n&quot;
	
	if ! IS_AVL_TREE_RIGHT_LIST_END( $arg0-&gt;tree_node ) 
		set $right = STRUCT_ADDRESS_FROM_MEMBER( (AVL_TREE_PTR)AVL_TREE_RIGHT_NODE( &amp;$arg0-&gt;tree_node ), VM_DESCRIPTOR, tree_node)
		descriptor $right
	end	
end

In the above example, IS_AVL_TREE_LEFT_LIST_END(), IS_AVL_TREE_RIGHT_LIST_END(),STRUCT_ADDRESS_FROM_MEMBER(),AVL_TREE_LEFT_NODE(), AVL_TREE_RIGHT_NODE() are macros. If gdb.evaluate() is implemented then I can use that function to execute/expand these C macros inside gdb get the value back into python.

http://sourceware.org/gdb/wiki/PythonGdb says - Breakpoints, blocks, frames, symbols, symbol tables, types, and values have Python representations. That means I can represent a C type inside python?

I would be very helpful, if you can write a small documentation for the existing work.

Thank you very much for the good effort.]]></description>
		<content:encoded><![CDATA[<p>“Do you mean storing an expression and then being able to eventually<br />
ask it to be evaluated by GDB? If so, would it solve your problem if<br />
you could store an expression as a string, and then pass it to a<br />
gdb.evaluate() function which would return a value for it?”</p>
<p>Although generating expression string and passing it to gdb.evaluate() looks little ugly, if it will work then I am happy with it.</p>
<p>What I tried was to print all elements in an AVL tree using python scripting.<br />
The equivalent gdb user command(not working) is given below.  Although the following command to specific to my project, I hope it will better explain my requirement.</p>
<p>define descriptor<br />
	set $arg0 = (VM_DESCRIPTOR_PTR)$arg0<br />
	if ! IS_AVL_TREE_LEFT_LIST_END( $arg0-&gt;tree_node )<br />
		set $left = STRUCT_ADDRESS_FROM_MEMBER( (AVL_TREE_PTR)AVL_TREE_LEFT_NODE( &amp;$arg0-&gt;tree_node ), VM_DESCRIPTOR, tree_node)<br />
		descriptor $left<br />
	end<br />
	printf &#8220;%3d  %10p %10p %10p %4d &#8220;, $arg0-&gt;reference_count, $arg0-&gt;start, $arg0-&gt;end, $arg0-&gt;unit, ($arg0-&gt;end-$arg0-&gt;start)/PAGE_SIZE<br />
	vm_prot &amp;$arg0-&gt;protection.user_write<br />
	printf &#8220;\n&#8221;</p>
<p>	if ! IS_AVL_TREE_RIGHT_LIST_END( $arg0-&gt;tree_node )<br />
		set $right = STRUCT_ADDRESS_FROM_MEMBER( (AVL_TREE_PTR)AVL_TREE_RIGHT_NODE( &amp;$arg0-&gt;tree_node ), VM_DESCRIPTOR, tree_node)<br />
		descriptor $right<br />
	end<br />
end</p>
<p>In the above example, IS_AVL_TREE_LEFT_LIST_END(), IS_AVL_TREE_RIGHT_LIST_END(),STRUCT_ADDRESS_FROM_MEMBER(),AVL_TREE_LEFT_NODE(), AVL_TREE_RIGHT_NODE() are macros. If gdb.evaluate() is implemented then I can use that function to execute/expand these C macros inside gdb get the value back into python.</p>
<p><a href="http://sourceware.org/gdb/wiki/PythonGdb" rel="nofollow">http://sourceware.org/gdb/wiki/PythonGdb</a> says &#8211; Breakpoints, blocks, frames, symbols, symbol tables, types, and values have Python representations. That means I can represent a C type inside python?</p>
<p>I would be very helpful, if you can write a small documentation for the existing work.</p>
<p>Thank you very much for the good effort.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bauermann</title>
		<link>http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/#comment-1508</link>
		<dc:creator><![CDATA[bauermann]]></dc:creator>
		<pubDate>Wed, 05 Nov 2008 14:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://bauermann.wordpress.com/?p=163#comment-1508</guid>
		<description><![CDATA[Sorry, I didn&#039;t understand what you mean with &quot;representing a gdb value/expression&quot;.

Do you mean storing an expression and then being able to eventually ask it to be evaluated by GDB? If so, would it solve your problem if you could store an expression as a string, and then pass it to a gdb.evaluate() function which would return a value for it?

If so, we can add such function, it should be easy. If not, what functionality would you need out of a python representation of an expression?

Thanks for your feedback, this is exactly the kind of input I need at this point.]]></description>
		<content:encoded><![CDATA[<p>Sorry, I didn&#8217;t understand what you mean with &#8220;representing a gdb value/expression&#8221;.</p>
<p>Do you mean storing an expression and then being able to eventually ask it to be evaluated by GDB? If so, would it solve your problem if you could store an expression as a string, and then pass it to a gdb.evaluate() function which would return a value for it?</p>
<p>If so, we can add such function, it should be easy. If not, what functionality would you need out of a python representation of an expression?</p>
<p>Thanks for your feedback, this is exactly the kind of input I need at this point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/#comment-1429</link>
		<dc:creator><![CDATA[Sam]]></dc:creator>
		<pubDate>Fri, 31 Oct 2008 04:41:03 +0000</pubDate>
		<guid isPermaLink="false">http://bauermann.wordpress.com/?p=163#comment-1429</guid>
		<description><![CDATA[I am interested in gdb python and frequently visit to see the progress. I initially took the source from git and compiled to test the scripting functionality but it disappointed me very much because there was no support for representing a gdb value/expression. I hope it is fixed in this patch. Will try it once I get time.]]></description>
		<content:encoded><![CDATA[<p>I am interested in gdb python and frequently visit to see the progress. I initially took the source from git and compiled to test the scripting functionality but it disappointed me very much because there was no support for representing a gdb value/expression. I hope it is fixed in this patch. Will try it once I get time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bauermann</title>
		<link>http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/#comment-1303</link>
		<dc:creator><![CDATA[bauermann]]></dc:creator>
		<pubDate>Fri, 17 Oct 2008 03:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://bauermann.wordpress.com/?p=163#comment-1303</guid>
		<description><![CDATA[Ok, I was too optimistic in asking everybody to jump in. This is early work, and some assembly is still required. If cloning a git repo and checking out a branch is sounds too difficult, then it is indeed better to wait a bit.

On the bright side, what we already merged into mainline GDB will appear in GDB&#039;s &lt;a href=&quot;ftp://sourceware.org/pub/gdb/snapshots/current&quot; rel=&quot;nofollow&quot;&gt;weekly snapshot&lt;/a&gt; tarball. Though for now I admit there&#039;s nothing useful there regarding Python support (as I mentioned in this post).]]></description>
		<content:encoded><![CDATA[<p>Ok, I was too optimistic in asking everybody to jump in. This is early work, and some assembly is still required. If cloning a git repo and checking out a branch is sounds too difficult, then it is indeed better to wait a bit.</p>
<p>On the bright side, what we already merged into mainline GDB will appear in GDB&#8217;s <a href="ftp://sourceware.org/pub/gdb/snapshots/current" rel="nofollow">weekly snapshot</a> tarball. Though for now I admit there&#8217;s nothing useful there regarding Python support (as I mentioned in this post).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alfred</title>
		<link>http://blog.bauermann.eng.br/2008/10/16/python-scripting-in-gdb-update/#comment-1293</link>
		<dc:creator><![CDATA[Alfred]]></dc:creator>
		<pubDate>Thu, 16 Oct 2008 07:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://bauermann.wordpress.com/?p=163#comment-1293</guid>
		<description><![CDATA[Why is so difficult to get the python-gdb source? cloning three git repositories? come on! we need a simple tar ball!]]></description>
		<content:encoded><![CDATA[<p>Why is so difficult to get the python-gdb source? cloning three git repositories? come on! we need a simple tar ball!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

