Skip to content

Commit 01dc6bd

Browse files
committed
Partly added possibility to read the function starts from disk
1 parent dce7eb4 commit 01dc6bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parser/file/macho/machoFile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ static inline bool machoFile_handleFunctionStarts(struct machoFile* self, struct
256256
uint32_t offset = macho_maybeSwap(32, bitsReversed, command->dataoff);
257257
uint32_t size = macho_maybeSwap(32, bitsReversed, command->datasize);
258258

259-
const void* bytes = baseAddress + offset + ((self->linkedit_vmaddr - self->text_vmaddr) - self->linkedit_fileoff);
260-
uint64_t funcAddr = self->text_vmaddr;
259+
const void* bytes = baseAddress + offset + (self->_.inMemory ? (self->linkedit_vmaddr - self->text_vmaddr) - self->linkedit_fileoff : 0);
260+
uint64_t funcAddr = self->text_vmaddr; // <--- TODO: What is the appropriate start when read from disk?
261261
for (size_t i = 0; i < size;) {
262262
funcAddr += getULEB128(bytes, &i);
263263
vector_uint64_push_back(&self->functionStarts, funcAddr);

0 commit comments

Comments
 (0)