Skip to content

Commit 1a12970

Browse files
committed
wip
1 parent 23656d8 commit 1a12970

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

view/sharedcache/core/FileAccessorCache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class WeakFileAccessor
6363
// File path for re-opening if needed
6464
std::string m_filePath;
6565

66+
// Used to re-add writes once the file accessor is "revived".
6667
std::shared_ptr<FileAccessorWriteLog> m_writeLog;
6768

6869
// TODO: Store a weak_ptr/shared_ptr to FileAccessorCache? That way we dont access Global()

view/sharedcache/core/SharedCacheController.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,17 @@ bool SharedCacheController::ApplyRegion(BinaryView& view, const CacheRegion& reg
127127
}
128128

129129
// Unique memory region name so that we don't cause collisions.
130+
// TODO: Better name? I dont really think so...
130131
const auto memoryRegionName = fmt::format("{}_0x{:x}", region.name, region.start);
131132

132133
// NOTE: Adding a data memory region will store the entire contents of the region in the BNDB.
133134
// TODO: We can use the AddRemoteMemoryRegion if we want to reload on view init.
134135
view.GetMemoryMap()->AddDataMemoryRegion(memoryRegionName, region.start, buffer, region.flags);
135136
// TODO: We might want to make this auto if we decide to "reload" all loaded region in view init.
136-
// view.AddUserSection(region.name, region.start, region.size, region.SectionSemanticsForRegion());
137+
// If we are not associated with an image we can create a section here to set the semantics.
138+
// This is important for stub regions, as they will deref non image data that we want to retrieve the value of.
139+
if (region.type != CacheRegionType::Image)
140+
view.AddUserSection(memoryRegionName, region.start, region.size, region.SectionSemanticsForRegion());
137141

138142
m_loadedRegions.insert(region.start);
139143

view/sharedcache/workflow/SharedCacheWorkflow.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,8 @@ void FixupStubs(Ref<AnalysisContext> ctx)
160160
{
161161
// Update all the functions inside our current activities function section.
162162
for (const auto &sectFunc : view->GetAnalysisFunctionList())
163-
{
164163
if (section->GetStart() <= sectFunc->GetStart() && sectFunc->GetStart() < section->GetEnd())
165-
{
166-
// If there are any new functions we should re-analyze the current function.
167-
func->Reanalyze();
168-
break;
169-
}
170-
}
164+
sectFunc->Reanalyze();
171165
}
172166

173167
workflowState->loadMutex.unlock();
@@ -184,7 +178,6 @@ void FixupStubs(Ref<AnalysisContext> ctx)
184178
if (dest.operation == MLIL_CONST_PTR)
185179
{
186180
// We're ready, everything is here
187-
// TODO: what the fuck does the above mean?
188181
func->SetAutoInlinedDuringAnalysis(true);
189182
return;
190183
}
@@ -388,7 +381,7 @@ void SharedCacheWorkflow::Register()
388381
ObjCActivity::Register(*workflow);
389382
workflow->RegisterActivity(new Activity("core.analysis.sharedCache.stubs", &FixupStubs));
390383
workflow->RegisterActivity(new Activity("core.analysis.sharedCache.calls", &FixupOffImageCalls));
391-
// workflow->Insert("core.function.analyzeTailCalls", "core.analysis.dsc.stubs");
384+
workflow->Insert("core.function.analyzeTailCalls", "core.analysis.sharedCache.stubs");
392385
workflow->Insert("core.function.analyzeTailCalls", "core.analysis.sharedCache.calls");
393386

394387
Workflow::RegisterWorkflow(workflow, WORKFLOW_DESCRIPTION);

0 commit comments

Comments
 (0)