Loading...
other-tools/dyld_usage.cpp dyld-1340 dyld-1122.1.2
--- dyld/dyld-1340/other-tools/dyld_usage.cpp
+++ dyld/dyld-1122.1.2/other-tools/dyld_usage.cpp
@@ -140,7 +140,6 @@
                 case DBG_DYLD_TIMING_APPLY_FIXUPS: enqueueEvent<apply_fixups>(event, false); break;
                 case DBG_DYLD_TIMING_ATTACH_CODESIGNATURE: enqueueEvent<attach_signature>(event, false); break;
                 case DBG_DYLD_TIMING_BUILD_CLOSURE: enqueueEvent<build_closure>(event, false); break;
-                case DBG_DYLD_TIMING_VALIDATE_CLOSURE: enqueueEvent<validate_closure>(event, false); break;
                 case DBG_DYLD_TIMING_DLADDR: enqueueEvent<dladdr>(event, true); break;
                 case DBG_DYLD_TIMING_DLCLOSE: enqueueEvent<dlclose>(event, true); break;
                 case DBG_DYLD_TIMING_FUNC_FOR_ADD_IMAGE: enqueueEvent<add_image_callback>(event, false); break;
@@ -156,7 +155,9 @@
                 case DBG_DYLD_TIMING_DLOPEN_PREFLIGHT: dequeueEvent<dlopen_preflight>(event, [&](dlopen_preflight* endEvent){
                     endEvent->result = event->arg2;
                 }); break;
-                case DBG_DYLD_TIMING_LAUNCH_EXECUTABLE: dequeueEvent<app_launch>(event, [&](app_launch* endEvent) {}); break;
+                case DBG_DYLD_TIMING_LAUNCH_EXECUTABLE: dequeueEvent<app_launch>(event, [&](app_launch* endEvent){
+                    endEvent->launchMode = event->arg4;
+                }); break;
                 case DBG_DYLD_TIMING_DLSYM: dequeueEvent<dlsym>(event, [&](dlsym* endEvent){
                     endEvent->result = event->arg2;
                 }); break;
@@ -168,8 +169,7 @@
                 case DBG_DYLD_TIMING_ATTACH_CODESIGNATURE: dequeueEvent<attach_signature>(event, [&](attach_signature* endEvent){}); break;
                 case DBG_DYLD_TIMING_BUILD_CLOSURE: dequeueEvent<build_closure>(event, [&](build_closure* endEvent){
                     endEvent->closureBuildState = event->arg2;
-                });break;
-                case DBG_DYLD_TIMING_VALIDATE_CLOSURE: dequeueEvent<validate_closure>(event, [&](validate_closure* endEvent){}); break;
+                }); break;
                 case DBG_DYLD_TIMING_DLCLOSE: dequeueEvent<dlclose>(event, [&](dlclose* endEvent){
                     endEvent->result = (int)event->arg2;
                 }); break;
@@ -312,7 +312,7 @@
         std::ostringstream line;
         bool extended = false;
         if (auto dlopenNode = dynamic_cast<dlopen *>(node.get())) {
-            line << "dlopen(\"" << dlopenNode->path << "\", " << dlopenNode->flagString() << ") -> 0x" << std::hex << dlopenNode->result;
+            line << "dlopen(\"" << dlopenNode->path << "\", " << dlopenNode->flagString() << ") -> 0x" << dlopenNode->result;
         } else if (auto dlopenPreflightNode = dynamic_cast<dlopen_preflight *>(node.get())) {
             line << "dlopen_preflight(\"" << dlopenPreflightNode->path << ") -> 0x" << dlopenPreflightNode->result;
         } else if (auto dlsymNode = dynamic_cast<dlsym *>(node.get())) {
@@ -323,10 +323,8 @@
             line << "attach codesignature";
         } else if (auto buildClosureNode = dynamic_cast<build_closure *>(node.get())) {
             line << "build closure -> " << buildClosureNode->buildStateString();
-        } else if (auto validateClosure = dynamic_cast<validate_closure *>(node.get())) {
-            line << "validate closure";
         } else if (auto launchNode = dynamic_cast<app_launch *>(node.get())) {
-            line << "app launch " + launchNode->flagsString() + "-> 0x" << std::hex << launchNode->address;
+            line << "app launch (dyld" << std::dec << launchNode->launchMode << ") -> 0x" << std::hex << launchNode->address;
         } else if (auto initNode  = dynamic_cast<static_init *>(node.get())) {
             line << "run static initializer 0x" << std::hex << initNode->funcAddress;
         } else if (auto fixupNode  = dynamic_cast<apply_fixups *>(node.get())) {
@@ -391,7 +389,7 @@
         } else if (auto launchNode = dynamic_cast<app_launch *>(node.get())) {
             sstr << std::hex;
             sstr << "{\"type\":\"app_launch\",\"address\":\"0x";
-            sstr << launchNode->address << "\",\"mode\":" << launchNode->flags << "";
+            sstr << launchNode->address << "\",\"mode\":" << launchNode->launchMode << "";
         } else if (auto initNode  = dynamic_cast<static_init *>(node.get())) {
             sstr << std::hex;
             sstr << "{\"type\":\"static_init\",\"image_address\":\"0x"  << initNode->libraryAddress;
@@ -579,32 +577,10 @@
     };
 
     struct app_launch : event_pair {
-        app_launch(ktrace_event_t E) : event_pair(E), address(E->arg2), flags(E->arg3) {}
+        app_launch(ktrace_event_t E) : event_pair(E), address(E->arg2) {}
         uint64_t address;
-        uint64_t flags;
+        uint64_t launchMode;
         std::vector<event_pair *> _children;
-
-        std::string flagsString() const {
-            if ( flags == (uint64_t)dyld3::DyldLaunchExecutableFlags::None )
-                return "";
-            std::string v;
-            if ( flags & (uint64_t)dyld3::DyldLaunchExecutableFlags::HasTPROHeap ) {
-                if ( !v.empty() )
-                    v += ", ";
-                v += "tpro-heap";
-            }
-            if ( flags & (uint64_t)dyld3::DyldLaunchExecutableFlags::HasTPRODataConst ) {
-                if ( !v.empty() )
-                    v += ", ";
-                v += "tpro-data-const";
-            }
-            if ( flags & (uint64_t)dyld3::DyldLaunchExecutableFlags::HasTPROStacks ) {
-                if ( !v.empty() )
-                    v += ", ";
-                v += "tpro-stacks";
-            }
-            return "(" + v + ") ";
-        }
     };
 
     struct static_init : event_pair {
@@ -647,10 +623,6 @@
                     return "built dlopen closure";
             }
         };
-    };
-
-    struct validate_closure : event_pair {
-        validate_closure(ktrace_event_t E) : event_pair(E) {}
     };
 
     struct add_image_callback : event_pair {