Skip to content

Commit 0657b09

Browse files
committed
wip
1 parent 5c868ca commit 0657b09

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

view/sharedcache/core/MachO.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,22 +448,18 @@ std::optional<SharedCacheMachOHeader> SharedCacheMachOHeader::ParseHeaderForAddr
448448
return header;
449449
}
450450

451+
// TODO: Support reading from .symbols file.
451452
// TODO: Replace view with address size?
452453
std::vector<CacheSymbol> SharedCacheMachOHeader::ReadSymbolTable(BinaryView& view, VirtualMemory& vm) const
453454
{
454455
auto addressSize = view.GetAddressSize();
455456
// NOTE: The symbol table will exist within the link edit segment, the table offsets are relative to the file not the linkedit segment.
456457
uint64_t symbolsAddress = GetLinkEditFileBase() + symtab.symoff;
457458
uint64_t stringsAddress = GetLinkEditFileBase() + symtab.stroff;
458-
uint64_t link = GetLinkEditFileBase();
459-
if (!vm.IsAddressMapped(link))
460-
{
461-
LogError("Link edit segment not mapped %llx", link);
462-
return {};
463-
}
464459

465460
// TODO: This needs to be passed in as an optional argument.
466461
// TODO: Sometimes symbol tables are shared and we have to offset into the table for a specific header.
462+
// TODO: The "shared" symbol tables are stored in .symbols files.
467463
int nlistStartIndex = 0;
468464

469465
std::vector<CacheSymbol> symbolList;

view/sharedcache/core/SharedCache.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ std::optional<CacheEntry> CacheEntry::FromFile(const std::string& filePath, Cach
5151
return std::nullopt;
5252

5353
// Read the header, this _should_ be compatible with all known DSC formats.
54+
// Mason: the above is not true! https://github.com/Vector35/binaryninja-api/issues/6073
5455
dyld_cache_header header = {};
5556
file->Read(&header, 0, sizeof(header));
5657

@@ -341,6 +342,8 @@ void SharedCache::ProcessEntry(const CacheEntry &entry)
341342
// std::vector<CacheSymbol> symbols = imageHeader->ReadSymbolTable(view, *m_vm);
342343
// AddSymbols(std::move(symbols));
343344

345+
// TODO: Process
346+
344347
// TODO: Should export symbols be put in a different bucket? How are they consumed differently?
345348
std::vector<CacheSymbol> exportSymbols = imageHeader->ReadExportSymbolTable(*m_vm);
346349
AddSymbols(std::move(exportSymbols));

view/sharedcache/core/SharedCacheView.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ bool SharedCacheView::Init()
180180
char magic[17];
181181
GetParentView()->Read(&magic, 0, 16);
182182
magic[16] = 0;
183+
184+
// TODO: Do we want to add any warnings about platform support here?
185+
// TODO: Do we still consider macos experimental?
183186
switch (platform)
184187
{
185188
case DSCPlatformMacOS:

view/sharedcache/ui/dsctriage.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ DSCTriageView::DSCTriageView(QWidget* parent, BinaryViewRef data) : QWidget(pare
121121

122122
auto refreshDataButton = new CustomStyleFlatPushButton();
123123
{
124+
// TODO: Might want to introduce a cooldown for this button (if we even keep it)
124125
connect(refreshDataButton, &QPushButton::clicked, [this](bool) { RefreshData(); });
125126
refreshDataButton->setText("Refresh");
126127

view/sharedcache/ui/symboltable.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ SymbolTableView::~SymbolTableView() {
113113

114114
void SymbolTableView::populateSymbols(BinaryView &view)
115115
{
116-
auto controller = SharedCacheController::GetController(view);
117-
if (controller) {
116+
if (auto controller = SharedCacheController::GetController(view)) {
118117
BackgroundThread::create(this)
119-
->thenBackground([this, controller](){ m_symbols = controller->GetSymbols(); })
118+
->thenBackground([this, controller]() {
119+
std::vector<CacheSymbol> newSymbols = controller->GetSymbols();
120+
m_symbols.swap(newSymbols);
121+
})
120122
->thenMainThread([this](){ m_model->updateSymbols(); })
121123
->start();
122124
}

0 commit comments

Comments
 (0)