Post

Replies

Boosts

Views

Activity

Capturing the instruction trace from the ARM ETM
According to the ARM documentation for the CPU models available in Apple Silicon, the CoreSight implementation includes an Embedded Trace Macrocell which can perform a complete "Instruction Trace" (https://developer.arm.com/documentation/102119/0200/What-is-trace-). Although other operating systems such as Linux make this easy, we have not been able to find any tools or even a system-level API for accessing this feature of the ETM. In the "Instruments" window of Xcode 16+, there is a "Processor Trace" instrument, but this performs sampling and is totally unrelated to the Instruction Trace we need for debugging and analysis purposes. Because it produces a complete, contiguous sequence of branch instructions, the Instruction Trace is essential for identifying precise execution behaviors that are otherwise invisible to the developer. On other platforms, an alternative is debugger scripting, but we have found far too many bugs and reliability issues with the macOS implementation of lldb. Any suggestions would be greatly appreciated!
1
0
131
1w
Complete control flow trace... possible?
Is there an xctrace instrument capable of capturing the complete control flow of a process? So far the best I can find is high-frequency sampling, but what I need is a trace of all machine instructions executed. This is easily done on Linux/Intel using the perf tool, which provides access to Intel's hardware-assisted tracing module (ptrace). According to the arm specification, my mac mini M1 (armv8.4-a) and M4 (armv9.2-a) both have hardware support in the CoreSight ETM (embedded trace macrocell) for full instruction tracing (i.e., no sampling, no gaps, no statistics--capturing the complete execution path). But it's not clear how I can access these features, if they are supported by the macos XNU kernel at all. After hours of searching online, it's nothing but dead ends. Any suggestions for documentation or Xcode tools or open-source tools or built-in macos tools would be much appreciated!
1
0
84
Aug ’25
Version of LLVM for Xcode 16.2
When upgrading to a new version of Xcode, normally we look in the "Toolchain version history" table of the Xcode wikipedia page. But for Xcode 16.2, it lists git tag swift-6.0.3-RELEASE, which fails to compile with a known error. There was a fix for this error way back on July 4, 2024, but for some reason this fix does not appear in swift-6.0.3-RELEASE (as confirmed with git log, even though the tag occurred on December 2, 2024). So it turns out the minimum tag is swift-6.1-RELEASE for building LLVM with Xcode 16.2 (there are no other release tags between these two). Is it possible that the wikipedia table is simply incorrect in this case? If not, is there a workaround to build swift-6.0.3-RELEASE using Xcode 16.2, as published by Apple?
0
0
81
Jul ’25
codesign fails with no explanation
When I first tried to sign my local unit test with the identity generated by Xcode, it failed because the intermediate certificate was missing. In that case, the error message explained that the trust chain could not be completed. But after installing the correct intermediate, codesign still fails, but no longer gives any explanation: codesign -f -s '0EFE7E591A4E690842094B8EC5AFDFE059637D3C' build/Darwin-Xcode-arm64_obf/bin/Release/UNITTEST build/Darwin-Xcode-arm64_obf/bin/Release/UNITTEST: replacing existing signature build/Darwin-Xcode-arm64_obf/bin/Release/UNITTEST: errSecInternalComponent It's the same error line "errSecInternalComponent". Is there a log somewhere that might explain what exactly is the error?
Topic: Code Signing SubTopic: General
2
0
61
Apr ’25