forked from Lephenixnoir/fxos
_ic: also print claims owned by provided address
This commit is contained in:
parent
2dbd910379
commit
0373ae50fe
|
@ -214,6 +214,9 @@ struct Disassembly
|
|||
claims which do not compare equal to c, this fails. */
|
||||
bool addExclusiveClaim(Claim const &c);
|
||||
|
||||
/* Get all claims owned by a certain address. */
|
||||
std::vector<Claim const *> findClaimsOwnedBy(uint32_t address);
|
||||
|
||||
// TODO: Add non-exclusive claims/handle collisions
|
||||
|
||||
|
||||
|
|
|
@ -227,6 +227,19 @@ bool Disassembly::addExclusiveClaim(Claim const &c)
|
|||
return exclusive;
|
||||
}
|
||||
|
||||
std::vector<Claim const *> Disassembly::findClaimsOwnedBy(uint32_t address)
|
||||
{
|
||||
std::vector<Claim const *> claims;
|
||||
|
||||
/* Since we don't order by owner we have to tank the linear search */
|
||||
for(auto const &c: this->claims) {
|
||||
if(c.owner == address)
|
||||
claims.push_back(&c);
|
||||
}
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
||||
|
||||
//---
|
||||
// DisassemblyPass
|
||||
|
|
12
shell/i.cpp
12
shell/i.cpp
|
@ -34,11 +34,19 @@ void _ic(Session &session, struct _ic_args const &args)
|
|||
return;
|
||||
|
||||
for(uint32_t address: args.addresses) {
|
||||
fmt::print("Claim over 0x{:08x}:\n", address);
|
||||
Claim const *claim = session.current_space->disasm.getClaimAt(address);
|
||||
if(claim)
|
||||
fmt::print("0x{:08x} is claimed by {}\n", address, claim->str());
|
||||
fmt::print(" 0x{:08x} is claimed by {}\n", address, claim->str());
|
||||
else
|
||||
fmt::print("0x{:08x} is not claimed\n", address);
|
||||
fmt::print(" 0x{:08x} is not claimed\n", address);
|
||||
|
||||
auto dep = session.current_space->disasm.findClaimsOwnedBy(address);
|
||||
fmt::print("Claims owned by 0x{:08x}:\n", address);
|
||||
for(Claim const *c: dep)
|
||||
fmt::print(" - {}\n", c->str());
|
||||
if(!dep.size())
|
||||
fmt::print(" (none)\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue