Skip to content

Handle Mach-O thread command padding - #1524

Merged
Steve Pfister (steveisok) merged 1 commit into
microsoft:mainfrom
max-charlamb:max-charlamb/fix-macho-thread-command-padding
Nov 8, 2026
Merged

Steve Pfister (steveisok) merged 1 commit into
microsoft:mainfrom
max-charlamb:max-charlamb/fix-macho-thread-command-padding

Conversation

@max-charlamb

Copy link
Copy Markdown
Contributor

Summary

  • accept zero padding at the end of 64-bit Mach-O LC_THREAD commands
  • continue rejecting nonzero partial thread-state headers
  • align synthetic Mach-O thread commands to the required 8-byte boundary

The Mach-O format requires 64-bit load-command sizes to be multiples of 8 and requires padding bytes to be zero. Runtime-generated macOS x64 dumps therefore contain four trailing zero bytes after the final thread state. ClrMD previously interpreted those bytes as a truncated flavor/count header.

Related: dotnet/runtime#137115

Testing

  • dotnet test src\Microsoft.Diagnostics.Runtime.Tests\Microsoft.Diagnostics.Runtime.Tests.csproj --filter "FullyQualifiedName~ThreadContextTests" --no-restore -- passed, 16 tests
  • git diff --check -- passed

Note

This pull request description was generated with GitHub Copilot.

Accept zero padding at the end of 64-bit LC_THREAD commands while continuing to reject nonzero truncated headers. Align synthetic Mach-O commands so the regression test matches the file format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6297d10c-2f94-48bb-b897-bc0b3e1a855f
@steveisok
Steve Pfister (steveisok) merged commit 5d5f1b1 into microsoft:main Nov 8, 2026
10 checks passed
@max-charlamb
Max Charlamb (max-charlamb) deleted the max-charlamb/fix-macho-thread-command-padding branch November 9, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants