Debug: add GDB dtf function to dump tree to file

This commit is contained in:
Wilson Snyder 2012-07-23 20:21:04 -04:00
parent cbd073ed08
commit dee7210231
3 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -946,15 +946,19 @@ void AstNode::dumpGdb() { // For GDB only
dumpGdbHeader();
cout<<" "; dump(cout); cout<<endl;
}
void AstNode::dumpGdbHeader() const { // For GDB only
if (!this) { cout<<"This=NULL"<<endl; return; }
dumpPtrs(cout);
cout<<" Fileline = "<<fileline()<<endl;
}
void AstNode::dumpTreeGdb() { // For GDB only
if (!this) { cout<<"This=NULL"<<endl; return; }
dumpGdbHeader();
dumpTree(cout);
}
void AstNode::dumpGdbHeader() const { // For GDB only
if (!this) { cout<<"This=NULL"<<endl; return; }
dumpPtrs(cout);
cout<<" Fileline = "<<fileline()<<endl;
void AstNode::dumpTreeFileGdb(const char* filenamep) { // For GDB only
string filename = filenamep ? filenamep : v3Global.debugFilename("debug.tree",98);
v3Global.rootp()->dumpTreeFile(filename);
}
void AstNode::dumpPtrs(ostream& os) const {

View File

@ -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