Skip to content

Commit 9293a0f

Browse files
authored
Merge pull request #315 from brandonvu12/master
Provide size report despite not translating VM pointer
2 parents a1bbc93 + 7028071 commit 9293a0f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/bloaty.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,8 @@ absl::string_view RangeSink::TranslateVMToFile(uint64_t address) {
13641364
uint64_t translated;
13651365
if (!translator_->vm_map.Translate(address, &translated) ||
13661366
translated > file_->data().size()) {
1367-
THROW("Can't translate VM pointer to file");
1367+
THROWF("Can't translate VM pointer ($0) to file", address);
1368+
13681369
}
13691370
return file_->data().substr(translated);
13701371
}

src/bloaty.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ class RangeSink {
203203
// input_file().data()) to a VM address.
204204
uint64_t TranslateFileToVM(const char* ptr);
205205
absl::string_view TranslateVMToFile(uint64_t address);
206+
const DualMap* Translator() { return translator_; }
207+
206208

207209
// Decompresses zlib-formatted data and returns the decompressed data.
208210
// Since the decompressed data is not actually part of the file, any

src/elf.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,12 @@ static void ReadELFSymbols(const InputFile& file, RangeSink* sink,
906906
if (verbose_level > 1) {
907907
printf("Disassembling function: %s\n", name.data());
908908
}
909+
// TODO(brandonvu) Continue if VM pointer cannot be translated. Issue #315
910+
uint64_t unused;
911+
if (!sink->Translator()->vm_map.Translate(full_addr, &unused)) {
912+
WARN("Can't translate VM pointer ($0) to file", full_addr);
913+
continue;
914+
}
909915
infop->text = sink->TranslateVMToFile(full_addr).substr(0, sym.st_size);
910916
infop->start_address = full_addr;
911917
DisassembleFindReferences(*infop, sink);

0 commit comments

Comments
 (0)