<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Python_pretty-printer_for_gdb</id>
		<title>Python pretty-printer for gdb - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.verific.com/faq/index.php?action=history&amp;feed=atom&amp;title=Python_pretty-printer_for_gdb"/>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;action=history"/>
		<updated>2026-05-02T14:03:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.3</generator>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;diff=804&amp;oldid=prev</id>
		<title>Vince at 18:28, 13 September 2022</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;diff=804&amp;oldid=prev"/>
				<updated>2022-09-13T18:28:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 18:28, 13 September 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l58&quot; &gt;Line 58:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; Breakpoint 1, main (argc=1, argv=0x7fffffffe0b8) at test.cpp:62&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; Breakpoint 1, main (argc=1, argv=0x7fffffffe0b8) at test.cpp:62&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; 62&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; Message::PrintLine(&amp;quot;&amp;#160; &amp;#160; &amp;#160; &amp;#160; initial value: &amp;quot;, Strings::itoa(int_val)) ;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; 62&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; Message::PrintLine(&amp;quot;&amp;#160; &amp;#160; &amp;#160; &amp;#160; initial value: &amp;quot;, Strings::itoa(int_val)) ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;p *module_item&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) p *module_item&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $1 = {&amp;lt;Verific::VeriTreeNode&amp;gt; = {&amp;lt;Verific::VeriNode&amp;gt; = {&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $1 = {&amp;lt;Verific::VeriTreeNode&amp;gt; = {&amp;lt;Verific::VeriNode&amp;gt; = {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; _vptr.VeriNode = 0x5555565bcd18 &amp;lt;vtable for Verific::VeriDataDecl+16&amp;gt;, static _present_scope = 0x0,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; _vptr.VeriNode = 0x5555565bcd18 &amp;lt;vtable for Verific::VeriDataDecl+16&amp;gt;, static _present_scope = 0x0,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l80&quot; &gt;Line 80:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 80:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; static _unnamedscope_vs_decl_ids = 0x0, static _check_linefile_of_import = 1}, _linefile = 8589934594},&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; static _unnamedscope_vs_decl_ids = 0x0, static _check_linefile_of_import = 1}, _linefile = 8589934594},&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; _qualifiers = 0}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; _qualifiers = 0}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;p *val&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) p *val&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $2 = {_vptr.VeriBaseValue = 0x55555654b280 &amp;lt;vtable for Verific::VeriInteger+16&amp;gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $2 = {_vptr.VeriBaseValue = 0x55555654b280 &amp;lt;vtable for Verific::VeriInteger+16&amp;gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;source verific_pp.py&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) source verific_pp.py&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;p *module_item&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) p *module_item&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $3 = parameter P1 = 8 ;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $3 = parameter P1 = 8 ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;p *val&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb) p *val&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $4 = 8&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; $4 = 8&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; (gdb)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; &amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; &amp;lt;/nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Notice how before activating the Python pretty-printer, gdb prints out a lot of information when calling&amp;#160; 'p *module_item'&amp;#160; or&amp;#160; 'p *val' .&amp;#160; With the pretty-printer, it now prints only the value from GetPrettyPrintedString().&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Notice how before activating the Python pretty-printer, gdb prints out a lot of information when calling&amp;#160; 'p *module_item'&amp;#160; or&amp;#160; 'p *val' .&amp;#160; With the pretty-printer, it now prints only the value from GetPrettyPrintedString().&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Vince</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;diff=803&amp;oldid=prev</id>
		<title>Vince at 18:10, 13 September 2022</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;diff=803&amp;oldid=prev"/>
				<updated>2022-09-13T18:10:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 18:10, 13 September 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If gdb (GNU debugger) was compiled with Python support, it is possible to run Python scripts within gdb.&amp;#160; Below is an example of how to create a custom pretty-printer for Verific's &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;parse tree nodes&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If gdb (GNU debugger) was compiled with Python support, it is possible to run Python scripts &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;from &lt;/ins&gt;within gdb.&amp;#160; Below is an example of how to create a custom pretty-printer for Verific's &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;VeriTreeNode using gdb's Python interface&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The Python script itself looks like this&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The Python script itself looks like this&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Vince</name></author>	</entry>

	<entry>
		<id>https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;diff=802&amp;oldid=prev</id>
		<title>Vince: Created page with &quot;If gdb (GNU debugger) was compiled with Python support, it is possible to run Python scripts within gdb.  Below is an example of how to create a custom pretty-printer for Veri...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.verific.com/faq/index.php?title=Python_pretty-printer_for_gdb&amp;diff=802&amp;oldid=prev"/>
				<updated>2022-09-13T18:06:21Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;If gdb (GNU debugger) was compiled with Python support, it is possible to run Python scripts within gdb.  Below is an example of how to create a custom pretty-printer for Veri...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If gdb (GNU debugger) was compiled with Python support, it is possible to run Python scripts within gdb.  Below is an example of how to create a custom pretty-printer for Verific's parse tree nodes.&lt;br /&gt;
&lt;br /&gt;
The Python script itself looks like this&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    import gdb&lt;br /&gt;
    import re&lt;br /&gt;
 &lt;br /&gt;
    class VeriVhdlTreeNodePrinter:&lt;br /&gt;
        def __init__(self, val):&lt;br /&gt;
            self.val = val&lt;br /&gt;
 &lt;br /&gt;
        def to_string(self):&lt;br /&gt;
            eval_string = f&amp;quot;(({self.val.type.name}*){self.val.address})-&amp;gt;GetPrettyPrintedString()&amp;quot;&lt;br /&gt;
            return gdb.parse_and_eval(eval_string).string()&lt;br /&gt;
&lt;br /&gt;
    def verific_pp_func(val):&lt;br /&gt;
        lookup_tag = val.type.tag&lt;br /&gt;
        if lookup_tag is None:&lt;br /&gt;
            return None&lt;br /&gt;
   &lt;br /&gt;
        regex = re.compile(&amp;quot;^(Verific::)?(Veri|Vhdl)(\w)+$&amp;quot;)&lt;br /&gt;
        if regex.match(lookup_tag):&lt;br /&gt;
            return VeriVhdlTreeNodePrinter(val)&lt;br /&gt;
        return None&lt;br /&gt;
 &lt;br /&gt;
    gdb.pretty_printers.append(verific_pp_func)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
To automate sourcing of the Python script on gdb startup, add the following line to your ~/.gdbinit :&lt;br /&gt;
&lt;br /&gt;
    source ~/verific_pp.py&lt;br /&gt;
&lt;br /&gt;
The script calls Verific's GetPrettyPrintedString() API which essentially pretty prints the VeriTreeNode. It takes an object and not a pointer. Printing the pointer will still print the value of the pointer as per usual gdb behavior.&lt;br /&gt;
&lt;br /&gt;
Note that if a class has a name starting with Veri but is not derived from VeriTreeNode, gdb produces the following message :&lt;br /&gt;
&lt;br /&gt;
    (gdb) print *pointer_to_VeriLibrary_which_is_not_derived_from_VeriTreeNode&lt;br /&gt;
    $2 = Python Exception &amp;lt;class 'gdb.error'&amp;gt; Couldn't find method VeriLibrary::GetPrettyPrintedString:&lt;br /&gt;
    (gdb)&lt;br /&gt;
&lt;br /&gt;
The same will happen for VeriValue/VhdlValue/VeriBaseValue, etc, because these classes do not have the GetPrettyPrintedString() API. The pretty printer can be customized to exclude such classes, or modified to handle these other cases. This is just a regular regex rule.&lt;br /&gt;
&lt;br /&gt;
Here is the output from an example run :&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
    gdb ./test-linux-g&lt;br /&gt;
    Reading symbols from test-linux-g...&lt;br /&gt;
    (gdb) break 62&lt;br /&gt;
    Breakpoint 1 at 0x306b50: file test.cpp, line 62.&lt;br /&gt;
    (gdb) run&lt;br /&gt;
    Starting program: test-linux-g&lt;br /&gt;
    [Thread debugging using libthread_db enabled]&lt;br /&gt;
    Using host libthread_db library &amp;quot;/lib/x86_64-linux-gnu/libthread_db.so.1&amp;quot;.&lt;br /&gt;
    -- Analyzing Verilog file 'test.v' (VERI-1482)&lt;br /&gt;
    test.v(1): INFO: compiling module 'top' (VERI-1018)&lt;br /&gt;
    -- module: top&lt;br /&gt;
    --     param: P1&lt;br /&gt;
    --         initial expression: 8&lt;br /&gt;
&lt;br /&gt;
    Breakpoint 1, main (argc=1, argv=0x7fffffffe0b8) at test.cpp:62&lt;br /&gt;
    62                    Message::PrintLine(&amp;quot;        initial value: &amp;quot;, Strings::itoa(int_val)) ;&lt;br /&gt;
    (gdb) '''p *module_item'''&lt;br /&gt;
    $1 = {&amp;lt;Verific::VeriTreeNode&amp;gt; = {&amp;lt;Verific::VeriNode&amp;gt; = {&lt;br /&gt;
          _vptr.VeriNode = 0x5555565bcd18 &amp;lt;vtable for Verific::VeriDataDecl+16&amp;gt;, static _present_scope = 0x0,&lt;br /&gt;
          static _container_scope_arr = 0x0, static _sva_clock_expr = 0x0, static _default_clock = 0x0,&lt;br /&gt;
          static _default_disable_iff_cond = 0x0, static _has_disable_iff = 0, static _id_ref = 0x0,&lt;br /&gt;
          static _name_list = 0x0, static _inside_clocked_sequence = 0, static _contains_event_control = 0,&lt;br /&gt;
          static _contains_delay_control = 0, static _contains_even_id_in_body = 0, static _multiple_inferred_clock = 0,&lt;br /&gt;
          static _in_property_expr = 0, static _in_checker = 0, static _in_fork_join_none_or_any = 0,&lt;br /&gt;
          static _in_bind_directive = 0, static _hier_name_to_allow_mod_name = 0, static _do_not_recurse_packed_dims = 0,&lt;br /&gt;
          static _processing_param = 0x0, static _processing_expr = 0x0, static _msgs = 0x55555666b870,&lt;br /&gt;
          static _relaxed_msgs = 0x0, static _udp_edge_chars = 0x0, static _verilog_keywords = 0x0,&lt;br /&gt;
          static _verilog_tokens = 0x0, static _system_tasks = 0x0, static _ref_count_map = 0x0,&lt;br /&gt;
          static _attribute_map = 0x0, static _map_of_comment_arr = 0x0, static _global_clocking = 0x0,&lt;br /&gt;
          static _var_usage_running = 0, static _is_static_elab = 0, static _is_rtl_elab = 0,&lt;br /&gt;
          static _func_pointer_stack = 0x0, static _func_stack = 0x0, static _mutual_recursion_count = 0,&lt;br /&gt;
          static _max_mutual_recursion_count = 0, static _within_seq_area = 0, static _within_generate_endgenerate = 0,&lt;br /&gt;
          static _under_default_clock = 0, static _default_disable_defined = 0, static _has_delay_or_event_control = 0,&lt;br /&gt;
          static _processing_operand = 0, static _potential_always_loop = 0, static _reresolve_idrefs = 0,&lt;br /&gt;
          static _ignore_ams_in_rtl_elab = 0, static _follow_lrm_for_constant_func = 0, static _evaluated_vals = 0x0,&lt;br /&gt;
          static _evaluated_constraints = 0x0, static _p_evaluated_vals = 0x0, static _p_evaluated_constraints = 0x0,&lt;br /&gt;
          static _unnamedscope_vs_decl_ids = 0x0, static _check_linefile_of_import = 1}, _linefile = 8589934594},&lt;br /&gt;
      _qualifiers = 0}&lt;br /&gt;
    (gdb) '''p *val'''&lt;br /&gt;
    $2 = {_vptr.VeriBaseValue = 0x55555654b280 &amp;lt;vtable for Verific::VeriInteger+16&amp;gt;}&lt;br /&gt;
    (gdb) '''source verific_pp.py'''&lt;br /&gt;
    (gdb) '''p *module_item'''&lt;br /&gt;
    $3 = parameter P1 = 8 ;&lt;br /&gt;
&lt;br /&gt;
    (gdb) '''p *val'''&lt;br /&gt;
    $4 = 8&lt;br /&gt;
    (gdb)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Notice how before activating the Python pretty-printer, gdb prints out a lot of information when calling  'p *module_item'  or  'p *val' .  With the pretty-printer, it now prints only the value from GetPrettyPrintedString().&lt;/div&gt;</summary>
		<author><name>Vince</name></author>	</entry>

	</feed>