mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-12 04:29:05 +00:00
print reference only sections (PAGE0, UDATA)
This commit is contained in:
parent
523c6a3dc6
commit
8e146cac47
38
dumpobj.cpp
38
dumpobj.cpp
@ -425,12 +425,13 @@ bool dump_obj(const char *name, int fd)
|
||||
|
||||
|
||||
emit("", "MODULE", std::string(oname.data()));
|
||||
emit("", "CODE", "; section 1");
|
||||
printf("\n");
|
||||
|
||||
d.set_pc(0);
|
||||
d.set_code(true);
|
||||
|
||||
|
||||
for (auto &s : symbols) {
|
||||
for (const auto &s : symbols) {
|
||||
if (s.type == S_UND) continue;
|
||||
sections[s.section].symbols.push_back(s);
|
||||
}
|
||||
@ -440,6 +441,36 @@ bool dump_obj(const char *name, int fd)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// print out any reference-only sections and symbols.
|
||||
for (auto §ion : sections) {
|
||||
if ((section.flags & SEC_REF_ONLY) == 0) continue;
|
||||
if (section.size == 0) continue;
|
||||
|
||||
emit("", section.name);
|
||||
|
||||
if (section.org) emit("",".org", to_x(section.org,4,'$'));
|
||||
uint32_t pc = section.org;
|
||||
|
||||
auto &symbols = section.symbols;
|
||||
while (!symbols.empty()) {
|
||||
auto &s = symbols.back();
|
||||
|
||||
if (s.offset > pc) {
|
||||
emit("","ds", std::to_string(s.offset - pc));
|
||||
pc = s.offset;
|
||||
}
|
||||
emit(s.name);
|
||||
symbols.pop_back();
|
||||
}
|
||||
|
||||
if (pc < section.size)
|
||||
emit("","ds",std::to_string(section.size - pc));
|
||||
|
||||
emit("","ends");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
d.set_label_callback([§ion, §ions](int32_t offset) -> int32_t {
|
||||
auto &symbols = sections[section].symbols;
|
||||
|
||||
@ -467,6 +498,9 @@ bool dump_obj(const char *name, int fd)
|
||||
|
||||
//std::vector<symbol> labels = labels_for_section(symbols, section);
|
||||
|
||||
|
||||
emit("", "CODE", "; section 1");
|
||||
|
||||
auto iter = data.begin();
|
||||
while (iter != data.end()) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user