summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2024-11-04 10:21:45 -0500
committerkat <kat@vector35.com>2024-11-05 09:05:12 -0500
commitc0202b5956ab6aba0c3c98fbcc74f5d77f0cd9ab (patch)
tree9aa7c768ccc113a52847d68e48f846d24b7c3b9f /view/sharedcache
parent69598bf4de54956512b0cfa64d9451779a01d30f (diff)
[SharedCache] Changes to the alpha popup/info tab
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/core/SharedCache.cpp24
-rw-r--r--view/sharedcache/ui/dsctriage.cpp98
2 files changed, 55 insertions, 67 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index bc3b9321..3c3d97fa 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -12,29 +12,15 @@
* This has to recreate _all_ of the Mach-O View logic, but slightly differently, as everything is spicy and weird and
* different enough that it's not worth trying to make a shared base class.
*
- * Essentially:
- * 1. Make an API call through this class' FFI wrapper like SharedCache::GetAvailableImages(BinaryView* view)
- * 2. That hops into core and makes a `new SharedCache(view)` core object (every time, yes) that holds a bv member
- * variable
- * 3. Deserializes information from that BinaryView.
- * 4. Does this api call require reading the original cache? Then map VM pages
- * 5. Do your stuff, save any changes to the BinaryView's metadata
- * 6. Unmap VM pages (freeing file pointers, making sure this SharedCache object doesnt leak, etc)
- * 7. Return
+ * The SharedCache api object is a 'Controller' that serializes its own state in view metadata.
*
- * Since we do everything properly (mmaped files, etc) this is not actually that slow. It can handle being done for
- * several context menu items without visual lag.
+ * It is multithreading capable (multiple SharedCache objects can exist and do things on different threads, it will manage)
*
+ * View state is saved to BinaryView any time it changes, however due to json deser speed we must also cache it on heap.
+ * This cache is 'load bearing' and controllers on other threads may serialize it back to view after making changes, so it
+ * must be kept up to date.
*
- * Strategy notes:
*
- * While it is probably faster to map a file and read out metadata direct from disk,
- * this results in an extreme amount of duplicate code.
- *
- * So, we try to pre-load a ton of metadata out of the cache and store it on the view, for developer sanity reasons.
- *
- * For performance reasons related to serdes speeds we cache this view metadata deserialized, per application lifetime.
- * We could probably clear this when the file is closed?
*
* */
diff --git a/view/sharedcache/ui/dsctriage.cpp b/view/sharedcache/ui/dsctriage.cpp
index 29bec7ec..8b0decdc 100644
--- a/view/sharedcache/ui/dsctriage.cpp
+++ b/view/sharedcache/ui/dsctriage.cpp
@@ -17,7 +17,7 @@
#define QSETTINGS_KEY_SELECTED_TAB "DSCTriage-SelectedTab"
#define QSETTINGS_KEY_TAB_LAYOUT "DSCTriage-TabLayout"
#define QSETTINGS_KEY_IMAGELOAD_TAB_LAYOUT "DSCTriage-ImageLoadTabLayout"
-#define QSETTINGS_KEY_ALPHA_POPUP_SEEN "DSCTriage-AlphaPopupSeen"
+#define QSETTINGS_KEY_ALPHA_POPUP_SEEN "DSCTriage-AlphaPopupSeenV2"
DSCCacheBlocksView::DSCCacheBlocksView(QWidget* parent, BinaryViewRef data, Ref<SharedCacheAPI::SharedCache> cache)
@@ -639,51 +639,6 @@ DSCTriageView::DSCTriageView(QWidget* parent, BinaryViewRef data) : QWidget(pare
QWidget* defaultWidget = nullptr;
- // check for alpha popup qsetting
- QSettings settings;
- if (!(settings.contains(QSETTINGS_KEY_ALPHA_POPUP_SEEN) && settings.value(QSETTINGS_KEY_ALPHA_POPUP_SEEN).toBool()))
- {
-
- QTextBrowser *tb = new QTextBrowser(this);
- {
- tb->setOpenExternalLinks(true);
- auto alphaHtml =
- R"(
-<br>
-<h1>Shared Cache Alpha</h1>
-
-<p> This is the alpha release of the sharedcache viewer! We are hard at work improving this and adding features, but we wanted
-to make it available for users to play with as soon as possible. </p>
-
-<h2> Supported Platforms </h2>
-<ul>
- <li> iOS 11-17 (full) </li>
- <li> iOS 18 (partial, Objective-C optimization parsing is not implemented yet.) </li>
- <li> macOS x86/arm64e (partial) </li>
-</ul>
-
-<p> iOS parsing should work well for now. macOS parsing should be usable, but is still a work in progress. </p>
-
-<h2> Getting the latest version of the plugin </h2>
-
-<p> We frequently release "dev" builds which will contain the latest version of the SharedCache plugin (and many other things).
-
-You can find instructions on how to install these builds <a href="https://docs.binary.ninja/guide/index.html#development-branch">here</a>. </p>
-
-<h3> Reading / building the source </h3>
-<p>You can read the source and find instructions for building it <a href="https://github.com/Vector35/binaryninja-api/tree/dev/view/sharedcache">here</a>.
-
-Contributions are always welcome! </p>
-)";
- tb->setHtml(alphaHtml);
-
- m_triageTabs->addTab(tb, "Shared Cache Alpha");
-
- }
- settings.setValue(QSETTINGS_KEY_ALPHA_POPUP_SEEN, true);
- defaultWidget = tb;
- }
-
m_bottomRegionCollection = new DockableTabCollection();
m_bottomRegionTabs = new SplitTabWidget(m_bottomRegionCollection);
m_bottomRegionTabs->setTabStyle(new GlobalAreaTabStyle());
@@ -774,8 +729,7 @@ Contributions are always welcome! </p>
loadImageTable->setSelectionMode(QAbstractItemView::SingleSelection);
m_triageTabs->addTab(loadImageWidget, "Images");
- if (!defaultWidget)
- defaultWidget = loadImageWidget;
+ defaultWidget = loadImageWidget;
m_triageTabs->setCanCloseTab(loadImageWidget, false);
} // loadImageTable
@@ -857,6 +811,54 @@ Contributions are always welcome! </p>
// m_triageTabs->addTab(loadedRegionsWidget, "Loaded Regions");
} // loadedRegions
+
+
+ // check for alpha popup qsetting
+ QSettings settings;
+
+ QTextBrowser *tb = new QTextBrowser(this);
+ {
+ tb->setOpenExternalLinks(true);
+ auto alphaHtml =
+ R"(
+<br>
+<h1>Shared Cache Alpha</h1>
+
+<p> This is an experimental alpha release of the sharedcache view! We are hard at work improving this and adding features, but we wanted
+to make it available for users to experiment with as soon as possible. </p>
+
+<h2> Platforms </h2>
+<ul>
+ <li> iOS 11-17 (full) </li>
+ <li> iOS 18 (partial, Objective-C optimization parsing is not implemented yet.) May have issues. </li>
+ <li> macOS x86/arm64e (partial, may have issues) </li>
+</ul>
+
+<p> iOS parsing should work fairly well for now. macOS parsing should be usable, but both are still a work in progress. </p>
+
+<h2> Getting the latest version of the plugin </h2>
+
+<p> We frequently release "dev" builds which will contain the latest version of the SharedCache plugin (and many other things).
+
+You can find instructions on how to install these builds <a href="https://docs.binary.ninja/guide/index.html#development-branch">here</a>. </p>
+
+<h3> Reading / building the source </h3>
+<p>You can read the source and find instructions for building it <a href="https://github.com/Vector35/binaryninja-api/tree/dev/view/sharedcache">here</a>.
+
+Contributions are always welcome! </p>
+)";
+ tb->setHtml(alphaHtml);
+
+ m_triageTabs->addTab(tb, "Shared Cache Alpha");
+
+ }
+ if (!(settings.contains(QSETTINGS_KEY_ALPHA_POPUP_SEEN) && settings.value(QSETTINGS_KEY_ALPHA_POPUP_SEEN).toBool()))
+ {
+ LogAlert("dyld_shared_cache support is highly experimental! We do not expect it to work on all versions yet! See the 'alpha' tab in the Triage view for more information. ");
+ settings.setValue(QSETTINGS_KEY_ALPHA_POPUP_SEEN, true);
+ defaultWidget = tb;
+ }
+
containerWidget->addWidget(m_bottomRegionTabs);
m_triageTabs->addTab(cacheInfoWidget, "Cache Info");