Internal debug: avoid segflt with gdb "pnt"
This commit is contained in:
parent
35374f09b4
commit
dc306cf371
|
|
@ -7,21 +7,21 @@
|
||||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
define pn
|
define pn
|
||||||
call $arg0->dumpGdb()
|
call AstNode::dumpGdb($arg0)
|
||||||
end
|
end
|
||||||
document pn
|
document pn
|
||||||
Verilator: Print single AstNode NODEP
|
Verilator: Print single AstNode NODEP
|
||||||
end
|
end
|
||||||
|
|
||||||
define pnt
|
define pnt
|
||||||
call $arg0->dumpTreeGdb()
|
call AstNode::dumpTreeGdb($arg0)
|
||||||
end
|
end
|
||||||
document pnt
|
document pnt
|
||||||
Verilator: Print AstNode NODEP's tree
|
Verilator: Print AstNode NODEP's tree
|
||||||
end
|
end
|
||||||
|
|
||||||
define dtf
|
define dtf
|
||||||
call AstNode::dumpTreeFileGdb(0)
|
call AstNode::dumpTreeFileGdb($arg0, 0)
|
||||||
end
|
end
|
||||||
document dtf
|
document dtf
|
||||||
Verilator: Dump AstNode tree to file
|
Verilator: Dump AstNode tree to file
|
||||||
|
|
|
||||||
|
|
@ -1029,28 +1029,40 @@ void AstNode::checkTree() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction // Debug only
|
// cppcheck-suppress unusedFunction // Debug only
|
||||||
void AstNode::dumpGdb() { // For GDB only // LCOV_EXCL_LINE
|
void AstNode::dumpGdb(const AstNode* nodep) { // For GDB only // LCOV_EXCL_LINE
|
||||||
dumpGdbHeader(); // LCOV_EXCL_LINE
|
if (!nodep) {
|
||||||
|
cout << "<nullptr>" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodep->dumpGdbHeader();
|
||||||
cout << " ";
|
cout << " ";
|
||||||
dump(cout);
|
nodep->dump(cout);
|
||||||
cout << endl; // LCOV_EXCL_LINE
|
cout << endl;
|
||||||
}
|
} // LCOV_EXCL_STOP
|
||||||
// cppcheck-suppress unusedFunction // Debug only
|
// cppcheck-suppress unusedFunction // Debug only
|
||||||
void AstNode::dumpGdbHeader() const { // For GDB only // LCOV_EXCL_LINE
|
void AstNode::dumpGdbHeader() const { // For GDB only // LCOV_EXCL_START
|
||||||
dumpPtrs(cout); // LCOV_EXCL_LINE
|
dumpPtrs(cout);
|
||||||
cout << " Fileline = " << fileline() << endl; // LCOV_EXCL_LINE
|
cout << " Fileline = " << fileline() << endl;
|
||||||
}
|
} // LCOV_EXCL_STOP
|
||||||
// cppcheck-suppress unusedFunction // Debug only
|
// cppcheck-suppress unusedFunction // Debug only
|
||||||
void AstNode::dumpTreeGdb() { // For GDB only // LCOV_EXCL_LINE
|
void AstNode::dumpTreeGdb(const AstNode* nodep) { // For GDB only // LCOV_EXCL_START
|
||||||
dumpGdbHeader(); // LCOV_EXCL_LINE
|
if (!nodep) {
|
||||||
dumpTree(cout); // LCOV_EXCL_LINE
|
cout << "<nullptr>" << endl;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
nodep->dumpGdbHeader();
|
||||||
|
nodep->dumpTree(cout);
|
||||||
|
} // LCOV_EXCL_STOP
|
||||||
// cppcheck-suppress unusedFunction // Debug only
|
// cppcheck-suppress unusedFunction // Debug only
|
||||||
void AstNode::dumpTreeFileGdb(const char* filenamep) { // For GDB only // LCOV_EXCL_LINE
|
void AstNode::dumpTreeFileGdb(const AstNode* nodep, // LCOV_EXCL_START
|
||||||
string filename
|
const char* filenamep) { // For GDB only
|
||||||
= filenamep ? filenamep : v3Global.debugFilename("debug.tree", 98); // LCOV_EXCL_LINE
|
if (!nodep) {
|
||||||
v3Global.rootp()->dumpTreeFile(filename); // LCOV_EXCL_LINE
|
cout << "<nullptr>" << endl;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
string filename = filenamep ? filenamep : v3Global.debugFilename("debug.tree", 98);
|
||||||
|
v3Global.rootp()->dumpTreeFile(filename);
|
||||||
|
} // LCOV_EXCL_STOP
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction // Debug only
|
// cppcheck-suppress unusedFunction // Debug only
|
||||||
void AstNode::checkIter() const {
|
void AstNode::checkIter() const {
|
||||||
|
|
|
||||||
|
|
@ -1761,7 +1761,7 @@ public:
|
||||||
string warnOther() const { return fileline()->warnOther(); }
|
string warnOther() const { return fileline()->warnOther(); }
|
||||||
|
|
||||||
virtual void dump(std::ostream& str = std::cout) const;
|
virtual void dump(std::ostream& str = std::cout) const;
|
||||||
void dumpGdb(); // For GDB only
|
static void dumpGdb(const AstNode* nodep); // For GDB only
|
||||||
void dumpGdbHeader() const;
|
void dumpGdbHeader() const;
|
||||||
|
|
||||||
// METHODS - Tree modifications
|
// METHODS - Tree modifications
|
||||||
|
|
@ -1811,12 +1811,12 @@ public:
|
||||||
void dumpTree(const string& indent, int maxDepth = 0) const {
|
void dumpTree(const string& indent, int maxDepth = 0) const {
|
||||||
dumpTree(cout, indent, maxDepth);
|
dumpTree(cout, indent, maxDepth);
|
||||||
}
|
}
|
||||||
void dumpTreeGdb(); // For GDB only
|
static void dumpTreeGdb(const AstNode* nodep); // For GDB only
|
||||||
void dumpTreeAndNext(std::ostream& os = std::cout, const string& indent = " ",
|
void dumpTreeAndNext(std::ostream& os = std::cout, const string& indent = " ",
|
||||||
int maxDepth = 0) const;
|
int maxDepth = 0) const;
|
||||||
void dumpTreeFile(const string& filename, bool append = false, bool doDump = true,
|
void dumpTreeFile(const string& filename, bool append = false, bool doDump = true,
|
||||||
bool doCheck = true);
|
bool doCheck = true);
|
||||||
static void dumpTreeFileGdb(const char* filenamep = nullptr);
|
static void dumpTreeFileGdb(const AstNode* nodep, const char* filenamep = nullptr);
|
||||||
|
|
||||||
// METHODS - queries
|
// METHODS - queries
|
||||||
// Changes control flow, disable some optimizations
|
// Changes control flow, disable some optimizations
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue