From 299cd890fedbcbc5302d8237bf58597794ebde72 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Thu, 8 Mar 2018 23:10:38 +0000 Subject: For llvm-objdump and Mach-O files, update the printing of some thread states from core files. I tested this against the couple of core files that were getting errors about unknown thread flavors and it now produce the same output as the Xcode otool-classic(1) tool. Since the core files are huge I didn’t include them as test cases. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rdar://38216356 llvm-svn: 327077 --- llvm/tools/llvm-objdump/MachODump.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'llvm/tools/llvm-objdump') diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index b6c26ac9869..c5aba86b20e 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -9328,6 +9328,26 @@ static void PrintThreadCommand(MachO::thread_command t, const char *Ptr, outs() << "\t esh.flavor " << es.esh.flavor << " esh.count " << es.esh.count << "\n"; } + } else if (flavor == MachO::x86_EXCEPTION_STATE64) { + outs() << " flavor x86_EXCEPTION_STATE64\n"; + if (count == MachO::x86_EXCEPTION_STATE64_COUNT) + outs() << " count x86_EXCEPTION_STATE64_COUNT\n"; + else + outs() << " count " << count + << " (not x86_EXCEPTION_STATE64_COUNT)\n"; + struct MachO::x86_exception_state64_t es64; + left = end - begin; + if (left >= sizeof(MachO::x86_exception_state64_t)) { + memcpy(&es64, begin, sizeof(MachO::x86_exception_state64_t)); + begin += sizeof(MachO::x86_exception_state64_t); + } else { + memset(&es64, '\0', sizeof(MachO::x86_exception_state64_t)); + memcpy(&es64, begin, left); + begin += left; + } + if (isLittleEndian != sys::IsLittleEndianHost) + swapStruct(es64); + Print_x86_exception_state_t(es64); } else { outs() << " flavor " << flavor << " (unknown)\n"; outs() << " count " << count << "\n"; -- cgit v1.2.3