Re: [Lldb-commits] [lldb] r325068 - [cmake] Darwin: Copy in the system debugserver if needed
By default the cmake build doesn't build LLDB.framework, but thanks for raising the point, we can avoid the copy when that build setting is in place. vedant > On Feb 13, 2018, at 3:11 PM, Greg Claytonwrote: > > If "debugserver" isn't put into the LLDB.framework, then it falls back to > using the one in the currently selected Xcode. We don't really need to copy > it if we just want to use the active system version? > >> On Feb 13, 2018, at 3:08 PM, Vedant Kumar via lldb-commits >> wrote: >> >> @Davide I think you ran into this issue yesterday, let me know if this >> resolves it for you. >> >> vedant >> >>> On Feb 13, 2018, at 3:05 PM, Vedant Kumar via lldb-commits >>> wrote: >>> >>> Author: vedantk >>> Date: Tue Feb 13 15:05:46 2018 >>> New Revision: 325068 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=325068=rev >>> Log: >>> [cmake] Darwin: Copy in the system debugserver if needed >>> >>> This makes the built debugger functional on Darwin when compiling >>> without code signing (as documented in docs/code-signing.txt). >>> >>> Modified: >>> lldb/trunk/CMakeLists.txt >>> lldb/trunk/test/CMakeLists.txt >>> lldb/trunk/tools/debugserver/source/CMakeLists.txt >>> lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt >>> >>> Modified: lldb/trunk/CMakeLists.txt >>> URL: >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=325068=325067=325068=diff >>> == >>> --- lldb/trunk/CMakeLists.txt (original) >>> +++ lldb/trunk/CMakeLists.txt Tue Feb 13 15:05:46 2018 >>> @@ -56,6 +56,22 @@ if (NOT LLDB_DISABLE_PYTHON) >>> >>> add_subdirectory(scripts) >>> endif () >>> + >>> +if(CMAKE_HOST_APPLE) >>> + if(LLDB_CODESIGN_IDENTITY) >>> +set(DEBUGSERVER_PATH $) >>> + else() >>> +execute_process( >>> + COMMAND xcode-select -p >>> + OUTPUT_VARIABLE XCODE_DEV_DIR) >>> +string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) >>> +set(DEBUGSERVER_PATH >>> + >>> "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") >>> +set(SKIP_DEBUGSERVER True) >>> + endif() >>> + message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") >>> +endif() >>> + >>> add_subdirectory(source) >>> add_subdirectory(tools) >>> >>> >>> Modified: lldb/trunk/test/CMakeLists.txt >>> URL: >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=325068=325067=325068=diff >>> == >>> --- lldb/trunk/test/CMakeLists.txt (original) >>> +++ lldb/trunk/test/CMakeLists.txt Tue Feb 13 15:05:46 2018 >>> @@ -110,17 +110,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Wi >>> endif() >>> >>> if(CMAKE_HOST_APPLE) >>> - if(LLDB_CODESIGN_IDENTITY) >>> -set(DEBUGSERVER_PATH $) >>> - else() >>> -execute_process( >>> - COMMAND xcode-select -p >>> - OUTPUT_VARIABLE XCODE_DEV_DIR) >>> -string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) >>> -set(DEBUGSERVER_PATH >>> - >>> "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") >>> - endif() >>> - message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") >>> list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH}) >>> endif() >>> >>> >>> Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt >>> URL: >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=325068=325067=325068=diff >>> == >>> --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) >>> +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Feb 13 15:05:46 >>> 2018 >>> @@ -195,7 +195,15 @@ if("${LLDB_CODESIGN_IDENTITY}" STREQUAL >>> endif() >>> option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults >>> Off when using lldb_codesign identity, otherwise On)" >>> ${LLDB_USE_ENTITLEMENTS_Default}) >>> >>> -if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")) >>> +if ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "") >>> + if (CMAKE_HOST_APPLE) >>> +# If we haven't built a signed debugserver, copy the one from the >>> system. >>> +add_custom_target(debugserver >>> + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEBUGSERVER_PATH} >>> ${CMAKE_BINARY_DIR}/bin >>> + VERBATIM >>> + COMMENT "Copying the system debugserver to LLDB's binaries >>> directory.") >>> + endif() >>> +else() >>> if(LLDB_USE_ENTITLEMENTS) >>> set(entitlements_flags --entitlements ${entitlements_xml}) >>> endif() >>> >>> Modified: lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt >>> URL: >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt?rev=325068=325067=325068=diff >>> == >>> ---
Re: [Lldb-commits] [lldb] r325068 - [cmake] Darwin: Copy in the system debugserver if needed
If "debugserver" isn't put into the LLDB.framework, then it falls back to using the one in the currently selected Xcode. We don't really need to copy it if we just want to use the active system version? > On Feb 13, 2018, at 3:08 PM, Vedant Kumar via lldb-commits >wrote: > > @Davide I think you ran into this issue yesterday, let me know if this > resolves it for you. > > vedant > >> On Feb 13, 2018, at 3:05 PM, Vedant Kumar via lldb-commits >> wrote: >> >> Author: vedantk >> Date: Tue Feb 13 15:05:46 2018 >> New Revision: 325068 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=325068=rev >> Log: >> [cmake] Darwin: Copy in the system debugserver if needed >> >> This makes the built debugger functional on Darwin when compiling >> without code signing (as documented in docs/code-signing.txt). >> >> Modified: >> lldb/trunk/CMakeLists.txt >> lldb/trunk/test/CMakeLists.txt >> lldb/trunk/tools/debugserver/source/CMakeLists.txt >> lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt >> >> Modified: lldb/trunk/CMakeLists.txt >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=325068=325067=325068=diff >> == >> --- lldb/trunk/CMakeLists.txt (original) >> +++ lldb/trunk/CMakeLists.txt Tue Feb 13 15:05:46 2018 >> @@ -56,6 +56,22 @@ if (NOT LLDB_DISABLE_PYTHON) >> >> add_subdirectory(scripts) >> endif () >> + >> +if(CMAKE_HOST_APPLE) >> + if(LLDB_CODESIGN_IDENTITY) >> +set(DEBUGSERVER_PATH $) >> + else() >> +execute_process( >> + COMMAND xcode-select -p >> + OUTPUT_VARIABLE XCODE_DEV_DIR) >> +string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) >> +set(DEBUGSERVER_PATH >> + >> "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") >> +set(SKIP_DEBUGSERVER True) >> + endif() >> + message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") >> +endif() >> + >> add_subdirectory(source) >> add_subdirectory(tools) >> >> >> Modified: lldb/trunk/test/CMakeLists.txt >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=325068=325067=325068=diff >> == >> --- lldb/trunk/test/CMakeLists.txt (original) >> +++ lldb/trunk/test/CMakeLists.txt Tue Feb 13 15:05:46 2018 >> @@ -110,17 +110,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Wi >> endif() >> >> if(CMAKE_HOST_APPLE) >> - if(LLDB_CODESIGN_IDENTITY) >> -set(DEBUGSERVER_PATH $) >> - else() >> -execute_process( >> - COMMAND xcode-select -p >> - OUTPUT_VARIABLE XCODE_DEV_DIR) >> -string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) >> -set(DEBUGSERVER_PATH >> - >> "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") >> - endif() >> - message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") >> list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH}) >> endif() >> >> >> Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=325068=325067=325068=diff >> == >> --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) >> +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Feb 13 15:05:46 >> 2018 >> @@ -195,7 +195,15 @@ if("${LLDB_CODESIGN_IDENTITY}" STREQUAL >> endif() >> option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults >> Off when using lldb_codesign identity, otherwise On)" >> ${LLDB_USE_ENTITLEMENTS_Default}) >> >> -if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")) >> +if ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "") >> + if (CMAKE_HOST_APPLE) >> +# If we haven't built a signed debugserver, copy the one from the >> system. >> +add_custom_target(debugserver >> + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEBUGSERVER_PATH} >> ${CMAKE_BINARY_DIR}/bin >> + VERBATIM >> + COMMENT "Copying the system debugserver to LLDB's binaries >> directory.") >> + endif() >> +else() >> if(LLDB_USE_ENTITLEMENTS) >>set(entitlements_flags --entitlements ${entitlements_xml}) >> endif() >> >> Modified: lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt?rev=325068=325067=325068=diff >> == >> --- lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt (original) >> +++ lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt Tue Feb 13 >> 15:05:46 2018 >> @@ -13,7 +13,7 @@ add_lldb_test_executable(thread_inferior >> add_lldb_test_executable(environment_check inferior/environment_check.cpp) >> >> if (CMAKE_SYSTEM_NAME MATCHES "Darwin") >> -
Re: [Lldb-commits] [lldb] r325068 - [cmake] Darwin: Copy in the system debugserver if needed
@Davide I think you ran into this issue yesterday, let me know if this resolves it for you. vedant > On Feb 13, 2018, at 3:05 PM, Vedant Kumar via lldb-commits >wrote: > > Author: vedantk > Date: Tue Feb 13 15:05:46 2018 > New Revision: 325068 > > URL: http://llvm.org/viewvc/llvm-project?rev=325068=rev > Log: > [cmake] Darwin: Copy in the system debugserver if needed > > This makes the built debugger functional on Darwin when compiling > without code signing (as documented in docs/code-signing.txt). > > Modified: >lldb/trunk/CMakeLists.txt >lldb/trunk/test/CMakeLists.txt >lldb/trunk/tools/debugserver/source/CMakeLists.txt >lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt > > Modified: lldb/trunk/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=325068=325067=325068=diff > == > --- lldb/trunk/CMakeLists.txt (original) > +++ lldb/trunk/CMakeLists.txt Tue Feb 13 15:05:46 2018 > @@ -56,6 +56,22 @@ if (NOT LLDB_DISABLE_PYTHON) > > add_subdirectory(scripts) > endif () > + > +if(CMAKE_HOST_APPLE) > + if(LLDB_CODESIGN_IDENTITY) > +set(DEBUGSERVER_PATH $) > + else() > +execute_process( > + COMMAND xcode-select -p > + OUTPUT_VARIABLE XCODE_DEV_DIR) > +string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) > +set(DEBUGSERVER_PATH > + > "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") > +set(SKIP_DEBUGSERVER True) > + endif() > + message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") > +endif() > + > add_subdirectory(source) > add_subdirectory(tools) > > > Modified: lldb/trunk/test/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=325068=325067=325068=diff > == > --- lldb/trunk/test/CMakeLists.txt (original) > +++ lldb/trunk/test/CMakeLists.txt Tue Feb 13 15:05:46 2018 > @@ -110,17 +110,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Wi > endif() > > if(CMAKE_HOST_APPLE) > - if(LLDB_CODESIGN_IDENTITY) > -set(DEBUGSERVER_PATH $) > - else() > -execute_process( > - COMMAND xcode-select -p > - OUTPUT_VARIABLE XCODE_DEV_DIR) > -string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) > -set(DEBUGSERVER_PATH > - > "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") > - endif() > - message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") > list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH}) > endif() > > > Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=325068=325067=325068=diff > == > --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) > +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Feb 13 15:05:46 > 2018 > @@ -195,7 +195,15 @@ if("${LLDB_CODESIGN_IDENTITY}" STREQUAL > endif() > option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults Off > when using lldb_codesign identity, otherwise On)" > ${LLDB_USE_ENTITLEMENTS_Default}) > > -if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")) > +if ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "") > + if (CMAKE_HOST_APPLE) > +# If we haven't built a signed debugserver, copy the one from the system. > +add_custom_target(debugserver > + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEBUGSERVER_PATH} > ${CMAKE_BINARY_DIR}/bin > + VERBATIM > + COMMENT "Copying the system debugserver to LLDB's binaries directory.") > + endif() > +else() > if(LLDB_USE_ENTITLEMENTS) > set(entitlements_flags --entitlements ${entitlements_xml}) > endif() > > Modified: lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt?rev=325068=325067=325068=diff > == > --- lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt (original) > +++ lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt Tue Feb 13 15:05:46 > 2018 > @@ -13,7 +13,7 @@ add_lldb_test_executable(thread_inferior > add_lldb_test_executable(environment_check inferior/environment_check.cpp) > > if (CMAKE_SYSTEM_NAME MATCHES "Darwin") > - add_definitions(-DLLDB_SERVER="$" > -DLLDB_SERVER_IS_DEBUGSERVER=1) > + add_definitions(-DLLDB_SERVER="${DEBUGSERVER_PATH}" > -DLLDB_SERVER_IS_DEBUGSERVER=1) > else() > add_definitions(-DLLDB_SERVER="$" > -DLLDB_SERVER_IS_DEBUGSERVER=0) > endif() > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r325068 - [cmake] Darwin: Copy in the system debugserver if needed
Author: vedantk Date: Tue Feb 13 15:05:46 2018 New Revision: 325068 URL: http://llvm.org/viewvc/llvm-project?rev=325068=rev Log: [cmake] Darwin: Copy in the system debugserver if needed This makes the built debugger functional on Darwin when compiling without code signing (as documented in docs/code-signing.txt). Modified: lldb/trunk/CMakeLists.txt lldb/trunk/test/CMakeLists.txt lldb/trunk/tools/debugserver/source/CMakeLists.txt lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=325068=325067=325068=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Tue Feb 13 15:05:46 2018 @@ -56,6 +56,22 @@ if (NOT LLDB_DISABLE_PYTHON) add_subdirectory(scripts) endif () + +if(CMAKE_HOST_APPLE) + if(LLDB_CODESIGN_IDENTITY) +set(DEBUGSERVER_PATH $) + else() +execute_process( + COMMAND xcode-select -p + OUTPUT_VARIABLE XCODE_DEV_DIR) +string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) +set(DEBUGSERVER_PATH + "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") +set(SKIP_DEBUGSERVER True) + endif() + message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") +endif() + add_subdirectory(source) add_subdirectory(tools) Modified: lldb/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=325068=325067=325068=diff == --- lldb/trunk/test/CMakeLists.txt (original) +++ lldb/trunk/test/CMakeLists.txt Tue Feb 13 15:05:46 2018 @@ -110,17 +110,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Wi endif() if(CMAKE_HOST_APPLE) - if(LLDB_CODESIGN_IDENTITY) -set(DEBUGSERVER_PATH $) - else() -execute_process( - COMMAND xcode-select -p - OUTPUT_VARIABLE XCODE_DEV_DIR) -string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR) -set(DEBUGSERVER_PATH - "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver") - endif() - message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}") list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH}) endif() Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=325068=325067=325068=diff == --- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original) +++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Feb 13 15:05:46 2018 @@ -195,7 +195,15 @@ if("${LLDB_CODESIGN_IDENTITY}" STREQUAL endif() option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults Off when using lldb_codesign identity, otherwise On)" ${LLDB_USE_ENTITLEMENTS_Default}) -if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")) +if ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "") + if (CMAKE_HOST_APPLE) +# If we haven't built a signed debugserver, copy the one from the system. +add_custom_target(debugserver + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEBUGSERVER_PATH} ${CMAKE_BINARY_DIR}/bin + VERBATIM + COMMENT "Copying the system debugserver to LLDB's binaries directory.") + endif() +else() if(LLDB_USE_ENTITLEMENTS) set(entitlements_flags --entitlements ${entitlements_xml}) endif() Modified: lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt?rev=325068=325067=325068=diff == --- lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt (original) +++ lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt Tue Feb 13 15:05:46 2018 @@ -13,7 +13,7 @@ add_lldb_test_executable(thread_inferior add_lldb_test_executable(environment_check inferior/environment_check.cpp) if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - add_definitions(-DLLDB_SERVER="$" -DLLDB_SERVER_IS_DEBUGSERVER=1) + add_definitions(-DLLDB_SERVER="${DEBUGSERVER_PATH}" -DLLDB_SERVER_IS_DEBUGSERVER=1) else() add_definitions(-DLLDB_SERVER="$" -DLLDB_SERVER_IS_DEBUGSERVER=0) endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43215: Supply missing break in case statement.
zturner added a reviewer: asmith. zturner added a comment. Aaron, do you remember why you added a check for `width == 0` here? Would it ever not be 0? https://reviews.llvm.org/D43215 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D43048: [lldb-test/WIP] Allow a way to test autocompletion
First, I want to apologise for derailing the tab completion review. However, now that the cat's out of the bag, let me elaborate on what I meant. For example, this is how a typical instruction emulation test looks right now: TEST_F(Testx86AssemblyInspectionEngine, TestSimple64bitFrameFunction) { std::unique_ptr engine = Getx86_64Inspector(); // 'int main() { }' compiled for x86_64-apple-macosx with clang uint8_t data[] = { 0x55, // offset 0 -- pushq %rbp 0x48, 0x89, 0xe5, // offset 1 -- movq %rsp, %rbp 0x31, 0xc0, // offset 4 -- xorl %eax, %eax 0x5d, // offset 6 -- popq %rbp 0xc3 // offset 7 -- retq }; AddressRange sample_range(0x1000, sizeof(data)); UnwindPlan unwind_plan(eRegisterKindLLDB); EXPECT_TRUE(engine->GetNonCallSiteUnwindPlanFromAssembly( data, sizeof(data), sample_range, unwind_plan)); // Expect four unwind rows: // 0: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] // 1: CFA=rsp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] // 4: CFA=rbp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] // 7: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] EXPECT_TRUE(unwind_plan.GetInitialCFARegister() == k_rsp); EXPECT_TRUE(unwind_plan.GetUnwindPlanValidAtAllInstructions() == eLazyBoolYes); EXPECT_TRUE(unwind_plan.GetSourcedFromCompiler() == eLazyBoolNo); UnwindPlan::Row::RegisterLocation regloc; // 0: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] UnwindPlan::RowSP row_sp = unwind_plan.GetRowForFunctionOffset(0); EXPECT_EQ(0ull, row_sp->GetOffset()); EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rsp); EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true); EXPECT_EQ(8, row_sp->GetCFAValue().GetOffset()); EXPECT_TRUE(row_sp->GetRegisterInfo(k_rip, regloc)); EXPECT_TRUE(regloc.IsAtCFAPlusOffset()); EXPECT_EQ(-8, regloc.GetOffset()); // 1: CFA=rsp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] row_sp = unwind_plan.GetRowForFunctionOffset(1); EXPECT_EQ(1ull, row_sp->GetOffset()); EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rsp); EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true); EXPECT_EQ(16, row_sp->GetCFAValue().GetOffset()); EXPECT_TRUE(row_sp->GetRegisterInfo(k_rip, regloc)); EXPECT_TRUE(regloc.IsAtCFAPlusOffset()); EXPECT_EQ(-8, regloc.GetOffset()); // 4: CFA=rbp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] row_sp = unwind_plan.GetRowForFunctionOffset(4); EXPECT_EQ(4ull, row_sp->GetOffset()); EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rbp); EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true); EXPECT_EQ(16, row_sp->GetCFAValue().GetOffset()); EXPECT_TRUE(row_sp->GetRegisterInfo(k_rip, regloc)); EXPECT_TRUE(regloc.IsAtCFAPlusOffset()); EXPECT_EQ(-8, regloc.GetOffset()); // 7: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] row_sp = unwind_plan.GetRowForFunctionOffset(7); EXPECT_EQ(7ull, row_sp->GetOffset()); EXPECT_TRUE(row_sp->GetCFAValue().GetRegisterNumber() == k_rsp); EXPECT_TRUE(row_sp->GetCFAValue().IsRegisterPlusOffset() == true); EXPECT_EQ(8, row_sp->GetCFAValue().GetOffset()); EXPECT_TRUE(row_sp->GetRegisterInfo(k_rip, regloc)); EXPECT_TRUE(regloc.IsAtCFAPlusOffset()); EXPECT_EQ(-8, regloc.GetOffset()); } As you see, in order to write a test like this, somebody had to assemble a function demonstrating the issue, copy it's bytes into the test, and then write series of C++ checks to make sure that the result is correct. With FileCheck, we could basically remove everything **except** the comments from this test. So this would become something like: # RUN: llvm-mc -target x86_64-apple-macosx %s | lldb-test unwind --emulate - | FileCheck %s .text: pushq %rbp # CHECK: 0: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] movq %rsp, %rbp # CHECK: 1: CFA=rsp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] xorl %eax, %eax # CHECK: 4: CFA=rbp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] popq %rbp # CHECK: 7: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] retq I was hoping we could all agree on that the latter test looks much simpler. And it still is (can be made to) testing the exact same functionality as the original test. I think part of the reason that this part of code lacks better coverage (even though it's very suitable for unit testing) is that its very tedious to write tests like this. If adding a new test were as simple as this, we could easily add dozens of tests for each architecture. PS: I was deliberately trying to stay clear of the discussion on how to test the higher level unwinding logic, as I know that's a more complicated/contentious issue. However, Davide seemed like he was looking for things to FileCheck-ify, so I wanted to point this out to him, as I believe this would make testing of this particular component much easier, with very little upfront investment. On 12 February 2018 at 22:29,