mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-26 17:29:30 +00:00
-n flag to inhibit symbol lookup in expressions.
This commit is contained in:
parent
966a879419
commit
eb993acd2a
12
dumpobj.cpp
12
dumpobj.cpp
@ -30,6 +30,7 @@
|
||||
struct {
|
||||
bool _S = false;
|
||||
bool _g = false;
|
||||
bool _n = false;
|
||||
} flags;
|
||||
|
||||
|
||||
@ -285,7 +286,13 @@ bool dump_obj(const char *name, int fd)
|
||||
uint8_t section = read_8(iter);
|
||||
uint32_t offset = read_32(iter);
|
||||
|
||||
std::string name = d.location_name(section, offset);
|
||||
|
||||
std::string name;
|
||||
if (flags._n) {
|
||||
name = d.section_name(section) + "+" + d.to_x(offset, 4, '$');
|
||||
} else {
|
||||
name = d.location_name(section, offset);
|
||||
}
|
||||
stack.emplace_back(std::move(name));
|
||||
break;
|
||||
}
|
||||
@ -636,10 +643,11 @@ void dump(const char *name) {
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "Sg")) != -1) {
|
||||
while ((c = getopt(argc, argv, "Sgn")) != -1) {
|
||||
switch(c) {
|
||||
case 'S': flags._S = true; break;
|
||||
case 'g': flags._g = true; break;
|
||||
case 'n': flags._n = true; break;
|
||||
default: exit(EX_USAGE); break;
|
||||
}
|
||||
}
|
||||
|
@ -374,3 +374,21 @@ std::string zrdz_disassembler::symbol_name(unsigned entry) const {
|
||||
}
|
||||
return _symbols[entry].name;
|
||||
}
|
||||
|
||||
std::string zrdz_disassembler::section_name(unsigned section) const {
|
||||
|
||||
std::string defname = std::string("section") + std::to_string(section);
|
||||
|
||||
if (section >= _sections.size()) {
|
||||
warnx("Invalid section %d", section);
|
||||
return defname;
|
||||
}
|
||||
auto &e = _sections[section];
|
||||
if (!e.valid) {
|
||||
warnx("Invalid section %d", section);
|
||||
return defname;
|
||||
}
|
||||
|
||||
return e.name;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
|
||||
std::string location_name(unsigned section, uint32_t offset) const;
|
||||
std::string symbol_name(unsigned entry) const;
|
||||
std::string section_name(unsigned entry) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user