Some more bugfixes.
diff --git a/src/disassemble.cc b/src/disassemble.cc
index 3131b5a..4b65876 100644
--- a/src/disassemble.cc
+++ b/src/disassemble.cc
@@ -63,7 +63,13 @@
while (size > 0) {
if (!cs_disasm_iter(handle, &ptr, &size, &address, in)) {
- THROWF("Error disassembling function, address: $0", address);
+ // Some symbols that end up in the .text section aren't really functions
+ // but data. Not sure why this happens.
+ if (verbose_level > 1) {
+ printf("Error disassembling function at address: %" PRIx64 "\n",
+ address);
+ }
+ goto cleanup;
}
size_t count = in->detail->x86.op_count;
@@ -80,6 +86,7 @@
}
}
+cleanup:
cs_free(in, 1);
cs_close(&handle);
}
diff --git a/src/elf.cc b/src/elf.cc
index 91a5726..13075df 100644
--- a/src/elf.cc
+++ b/src/elf.cc
@@ -771,19 +771,6 @@
}
}
-void AddCatchAll(RangeSink* sink) {
- ForEachElf(sink->input_file(), sink,
- [sink](const ElfFile& elf, string_view /*filename*/,
- uint32_t /*index_base*/) {
- sink->AddFileRange("[ELF Headers]", elf.header_region());
- sink->AddFileRange("[ELF Headers]", elf.section_headers());
- sink->AddFileRange("[ELF Headers]", elf.segment_headers());
-
- });
- // The last-line fallback to make sure we cover the entire file.
- sink->AddFileRange("[Unmapped]", sink->input_file().data());
-}
-
// For object files, addresses are relative to the section they live in, which
// is indicated by ndx. We split this into:
//
@@ -1219,6 +1206,23 @@
});
}
+void AddCatchAll(RangeSink* sink) {
+ ForEachElf(sink->input_file(), sink,
+ [sink](const ElfFile& elf, string_view /*filename*/,
+ uint32_t /*index_base*/) {
+ sink->AddFileRange("[ELF Headers]", elf.header_region());
+ sink->AddFileRange("[ELF Headers]", elf.section_headers());
+ sink->AddFileRange("[ELF Headers]", elf.segment_headers());
+
+ });
+
+ // The last-line fallback to make sure we cover the entire VM space.
+ DoReadELFSegments(sink, kReportByEscapedSegmentName);
+
+ // The last-line fallback to make sure we cover the entire file.
+ sink->AddFileRange("[Unmapped]", sink->input_file().data());
+}
+
} // namespace
class ElfObjectFile : public ObjectFile {