Skip to content

Commit

Permalink
more fixes for arg printing
Browse files Browse the repository at this point in the history
  • Loading branch information
peadar committed Jul 9, 2024
1 parent a56577d commit 432aed5
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,10 @@ PrintableFrame::PrintableFrame(Process &proc, const StackFrame &frame)
}

Dwarf::DIE removeCV(Dwarf::DIE type) {
while (type.tag() == Dwarf::DW_TAG_typedef
while (type &&
(type.tag() == Dwarf::DW_TAG_typedef
|| type.tag() == Dwarf::DW_TAG_const_type
|| type.tag() == Dwarf::DW_TAG_volatile_type)
|| type.tag() == Dwarf::DW_TAG_volatile_type))
type = Dwarf::DIE(type.attribute(Dwarf::DW_AT_type));
return type;
}
Expand Down Expand Up @@ -532,15 +533,17 @@ operator << (std::ostream &os, const RemoteValue &rv)
auto ptr = *(Elf::Addr *)&rv.buf[0];
os << (void *)ptr;
auto reftype = removeCV(DIE(rv.type.attribute(DW_AT_type)));
if (reftype.name() == "char") {
std::string s = rv.p.io->readString(ptr);
os << " \"" << s << "\"";
} else {
if (ptr == 0)
os << "->nullptr";
else
os << "->" << RemoteValue(rv.p, ptr, false, reftype);
break;
if (reftype) {
if (reftype.name() == "char") {
std::string s = rv.p.io->readString(ptr);
os << " \"" << s << "\"";
} else {
if (ptr == 0)
os << "->nullptr";
else
os << "->" << RemoteValue(rv.p, ptr, false, reftype);
break;
}
}
break;
}
Expand Down

0 comments on commit 432aed5

Please sign in to comment.