<?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: Call graphs using the GNU Project Debugger</title>
	<atom:link href="http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/</link>
	<description>A glimpse into my visual space</description>
	<lastBuildDate>Wed, 08 Sep 2010 04:12:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Vijay</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-86</link>
		<dc:creator>Vijay</dc:creator>
		<pubDate>Wed, 08 Sep 2010 04:12:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-86</guid>
		<description>&lt;code&gt;
=====================================
gdb --batch --command=breakpoints_file –p &#039;PID of process&#039;
=====================================
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code><br />
=====================================<br />
gdb --batch --command=breakpoints_file –p 'PID of process'<br />
=====================================<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vijay</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-85</link>
		<dc:creator>Vijay</dc:creator>
		<pubDate>Wed, 08 Sep 2010 04:10:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-85</guid>
		<description>&lt;code&gt;
step 3 again:
=====================================
gdb --batch --command=breakpoints_file –p 
=====================================
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code><br />
step 3 again:<br />
=====================================<br />
gdb --batch --command=breakpoints_file –p<br />
=====================================<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vijay</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-84</link>
		<dc:creator>Vijay</dc:creator>
		<pubDate>Wed, 08 Sep 2010 04:06:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-84</guid>
		<description>Hi,
Am adding on this technique to narrow down the scope of the logical problem without spending long time debugging ( like stepping through code for 50 iterations etc) 

This idea is based on “breakpoint commands” in GDB. 
Note the idea of breakpoint commands exists for long time, but its uniquely used here to trace function calls/variables without user intervention in gdb.
It could used in other debuggers as well in different forms.

Step 1:
Prereq: must have debugging symbols in the binary(built via –g flag for gcc).

Step 2:
Place all your GDB commands in one file say:

breakpoints_file:

set width 0
set height 0
set verbose off
break do_query  # this is where I want GDB to break automatically after attaching
commands 1 #this is where I issue breakpoint commands on above breakpoint
backtrace 2 #this is where I print a short stack-trace and further issue display commands to print certain local vars always
info args
# place any number of GDB display commands that you might want to see 
p *(*reqp).data1.cursor #printing some variables always on hitting a breakpoint.
p sql_stmt
p *reqp
continue
end # place an end to end breakpoint commands


Step 3: Then start with gdb as follows:

=====================================
gdb --batch --command=breakpoints_file –p 
=====================================

This will attach to the run-time daemon(process) and start printing or executing commands in background. Use ^c to exit finally. Very useful if you want to what’s there in any local variable every time a function runs and in different test cases.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Am adding on this technique to narrow down the scope of the logical problem without spending long time debugging ( like stepping through code for 50 iterations etc) </p>
<p>This idea is based on “breakpoint commands” in GDB.<br />
Note the idea of breakpoint commands exists for long time, but its uniquely used here to trace function calls/variables without user intervention in gdb.<br />
It could used in other debuggers as well in different forms.</p>
<p>Step 1:<br />
Prereq: must have debugging symbols in the binary(built via –g flag for gcc).</p>
<p>Step 2:<br />
Place all your GDB commands in one file say:</p>
<p>breakpoints_file:</p>
<p>set width 0<br />
set height 0<br />
set verbose off<br />
break do_query  # this is where I want GDB to break automatically after attaching<br />
commands 1 #this is where I issue breakpoint commands on above breakpoint<br />
backtrace 2 #this is where I print a short stack-trace and further issue display commands to print certain local vars always<br />
info args<br />
# place any number of GDB display commands that you might want to see<br />
p *(*reqp).data1.cursor #printing some variables always on hitting a breakpoint.<br />
p sql_stmt<br />
p *reqp<br />
continue<br />
end # place an end to end breakpoint commands</p>
<p>Step 3: Then start with gdb as follows:</p>
<p>=====================================<br />
gdb &#8211;batch &#8211;command=breakpoints_file –p<br />
=====================================</p>
<p>This will attach to the run-time daemon(process) and start printing or executing commands in background. Use ^c to exit finally. Very useful if you want to what’s there in any local variable every time a function runs and in different test cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: niu zj</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-83</link>
		<dc:creator>niu zj</dc:creator>
		<pubDate>Thu, 02 Sep 2010 12:57:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-83</guid>
		<description>when I use the test example,input ./callgraph test foo 23,then as the errors like below:
&quot;awk: line 27: regular expression compile failed (missing operand)
* print &quot;info args&quot;; *&quot;

could you help me?</description>
		<content:encoded><![CDATA[<p>when I use the test example,input ./callgraph test foo 23,then as the errors like below:<br />
&#8220;awk: line 27: regular expression compile failed (missing operand)<br />
* print &#8220;info args&#8221;; *&#8221;</p>
<p>could you help me?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vijay</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-82</link>
		<dc:creator>Vijay</dc:creator>
		<pubDate>Mon, 30 Aug 2010 12:39:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-82</guid>
		<description>Thanks, with little changes i was able to adapt the script to attach to running process and get info about interested functions.
To use this after modifications, callgraph 
note you have to remove some sanity checks as needed. major difference being:
------------
/dev/null &#124; awk &#039;
---
&gt; gdb --batch --command=$GETFUNCS $FILE 2&gt;/dev/null &#124; awk &#039;
71c96
   print &quot;run&quot;
75c100
/dev/null &#124; awk &#039;
---
&gt; gdb --batch --command=$TRACE --tty=/dev/null --args $FILE $@ 2&gt;/dev/null &#124; awk &#039;</description>
		<content:encoded><![CDATA[<p>Thanks, with little changes i was able to adapt the script to attach to running process and get info about interested functions.<br />
To use this after modifications, callgraph<br />
note you have to remove some sanity checks as needed. major difference being:<br />
&#8212;&#8212;&#8212;&#8212;<br />
/dev/null | awk &#8216;<br />
&#8212;<br />
&gt; gdb &#8211;batch &#8211;command=$GETFUNCS $FILE 2&gt;/dev/null | awk &#8216;<br />
71c96<br />
   print &#8220;run&#8221;<br />
75c100<br />
/dev/null | awk &#8216;<br />
&#8212;<br />
&gt; gdb &#8211;batch &#8211;command=$TRACE &#8211;tty=/dev/null &#8211;args $FILE $@ 2&gt;/dev/null | awk &#8216;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: su chen</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-81</link>
		<dc:creator>su chen</dc:creator>
		<pubDate>Wed, 12 May 2010 07:02:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-81</guid>
		<description>Thanks for the great tool!

however, this works on my rhel wich gcc 4.1.2 and gdb Fedora (6.8-37.el5) but does not work on freeBSD with gcc version 2.95.4 and GNU gdb 4.18 (FreeBSD) - no output at all on freeBSD, callgraph ends silently.

Could you please give some suggestions on modifying the shell script? thanks.</description>
		<content:encoded><![CDATA[<p>Thanks for the great tool!</p>
<p>however, this works on my rhel wich gcc 4.1.2 and gdb Fedora (6.8-37.el5) but does not work on freeBSD with gcc version 2.95.4 and GNU gdb 4.18 (FreeBSD) &#8211; no output at all on freeBSD, callgraph ends silently.</p>
<p>Could you please give some suggestions on modifying the shell script? thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gwyn Fireman</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-79</link>
		<dc:creator>Gwyn Fireman</dc:creator>
		<pubDate>Tue, 13 Apr 2010 15:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-79</guid>
		<description>Great tool!

I had a little trouble with fortran functions defined like
REAL(4) acoss(REAL(4));
The trace file would include an entry for a function named &quot;REAL&quot;, which would of course displease gdb.

Solved this by piping the &quot;getfuncs&quot; output through
 sed &quot;s/([0-9][0-9]*)//g&quot;
to get rid of all numbers within parens.

Thanks!</description>
		<content:encoded><![CDATA[<p>Great tool!</p>
<p>I had a little trouble with fortran functions defined like<br />
REAL(4) acoss(REAL(4));<br />
The trace file would include an entry for a function named &#8220;REAL&#8221;, which would of course displease gdb.</p>
<p>Solved this by piping the &#8220;getfuncs&#8221; output through<br />
 sed &#8220;s/([0-9][0-9]*)//g&#8221;<br />
to get rid of all numbers within parens.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alex</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-68</link>
		<dc:creator>alex</dc:creator>
		<pubDate>Tue, 15 Dec 2009 17:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-68</guid>
		<description>It is very useful! I&#039;ve added filtering of function list with grep and now I can use it on any project.</description>
		<content:encoded><![CDATA[<p>It is very useful! I&#8217;ve added filtering of function list with grep and now I can use it on any project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alex</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-67</link>
		<dc:creator>alex</dc:creator>
		<pubDate>Thu, 03 Dec 2009 16:26:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-67</guid>
		<description>Cool script... but it is rather slow on really big projects ( &gt;8k functions).
It takes around 100 sec to create breakpoints by gdb and  a eternity to run program.</description>
		<content:encoded><![CDATA[<p>Cool script&#8230; but it is rather slow on really big projects ( &gt;8k functions).<br />
It takes around 100 sec to create breakpoints by gdb and  a eternity to run program.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jmbr</title>
		<link>http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/comment-page-1/#comment-39</link>
		<dc:creator>jmbr</dc:creator>
		<pubDate>Tue, 29 Jan 2008 20:38:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.superadditive.com/2007/12/01/call-graphs-using-the-gnu-project-debugger/#comment-39</guid>
		<description>Hi Nicolas,

I&#039;m glad you like callgraph.

I&#039;ll implement the feature you mention as soon as time permits (currently I have a shortage of free time).

Thank you very much for your suggestion</description>
		<content:encoded><![CDATA[<p>Hi Nicolas,</p>
<p>I&#8217;m glad you like callgraph.</p>
<p>I&#8217;ll implement the feature you mention as soon as time permits (currently I have a shortage of free time).</p>
<p>Thank you very much for your suggestion</p>
]]></content:encoded>
	</item>
</channel>
</rss>
