From dee721023138ba83f383b0b1fbb6ebf1ae23e904 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 23 Jul 2012 20:21:04 -0400 Subject: [PATCH] Debug: add GDB dtf function to dump tree to file --- src/.gdbinit | 7 +++++++ src/V3Ast.cpp | 12 ++++++++---- src/V3Ast.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index 9cfe8c654..c10fa860d 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -19,6 +19,13 @@ document pnt Verilator: Print AstNode NODEP's tree end +define dtf + call AstNode::dumpTreeFileGdb(0) +end +document dtf + Verilator: Dump AstNode tree to file +end + define watchedit watch AstNode::s_editCntGbl==$arg0 end diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 924382f9d..2cb19011e 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -946,15 +946,19 @@ void AstNode::dumpGdb() { // For GDB only dumpGdbHeader(); cout<<" "; dump(cout); cout<dumpTreeFile(filename); } void AstNode::dumpPtrs(ostream& os) const { diff --git a/src/V3Ast.h b/src/V3Ast.h index 69482608f..66b64cb51 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1109,6 +1109,7 @@ public: void dumpTreeGdb(); // For GDB only void dumpTreeAndNext(ostream& str=cout, const string& indent=" ", int maxDepth=0); void dumpTreeFile(const string& filename, bool append=false); + static void dumpTreeFileGdb(const char* filenamep=NULL); // METHODS - queries virtual bool isPure() const { return true; } // Else a $display, etc, that must be ordered with other displays