Internals: Show scope debug information.

This commit is contained in:
Wilson Snyder 2020-11-11 19:00:10 -05:00
parent 6dfce882a1
commit b84c9bb4c0
5 changed files with 16 additions and 5 deletions

View File

@ -1113,7 +1113,7 @@ void AstNode::dumpTreeAndNext(std::ostream& os, const string& indent, int maxDep
}
}
void AstNode::dumpTreeFile(const string& filename, bool append, bool doDump) {
void AstNode::dumpTreeFile(const string& filename, bool append, bool doDump, bool doCheck) {
// Not const function as calls checkTree
if (doDump) {
{ // Write log & close
@ -1131,7 +1131,7 @@ void AstNode::dumpTreeFile(const string& filename, bool append, bool doDump) {
}
}
}
if (v3Global.opt.debugCheck() || v3Global.opt.dumpTree()) {
if (doCheck && (v3Global.opt.debugCheck() || v3Global.opt.dumpTree())) {
// Error check
checkTree();
// Broken isn't part of check tree because it can munge iterp's

View File

@ -1821,7 +1821,8 @@ public:
void dumpTreeGdb(); // For GDB only
void dumpTreeAndNext(std::ostream& os = std::cout, const string& indent = " ",
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);
static void dumpTreeFileGdb(const char* filenamep = nullptr);
// METHODS - queries

View File

@ -1090,6 +1090,7 @@ void AstCell::dump(std::ostream& str) const {
void AstCellInline::dump(std::ostream& str) const {
this->AstNode::dump(str);
str << " -> " << origModName();
str << " [scopep=" << reinterpret_cast<const void*>(scopep()) << "]";
}
const char* AstClassPackage::broken() const {
BROKEN_BASE_RTN(AstNodeModule::broken());
@ -1179,7 +1180,7 @@ void AstInitArray::dump(std::ostream& str) const {
str << " ...";
break;
}
str << " [" << itr.first << "]=" << (void*)itr.second;
str << " [" << itr.first << "]=" << reinterpret_cast<const void*>(itr.second);
}
}
void AstJumpGo::dump(std::ostream& str) const {
@ -1415,7 +1416,7 @@ void AstTypeTable::dump(std::ostream& str) const {
}
void AstAssocArrayDType::dumpSmall(std::ostream& str) const {
this->AstNodeDType::dumpSmall(str);
str << "[assoc-" << (void*)keyDTypep() << "]";
str << "[assoc-" << reinterpret_cast<const void*>(keyDTypep()) << "]";
}
string AstAssocArrayDType::prettyDTypeName() const {
return subDTypep()->prettyDTypeName() + "[" + keyDTypep()->prettyDTypeName() + "]";
@ -1503,6 +1504,12 @@ void AstVar::dump(std::ostream& str) const {
if (!lifetime().isNone()) str << " [" << lifetime().ascii() << "] ";
str << " " << varType();
}
void AstScope::dump(std::ostream& str) const {
this->AstNode::dump(str);
str << " [abovep=" << reinterpret_cast<const void*>(aboveScopep()) << "]";
str << " [cellp=" << reinterpret_cast<const void*>(aboveCellp()) << "]";
str << " [modp=" << reinterpret_cast<const void*>(modp()) << "]";
}
void AstSenTree::dump(std::ostream& str) const {
this->AstNode::dump(str);
if (isMulti()) str << " [MULTI]";

View File

@ -2248,6 +2248,7 @@ public:
virtual bool maybePointedTo() const override { return true; }
virtual string name() const override { return m_name; } // * = Scope name
virtual void name(const string& name) override { m_name = name; }
virtual void dump(std::ostream& str) const override;
string nameDotless() const;
string nameVlSym() const { return ((string("vlSymsp->")) + nameDotless()); }
AstNodeModule* modp() const { return m_modp; }

View File

@ -45,8 +45,10 @@ module m2
input d,
// Due to bug the below disable used to be ignored.
// verilator lint_off UNOPT
// verilator lint_off UNOPTFLAT
output reg [1:0] q
// verilator lint_on UNOPT
// verilator lint_on UNOPTFLAT
);
always @* begin