[Lldb-commits] [PATCH] D139250: [lldb] Add ScriptedPlatform python implementation
mib added inline comments. Comment at: lldb/examples/python/scripted_process/scripted_platform.py:31 +def list_processes(self): +""" Get a list of processes that can be ran on the platform. + labath wrote: > mib wrote: > > labath wrote: > > > mib wrote: > > > > labath wrote: > > > > > mib wrote: > > > > > > mib wrote: > > > > > > > mib wrote: > > > > > > > > labath wrote: > > > > > > > > > I am surprised that you want to go down the "run" path for > > > > > > > > > this functionality. I think most of the launch functionality > > > > > > > > > does not make sense for this use case (e.g., you can't > > > > > > > > > provide arguments to these processes, when you "run" them, > > > > > > > > > can you?), and it is not consistent with what the "process > > > > > > > > > listing" functionality does for regular platforms. > > > > > > > > > > > > > > > > > > OTOH, the "attach" flow makes perfect sense here -- you take > > > > > > > > > the pid of an existing process, attach to it, and stop it at > > > > > > > > > a random point in its execution. You can't customize anything > > > > > > > > > about how that process is run (because it's already running) > > > > > > > > > -- all you can do is choose how you want to select the target > > > > > > > > > process. > > > > > > > > For now, there is no support for attaching to a scripted > > > > > > > > process, because we didn't have any use for it quite yet: > > > > > > > > cripted processes were mostly used for doing post-mortem > > > > > > > > debugging, so we "ran" them artificially in lldb by providing > > > > > > > > some launch options (the name of the class managing the process > > > > > > > > and an optional user-provided dictionary) through the command > > > > > > > > line or using an `SBLaunchInfo` object. > > > > > > > > > > > > > > > > I guess I'll need to extend the `platform process > > > > > > > > launch/attach` commands and `SBAttachInfo` object to also > > > > > > > > support these options since they're required for the scripted > > > > > > > > process instantiation. > > > > > > > > > > > > > > > > Note that we aren't really attaching to the real running > > > > > > > > process, we're creating a scripted process that knows how to > > > > > > > > read memory to mock the real process. > > > > > > > @labath, I'll do that work on a follow-up patch > > > > > > @labath here D139945 :) > > > > > Thanks. However, are you still planning to use the launch path for > > > > > your feature? Because if you're not, then I think this comment should > > > > > say "Get a list of processes that **are running**" (or that **can be > > > > > attached to**). > > > > > > > > > > And if you are, then I'd like to hear your thoughts on the > > > > > discrepancy between what "launching" means for scripted and > > > > > non-scripted platforms. > > > > > > > > > The way I see it is that the scripted platform will create a process > > > > with the right process plugin. In the case of scripted processes, the > > > > `ProcessLaunchInfo` argument should have the script class name set > > > > (which automatically sets the process plugin name to "ScriptedProcess" > > > > in the launch info). Once the process is instantiated (before the > > > > launch), the scripted platform will need to redirect to process stop > > > > events through its event multiplexer. So the way I see it essentially, > > > > running a regular process with the scripted platform should be totally > > > > transparent. > > > > > > > > Something that is also worth discussing IMO, is the discrepancy between > > > > launching and attaching from the scripted platform: > > > > > > > > One possibility could be that `platform process launch` would launch > > > > all the scripted processes listed by the scripted platform and set them > > > > up with the multiplexer, whereas `platform process attach` would just > > > > create a scripted process individually. I know this doesn't match the > > > > current behavior of the platform commands so if you guys think we > > > > should preserve the expected behavior, I guess. > > > > > > > > May be @jingham has some opinion about this ? > > > Before we do that, maybe we could take a step back. Could you explain why > > > you chose to use the "launch" flow for this use case? > > > > > > To me, it just seems confusing to be using "launching" for any of this, > > > particularly given that "attaching" looks like a much better match for > > > what is happening here: > > > - launch allows you to specify process cmdline arguments, attach does not > > > - I don't think you will be able to specify cmdline arguments for these > > > scripted processes > > > - launch allows you to specify env vars, attach does not -- ditto > > > - launch allows you to stop-at-entry, attach does not -- you cannot stop > > > at entry for these processes, as they have been started already > > > - attach allows you to spec
[Lldb-commits] [PATCH] D139379: [llvm][dwwarf] Change CU/TU index to 64-bit
ayermolo added a comment. Awesome, thank you for reviewing, I appreciate it! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139379/new/ https://reviews.llvm.org/D139379 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D139379: [llvm][dwwarf] Change CU/TU index to 64-bit
This revision was automatically updated to reflect the committed changes. Closed by commit rGfa3fa4d0d423: [llvm][dwwarf] Change CU/TU index to 64-bit (authored by ayermolo). Changed prior to commit: https://reviews.llvm.org/D139379?vs=485160&id=487881#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139379/new/ https://reviews.llvm.org/D139379 Files: bolt/lib/Core/DebugData.cpp bolt/lib/Rewrite/DWARFRewriter.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h llvm/lib/DWP/DWP.cpp llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s llvm/test/DebugInfo/X86/dwp-v2-cu-index.s llvm/test/DebugInfo/X86/dwp-v2-tu-index.s llvm/test/DebugInfo/X86/dwp-v5-cu-index.s llvm/test/DebugInfo/X86/dwp-v5-tu-index.s llvm/test/DebugInfo/dwarfdump-dwp.test llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s llvm/test/tools/llvm-dwp/X86/info-v5.s llvm/test/tools/llvm-dwp/X86/loclists.s llvm/test/tools/llvm-dwp/X86/merge.test llvm/test/tools/llvm-dwp/X86/rnglists.s llvm/test/tools/llvm-dwp/X86/simple.test llvm/test/tools/llvm-dwp/X86/tu_units_v5.s llvm/test/tools/llvm-dwp/X86/unknown-section-id.s Index: llvm/test/tools/llvm-dwp/X86/unknown-section-id.s === --- llvm/test/tools/llvm-dwp/X86/unknown-section-id.s +++ llvm/test/tools/llvm-dwp/X86/unknown-section-id.s @@ -17,7 +17,7 @@ # CHECK: Index Signature INFO ABBREV # CHECK-NOT: Unknown # CHECK: - -# CHECK-NEXT: 1 0x1122 [0x, 0x0014) [0x, 0x0009) +# CHECK-NEXT: 1 0x1122 [0x, 0x0014) [0x, 0x0009) # CHECK-NOT: [ # CHECK: .debug_tu_index contents: @@ -25,7 +25,7 @@ # CHECK: Index Signature TYPES ABBREV # CHECK-NOT: Unknown # CHECK: - -# CHECK-NEXT: 2 0x1133 [0x, 0x0019) [0x0009, 0x0014) +# CHECK-NEXT: 2 0x1133 [0x, 0x0019) [0x0009, 0x0014) # CHECK-NOT: [ .section .debug_abbrev.dwo, "e", @progbits Index: llvm/test/tools/llvm-dwp/X86/tu_units_v5.s === --- llvm/test/tools/llvm-dwp/X86/tu_units_v5.s +++ llvm/test/tools/llvm-dwp/X86/tu_units_v5.s @@ -13,9 +13,9 @@ # CHECK: 0x001b: Type Unit: length = 0x0017, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x, addr_size = 0x08, name = '', type_signature = [[TUID2:.*]], type_offset = 0x0019 (next unit at 0x0036) # CHECK-DAG: .debug_tu_index contents: # CHECK: version = 5, units = 2, slots = 4 -# CHECK: Index Signature INFO ABBREV -# CHECK: 1 [[TUID1]] [0x, 0x001b) [0x, 0x0010) -# CHECK: 4 [[TUID2]] [0x001b, 0x0036) [0x, 0x0010) +# CHECK: Index Signature INFO ABBREV +# CHECK: 1 [[TUID1]] [0x, 0x001b) [0x, 0x0010) +# CHECK: 4 [[TUID2]] [0x001b, 0x0036) [0x, 0x0010) .section .debug_info.dwo,"e",@progbits .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit Index: llvm/test/tools/llvm-dwp/X86/simple.test === --- llvm/test/tools/llvm-dwp/X86/simple.test +++ llvm/test/tools/llvm-dwp/X86/simple.test @@ -28,9 +28,9 @@ CHECK: DW_TAG_formal_parameter CHECK: .debug_info.dwo contents: -CHECK: [[AOFF:0x[0-9a-f]*]]: +CHECK: 0x[[#%.8x,AOFF:]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at [[BOFF:.*]]) +CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,BOFF:]]) CHECK: DW_TAG_compile_unit CHECK: DW_AT_name {{.*}} "a.cpp" CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOA:.*]]) @@ -40,9 +40,9 @@ NOTYP: DW_AT_name {{.*}} "foo" TYPES: DW_AT_signature {{.*}} ([[FOOSIG:.*]]) -CHECK: [[BOFF]]: +CHECK: 0x[[#BOFF]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at [[XOFF:.*]]) +CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,XOFF:]]) CHECK: DW_AT_name {{.*}} "b.cpp" CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOB:.*]]) CHECK: DW_TAG_structure_type @@ -54,32 +54,32 @@ NOTYP-NOT: .debug_types.dwo contents: TYPES-LABEL: .debug_types.dwo contents: -TYPES: [[FOOUOFF:0x[0-9a-f]*]]: +TYPES: 0x[[#%.8x,FOOUOFF:]]: TYPES-LABEL: Type Unit: l
[Lldb-commits] [PATCH] D141021: [lldb] Remove tools copied into LLDB.framework before install
bulbazord added inline comments. Comment at: lldb/source/API/CMakeLists.txt:215-216 + + add_dependencies(install-liblldb +lldb-framework-cleanup) endif() I think you need to add it as a dependency of `install-liblldb-stripped` as well? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141021/new/ https://reviews.llvm.org/D141021 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D141021: [lldb] Remove tools copied into LLDB.framework before install
JDevlieghere updated this revision to Diff 487901. JDevlieghere added a comment. Add dependency to `install-liblldb-stripped`. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141021/new/ https://reviews.llvm.org/D141021 Files: lldb/cmake/modules/AddLLDB.cmake lldb/cmake/modules/LLDBConfig.cmake lldb/source/API/CMakeLists.txt Index: lldb/source/API/CMakeLists.txt === --- lldb/source/API/CMakeLists.txt +++ lldb/source/API/CMakeLists.txt @@ -211,4 +211,9 @@ if(LLDB_BUILD_FRAMEWORK) include(LLDBFramework) + + add_dependencies(install-liblldb +lldb-framework-cleanup) + add_dependencies(install-liblldb-stripped +lldb-framework-cleanup) endif() Index: lldb/cmake/modules/LLDBConfig.cmake === --- lldb/cmake/modules/LLDBConfig.cmake +++ lldb/cmake/modules/LLDBConfig.cmake @@ -101,6 +101,20 @@ # Essentially, emit the framework's dSYM outside of the framework directory. set(LLDB_DEBUGINFO_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)") + + # Custom target to remove the targets (binaries, directories) that were + # copied into LLDB.framework in the build tree. + # + # These targets need to be removed before the install phase because otherwise + # because otherwise they may overwrite already installed binaries with the + # wrong RPATH (i.e. build RPATH instead of install RPATH). + # + # This target needs to be created here (rather than in API/CMakeLists.txt) + # because add_lldb_tool creates the custom rules to copy the binaries before + # the framework target exists and that's the only place where this is + # tracked. + add_custom_target(lldb-framework-cleanup +COMMENT "Cleaning up build-tree frameworks in preparation for install") endif() if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode) Index: lldb/cmake/modules/AddLLDB.cmake === --- lldb/cmake/modules/AddLLDB.cmake +++ lldb/cmake/modules/AddLLDB.cmake @@ -243,6 +243,16 @@ COMMAND ${CMAKE_COMMAND} -E copy $ ${copy_dest} COMMENT "Copy ${name} to ${copy_dest}" ) + + # Create a custom target to remove the copy again from LLDB.framework in the + # build tree. + # Intentionally use remove_directory because the target can be a either a + # file or directory and using remove_directory is harmless for files. + add_custom_target(${name}-cleanup +COMMAND ${CMAKE_COMMAND} -E remove_directory ${copy_dest} +COMMENT "Removing ${name} from LLDB.framework") + add_dependencies(lldb-framework-cleanup +${name}-cleanup) endfunction() # Add extra install steps for dSYM creation and stripping for the given target. Index: lldb/source/API/CMakeLists.txt === --- lldb/source/API/CMakeLists.txt +++ lldb/source/API/CMakeLists.txt @@ -211,4 +211,9 @@ if(LLDB_BUILD_FRAMEWORK) include(LLDBFramework) + + add_dependencies(install-liblldb +lldb-framework-cleanup) + add_dependencies(install-liblldb-stripped +lldb-framework-cleanup) endif() Index: lldb/cmake/modules/LLDBConfig.cmake === --- lldb/cmake/modules/LLDBConfig.cmake +++ lldb/cmake/modules/LLDBConfig.cmake @@ -101,6 +101,20 @@ # Essentially, emit the framework's dSYM outside of the framework directory. set(LLDB_DEBUGINFO_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)") + + # Custom target to remove the targets (binaries, directories) that were + # copied into LLDB.framework in the build tree. + # + # These targets need to be removed before the install phase because otherwise + # because otherwise they may overwrite already installed binaries with the + # wrong RPATH (i.e. build RPATH instead of install RPATH). + # + # This target needs to be created here (rather than in API/CMakeLists.txt) + # because add_lldb_tool creates the custom rules to copy the binaries before + # the framework target exists and that's the only place where this is + # tracked. + add_custom_target(lldb-framework-cleanup +COMMENT "Cleaning up build-tree frameworks in preparation for install") endif() if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode) Index: lldb/cmake/modules/AddLLDB.cmake === --- lldb/cmake/modules/AddLLDB.cmake +++ lldb/cmake/modules/AddLLDB.cmake @@ -243,6 +243,16 @@ COMMAND ${CMAKE_COMMAND} -E copy $ ${copy_dest} COMMENT "Copy ${name} to ${copy_dest}" ) + + # Create a custom target to remove the copy again from LLDB.framework in the + # build tree. + # Intentionally use remove_directory because the t
[Lldb-commits] [lldb] f6ce39c - [lldb] Remove tools copied into LLDB.framework before install
Author: Jonas Devlieghere Date: 2023-01-10T11:22:47-08:00 New Revision: f6ce39cf1d1d80699e13cd1422f60d428e5cf0ec URL: https://github.com/llvm/llvm-project/commit/f6ce39cf1d1d80699e13cd1422f60d428e5cf0ec DIFF: https://github.com/llvm/llvm-project/commit/f6ce39cf1d1d80699e13cd1422f60d428e5cf0ec.diff LOG: [lldb] Remove tools copied into LLDB.framework before install CMake supports building Framework bundles for Apple platforms. We rely on this functionality to create LLDB.framework. From CMake's perspective, a framework is associated with a single target. In reality, this is often not the case. In addition to a main library (liblldb) the frameworks often contains associated resources that are their own CMake targets, such as debugserver and lldb-argdumper. When building and using the framework to run the test suite, those binaries are expected to be in LLDB.framework. We have a function (lldb_add_to_buildtree_lldb_framework) that copies those targets into the framework. When CMake installs a framework, it copies over the content of the framework directory and "installs" the associated target. In addition to copying the target, installing also means updating the RPATH. However, the RPATH is only updated for the target associated with the framework. Everything else is naively copied over, including executables or libraries that have a different build and install RPATH. This means that those tools need to have their own install rules. If the framework is installed first, the aforementioned tools are copied over with build RPATHs from the build tree. And when the tools themselves are installed, the binaries get overwritten and the RPATHs updated to the install RPATHs. The problem is that CMake provides no guarantees when it comes to the order in which components get installed. If those tools get installed first, the inverse happens and the binaries get overwritten with the ones that have build RPATHs. lldb_add_to_buildtree_lldb_framework has a comment correctly stating that those copied binaries should be removed before install. This patch adds a custom target (lldb-framework-cleanup) that will be run before the install phase and remove those files from LLDB.framework in the build tree. Differential revision: https://reviews.llvm.org/D141021 Added: Modified: lldb/cmake/modules/AddLLDB.cmake lldb/cmake/modules/LLDBConfig.cmake lldb/source/API/CMakeLists.txt Removed: diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake index ea52b47d6d727..a5be4afb40fb0 100644 --- a/lldb/cmake/modules/AddLLDB.cmake +++ b/lldb/cmake/modules/AddLLDB.cmake @@ -243,6 +243,16 @@ function(lldb_add_to_buildtree_lldb_framework name subdir) COMMAND ${CMAKE_COMMAND} -E copy $ ${copy_dest} COMMENT "Copy ${name} to ${copy_dest}" ) + + # Create a custom target to remove the copy again from LLDB.framework in the + # build tree. + # Intentionally use remove_directory because the target can be a either a + # file or directory and using remove_directory is harmless for files. + add_custom_target(${name}-cleanup +COMMAND ${CMAKE_COMMAND} -E remove_directory ${copy_dest} +COMMENT "Removing ${name} from LLDB.framework") + add_dependencies(lldb-framework-cleanup +${name}-cleanup) endfunction() # Add extra install steps for dSYM creation and stripping for the given target. diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index f3f1103d244f6..ebb1eec8464a6 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -101,6 +101,20 @@ if(LLDB_BUILD_FRAMEWORK) # Essentially, emit the framework's dSYM outside of the framework directory. set(LLDB_DEBUGINFO_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)") + + # Custom target to remove the targets (binaries, directories) that were + # copied into LLDB.framework in the build tree. + # + # These targets need to be removed before the install phase because otherwise + # because otherwise they may overwrite already installed binaries with the + # wrong RPATH (i.e. build RPATH instead of install RPATH). + # + # This target needs to be created here (rather than in API/CMakeLists.txt) + # because add_lldb_tool creates the custom rules to copy the binaries before + # the framework target exists and that's the only place where this is + # tracked. + add_custom_target(lldb-framework-cleanup +COMMENT "Cleaning up build-tree frameworks in preparation for install") endif() if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index dd73ba56afef7..f3c8814fcc82d 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -211,4 +211,9
[Lldb-commits] [PATCH] D141021: [lldb] Remove tools copied into LLDB.framework before install
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf6ce39cf1d1d: [lldb] Remove tools copied into LLDB.framework before install (authored by JDevlieghere). Herald added a project: LLDB. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141021/new/ https://reviews.llvm.org/D141021 Files: lldb/cmake/modules/AddLLDB.cmake lldb/cmake/modules/LLDBConfig.cmake lldb/source/API/CMakeLists.txt Index: lldb/source/API/CMakeLists.txt === --- lldb/source/API/CMakeLists.txt +++ lldb/source/API/CMakeLists.txt @@ -211,4 +211,9 @@ if(LLDB_BUILD_FRAMEWORK) include(LLDBFramework) + + add_dependencies(install-liblldb +lldb-framework-cleanup) + add_dependencies(install-liblldb-stripped +lldb-framework-cleanup) endif() Index: lldb/cmake/modules/LLDBConfig.cmake === --- lldb/cmake/modules/LLDBConfig.cmake +++ lldb/cmake/modules/LLDBConfig.cmake @@ -101,6 +101,20 @@ # Essentially, emit the framework's dSYM outside of the framework directory. set(LLDB_DEBUGINFO_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)") + + # Custom target to remove the targets (binaries, directories) that were + # copied into LLDB.framework in the build tree. + # + # These targets need to be removed before the install phase because otherwise + # because otherwise they may overwrite already installed binaries with the + # wrong RPATH (i.e. build RPATH instead of install RPATH). + # + # This target needs to be created here (rather than in API/CMakeLists.txt) + # because add_lldb_tool creates the custom rules to copy the binaries before + # the framework target exists and that's the only place where this is + # tracked. + add_custom_target(lldb-framework-cleanup +COMMENT "Cleaning up build-tree frameworks in preparation for install") endif() if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode) Index: lldb/cmake/modules/AddLLDB.cmake === --- lldb/cmake/modules/AddLLDB.cmake +++ lldb/cmake/modules/AddLLDB.cmake @@ -243,6 +243,16 @@ COMMAND ${CMAKE_COMMAND} -E copy $ ${copy_dest} COMMENT "Copy ${name} to ${copy_dest}" ) + + # Create a custom target to remove the copy again from LLDB.framework in the + # build tree. + # Intentionally use remove_directory because the target can be a either a + # file or directory and using remove_directory is harmless for files. + add_custom_target(${name}-cleanup +COMMAND ${CMAKE_COMMAND} -E remove_directory ${copy_dest} +COMMENT "Removing ${name} from LLDB.framework") + add_dependencies(lldb-framework-cleanup +${name}-cleanup) endfunction() # Add extra install steps for dSYM creation and stripping for the given target. Index: lldb/source/API/CMakeLists.txt === --- lldb/source/API/CMakeLists.txt +++ lldb/source/API/CMakeLists.txt @@ -211,4 +211,9 @@ if(LLDB_BUILD_FRAMEWORK) include(LLDBFramework) + + add_dependencies(install-liblldb +lldb-framework-cleanup) + add_dependencies(install-liblldb-stripped +lldb-framework-cleanup) endif() Index: lldb/cmake/modules/LLDBConfig.cmake === --- lldb/cmake/modules/LLDBConfig.cmake +++ lldb/cmake/modules/LLDBConfig.cmake @@ -101,6 +101,20 @@ # Essentially, emit the framework's dSYM outside of the framework directory. set(LLDB_DEBUGINFO_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)") + + # Custom target to remove the targets (binaries, directories) that were + # copied into LLDB.framework in the build tree. + # + # These targets need to be removed before the install phase because otherwise + # because otherwise they may overwrite already installed binaries with the + # wrong RPATH (i.e. build RPATH instead of install RPATH). + # + # This target needs to be created here (rather than in API/CMakeLists.txt) + # because add_lldb_tool creates the custom rules to copy the binaries before + # the framework target exists and that's the only place where this is + # tracked. + add_custom_target(lldb-framework-cleanup +COMMENT "Cleaning up build-tree frameworks in preparation for install") endif() if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode) Index: lldb/cmake/modules/AddLLDB.cmake === --- lldb/cmake/modules/AddLLDB.cmake +++ lldb/cmake/modules/AddLLDB.cmake @@ -243,6 +243,16 @@ COMMAND ${CMAKE_COMMAND} -E copy $ ${copy_dest} CO
[Lldb-commits] [PATCH] D141425: [lldb] Add --gdb-format flag to dwim-print
kastiglione created this revision. kastiglione added reviewers: jingham, labath, aprantl. Herald added a project: All. kastiglione requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Add support for the `--gdb-format`/`-G` flag to `dwim-print`. The gdb-format flag allows users to alias `p` to `dwim-print`. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D141425 Files: lldb/include/lldb/Interpreter/OptionGroupFormat.h lldb/source/Commands/CommandObjectDWIMPrint.cpp lldb/source/Commands/CommandObjectDWIMPrint.h lldb/source/Interpreter/OptionGroupFormat.cpp lldb/test/API/commands/dwim-print/TestDWIMPrint.py Index: lldb/test/API/commands/dwim-print/TestDWIMPrint.py === --- lldb/test/API/commands/dwim-print/TestDWIMPrint.py +++ lldb/test/API/commands/dwim-print/TestDWIMPrint.py @@ -27,9 +27,25 @@ before, after = self.PERSISTENT_VAR.split(string, maxsplit=1) return re.escape(before) + r"\$\d+" + re.escape(after) -def _expect_cmd(self, expr: str, base_cmd: str) -> None: +def _expect_cmd( +self, +dwim_cmd: str, +base_cmd: str, +) -> None: """Run dwim-print and verify the output against the expected command.""" -cmd = f"{base_cmd} {expr}" +match = re.match("dwim-print(?:/(.))? (.+)", dwim_cmd) +format = match.group(1) +expr = match.group(2) + +cmd_args = [] +if format: +cmd_args.append(f"-G {format}") +if base_cmd == "expression": +cmd_args.append("--") +cmd_args.append(expr) + +cmd_argstr = " ".join(cmd_args) +cmd = f"{base_cmd} {cmd_argstr}" cmd_output = self._run_cmd(cmd) # Verify dwim-print chose the expected command. @@ -37,12 +53,12 @@ substrs = [f"note: ran `{cmd}`"] patterns = [] -if base_cmd == "expression --" and self.PERSISTENT_VAR.search(cmd_output): +if base_cmd == "expression" and self.PERSISTENT_VAR.search(cmd_output): patterns.append(self._mask_persistent_var(cmd_output)) else: substrs.append(cmd_output) -self.expect(f"dwim-print {expr}", substrs=substrs, patterns=patterns) +self.expect(dwim_cmd, substrs=substrs, patterns=patterns) def test_variables(self): """Test dwim-print with variables.""" @@ -50,7 +66,7 @@ lldbutil.run_to_name_breakpoint(self, "main") vars = ("argc", "argv") for var in vars: -self._expect_cmd(var, "frame variable") +self._expect_cmd(f"dwim-print {var}", "frame variable") def test_variable_paths(self): """Test dwim-print with variable path expressions.""" @@ -58,7 +74,7 @@ lldbutil.run_to_name_breakpoint(self, "main") exprs = ("&argc", "*argv", "argv[0]") for expr in exprs: -self._expect_cmd(expr, "expression --") +self._expect_cmd(f"dwim-print {expr}", "expression") def test_expressions(self): """Test dwim-print with expressions.""" @@ -66,8 +82,14 @@ lldbutil.run_to_name_breakpoint(self, "main") exprs = ("argc + 1", "(void)argc", "(int)abs(argc)") for expr in exprs: -self._expect_cmd(expr, "expression --") +self._expect_cmd(f"dwim-print {expr}", "expression") def test_dummy_target_expressions(self): """Test dwim-print's ability to evaluate expressions without a target.""" -self._expect_cmd("1 + 2", "expression --") +self._expect_cmd("dwim-print 1 + 2", "expression") + +def test_gdb_format(self): +self.build() +lldbutil.run_to_name_breakpoint(self, "main") +self._expect_cmd(f"dwim-print/x argc", "frame variable") +self._expect_cmd(f"dwim-print/x argc + 1", "expression") Index: lldb/source/Interpreter/OptionGroupFormat.cpp === --- lldb/source/Interpreter/OptionGroupFormat.cpp +++ lldb/source/Interpreter/OptionGroupFormat.cpp @@ -12,6 +12,7 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Target.h" +#include "lldb/lldb-enumerations.h" using namespace lldb; using namespace lldb_private; @@ -274,6 +275,37 @@ return false; } +char OptionGroupFormat::GetGDBFormat() const { + switch (GetFormat()) { + case lldb::eFormatOctal: +return 'o'; + case lldb::eFormatHex: +return 'x'; + case lldb::eFormatDecimal: +return 'd'; + case lldb::eFormatUnsigned: +return 'u'; + case lldb::eFormatBinary: +return 't'; + case lldb::eFormatFloat: +return 'f'; + case lldb::eFormatAddressInfo: +return 'a'; + case lldb::eFormatInstruction: +return 'i'; + case lldb::eFormatChar: +return 'c'; + case lldb::eFormatCString: +return 's'; +
[Lldb-commits] [PATCH] D139249: [lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstance
mib updated this revision to Diff 487989. mib added a comment. Herald added a subscriber: Michael137. Update unittests CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139249/new/ https://reviews.llvm.org/D139249 Files: lldb/bindings/interface/SBPlatform.i lldb/include/lldb/API/SBDebugger.h lldb/include/lldb/API/SBPlatform.h lldb/include/lldb/API/SBStructuredData.h lldb/include/lldb/Interpreter/OptionGroupPlatform.h lldb/include/lldb/Target/Platform.h lldb/include/lldb/lldb-private-interfaces.h lldb/source/API/SBDebugger.cpp lldb/source/API/SBPlatform.cpp lldb/source/Commands/CommandObjectPlatform.cpp lldb/source/Commands/CommandObjectPlatform.h lldb/source/Core/Debugger.cpp lldb/source/Interpreter/OptionGroupPlatform.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp lldb/source/Plugins/Platform/Android/PlatformAndroid.h lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp lldb/source/Plugins/Platform/Linux/PlatformLinux.h lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleBridge.h lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp lldb/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.h lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/source/Plugins/Platform/Windows/PlatformWindows.h lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h lldb/source/Target/Platform.cpp lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp lldb/source/Target/TargetList.cpp lldb/unittests/Core/DiagnosticEventTest.cpp lldb/unittests/Expression/DWARFExpressionTest.cpp lldb/unittests/Interpreter/TestCommandPaths.cpp lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp lldb/unittests/Platform/PlatformSiginfoTest.cpp lldb/unittests/Platform/PlatformTest.cpp lldb/unittests/Process/ProcessEventDataTest.cpp lldb/unittests/Target/ExecutionContextTest.cpp lldb/unittests/Target/StackFrameRecognizerTest.cpp lldb/unittests/Thread/ThreadTest.cpp Index: lldb/unittests/Thread/ThreadTest.cpp === --- lldb/unittests/Thread/ThreadTest.cpp +++ lldb/unittests/Thread/ThreadTest.cpp @@ -91,8 +91,9 @@ TEST_F(ThreadTest, SetStopInfo) { ArchSpec arch("powerpc64-pc-linux"); - Platform::SetHostPlatform( - platform_linux::PlatformLinux::CreateInstance(true, &arch)); + Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance( + true, &arch, /*debugger=*/nullptr, + /*metadata=*/nullptr)); DebuggerSP debugger_sp = Debugger::CreateInstance(); ASSERT_TRUE(debugger_sp); @@ -126,8 +127,9 @@ TEST_F(ThreadTest, GetPrivateStopInfo) { ArchSpec arch("powerpc64-pc-linux"); - Platform::SetHostPlatform( - platform_linux::PlatformLinux::CreateInstance(true, &arch)); + Platform::SetHostPlatform(platform_linux::PlatformLinux::CreateInstance( + true, &arch, /*debugger=*/nullptr, + /*metadata=*/nullptr)); DebuggerSP debugger_sp = Debugger::CreateInstance(); ASSERT_TRUE(debugger_sp); Index: lldb/unittests/Target/StackFrameRecognizerTest.cpp === --- lldb/unittests/Target/StackFrameRecognizerTest.cpp +++ lldb/unittests/Target/StackFrameRecognizerTest.cpp @@ -32,8 +32,9 @@ // Pretend Linux is the host platform. platform_linux::PlatformLinux::Initialize(); ArchSpec arch("powerpc64-pc-linux"); -Platform::SetHostPlatform(
[Lldb-commits] [PATCH] D139250: [lldb] Add ScriptedPlatform python implementation
mib updated this revision to Diff 488004. mib edited the summary of this revision. mib added a comment. Address @JDevlieghere comment: - refactor SWIG scripted object create methods into a single one CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139250/new/ https://reviews.llvm.org/D139250 Files: lldb/bindings/python/CMakeLists.txt lldb/bindings/python/python-wrapper.swig lldb/examples/python/scripted_process/crashlog_scripted_process.py lldb/examples/python/scripted_process/scripted_platform.py lldb/examples/python/scripted_process/scripted_process.py lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp lldb/test/API/functionalities/scripted_platform/my_scripted_platform.py lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Index: lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp === --- lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -200,16 +200,9 @@ return python::PythonObject(); } -python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedProcess( +python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedObject( const char *python_class_name, const char *session_dictionary_name, -const lldb::TargetSP &target_sp, const StructuredDataImpl &args_impl, -std::string &error_string) { - return python::PythonObject(); -} - -python::PythonObject lldb_private::LLDBSwigPythonCreateScriptedThread( -const char *python_class_name, const char *session_dictionary_name, -const lldb::ProcessSP &process_sp, const StructuredDataImpl &args_impl, +lldb::ExecutionContextRefSP exe_ctx_sp, const StructuredDataImpl &args_impl, std::string &error_string) { return python::PythonObject(); } Index: lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py === --- lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py +++ lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py @@ -13,8 +13,8 @@ return module return None -def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData): -super().__init__(target, args) +def __init__(self, exe_ctx: lldb.SBExecutionContext, args : lldb.SBStructuredData): +super().__init__(exe_ctx, args) self.corefile_target = None self.corefile_process = None Index: lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py === --- lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py +++ lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py @@ -7,8 +7,8 @@ from lldb.plugins.scripted_process import ScriptedThread class InvalidScriptedProcess(ScriptedProcess): -def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData): -super().__init__(target, args) +def __init__(self, exe_ctx: lldb.SBExecutionContext, args : lldb.SBStructuredData): +super().__init__(exe_ctx, args) self.threads[0] = InvalidScriptedThread(self, None) def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo: Index: lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py === --- lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py +++ lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py @@ -7,8 +7,8 @@ from lldb.plugins.scripted_process import ScriptedThread class DummyScriptedProcess(ScriptedProcess): -def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData): -super().__init__(target, args) +def __init__(self, exe_ctx: lldb.SBExecutionContext, args : lldb.SBStructuredData): +super().__init__(exe_ctx, args) self.threads[0] = DummyScriptedThread(self, None) def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryRegionInfo: Index: lldb/test/API/functionalities/scripted_platform/my_scripted_platform.py === --- /dev/null +++ lldb/test/API/functionalities/scripted_platform/my_scripted_platform.py @@ -0,0 +1,38 @@ +import os + +import lldb +from lldb.plugins.scripted_platform import ScriptedPlatform + +class MyScriptedPlatform(ScriptedPlat
[Lldb-commits] [PATCH] D139251: [lldb/Interpreter] Introduce ScriptedPlatform{, Python}Interface
mib updated this revision to Diff 488006. mib marked an inline comment as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139251/new/ https://reviews.llvm.org/D139251 Files: lldb/include/lldb/Interpreter/ScriptInterpreter.h lldb/include/lldb/Interpreter/ScriptedPlatformInterface.h lldb/include/lldb/lldb-forward.h lldb/source/Interpreter/ScriptInterpreter.cpp lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPlatformPythonInterface.cpp lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPlatformPythonInterface.h Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPlatformPythonInterface.h === --- /dev/null +++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPlatformPythonInterface.h @@ -0,0 +1,42 @@ +//===-- ScriptedPlatformPythonInterface.h ---*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPLATFORMPYTHONINTERFACE_H +#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPLATFORMPYTHONINTERFACE_H + +#include "lldb/Host/Config.h" + +#if LLDB_ENABLE_PYTHON + +#include "ScriptedPythonInterface.h" +#include "lldb/Interpreter/ScriptedPlatformInterface.h" + +namespace lldb_private { +class ScriptedPlatformPythonInterface : public ScriptedPlatformInterface, +public ScriptedPythonInterface { +public: + ScriptedPlatformPythonInterface(ScriptInterpreterPythonImpl &interpreter); + + StructuredData::GenericSP + CreatePluginObject(const llvm::StringRef class_name, + ExecutionContext &exe_ctx, + StructuredData::DictionarySP args_sp, + StructuredData::Generic *script_obj = nullptr) override; + + StructuredData::DictionarySP ListProcesses() override; + + StructuredData::DictionarySP GetProcessInfo(lldb::pid_t) override; + + Status LaunchProcess() override; + + Status KillProcess(lldb::pid_t pid) override; +}; +} // namespace lldb_private + +#endif // LLDB_ENABLE_PYTHON +#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTEDPLATFORMPYTHONINTERFACE_H Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPlatformPythonInterface.cpp === --- /dev/null +++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPlatformPythonInterface.cpp @@ -0,0 +1,100 @@ +//===-- ScriptedPlatformPythonInterface.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "lldb/Host/Config.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" +#include "lldb/lldb-enumerations.h" + +#if LLDB_ENABLE_PYTHON + +// LLDB Python header must be included first +#include "lldb-python.h" + +#include "SWIGPythonBridge.h" +#include "ScriptInterpreterPythonImpl.h" +#include "ScriptedPlatformPythonInterface.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::python; +using Locker = ScriptInterpreterPythonImpl::Locker; + +ScriptedPlatformPythonInterface::ScriptedPlatformPythonInterface( +ScriptInterpreterPythonImpl &interpreter) +: ScriptedPlatformInterface(), ScriptedPythonInterface(interpreter) {} + +StructuredData::GenericSP ScriptedPlatformPythonInterface::CreatePluginObject( +llvm::StringRef class_name, ExecutionContext &exe_ctx, +StructuredData::DictionarySP args_sp, StructuredData::Generic *script_obj) { + if (class_name.empty()) +return {}; + + StructuredDataImpl args_impl(args_sp); + std::string error_string; + + Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN, + Locker::FreeLock); + + lldb::ExecutionContextRefSP exe_ctx_ref_sp = + std::make_shared(exe_ctx); + + PythonObject ret_val = LLDBSwigPythonCreateScriptedObject( + class_name.str().c_str(), m_interpreter.GetDictionaryName(), + exe_ctx_ref_sp, args_impl, error_string); + + m_object_instance_sp = + StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val))); + + return m_object_instance_sp; +} + +StructuredData::DictionarySP ScriptedPlatformPythonInterface::ListProcesses() { + Status error; + StructuredData::DictionarySP dict_sp = + Dispatch("list_processes", error); + + if (!dict_sp || !dict_sp->IsValid() || err
[Lldb-commits] [PATCH] D141219: Add a .lldbinit file to autoload LLVM/Clang data formatters
jingham added a comment. I've been holding off on actually promoting the lldbDataFormatters until there was some tests written for these formatters. llvm data structures are constantly changing and so formatters in these files often break. It shouldn't be hard to build a little test executable that links to llvm or clang and makes structures of these types and makes sure the formatted results are correct. But even so, the idea of leaving .lldbinit files lying around in really common places like the root of the llvm-project source directory gives me the willies... It's not so bad since by default we won't use this, but then the suggestion for using this is to turn on the target.load-cwd-lldbinit setting, and given how we see people cargo-cult .lldbinit files, I think this is likely to cause confusion. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141219/new/ https://reviews.llvm.org/D141219 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D141219: Add a .lldbinit file to autoload LLVM/Clang data formatters
jingham added a comment. Also for anyone not using CLion, having the local .lldbinit file in the root directory is not all that helpful, you'd really want it to be copied into the bin directory of your build, since most people when debugging their new binaries cd to the bin directory and run it from there. I'd suggest having it in some suitable subdirectory, and then have the build system copy it to the useful location, which for CLion would be the project root and for anything else would be the bin directory. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141219/new/ https://reviews.llvm.org/D141219 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D139252: [lldb/Plugins] Introduce Scripted Platform Plugin
mib updated this revision to Diff 488014. mib added a comment. Log the error message instead of consuming it CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139252/new/ https://reviews.llvm.org/D139252 Files: lldb/source/Plugins/Platform/CMakeLists.txt lldb/source/Plugins/Platform/scripted/CMakeLists.txt lldb/source/Plugins/Platform/scripted/ScriptedPlatform.cpp lldb/source/Plugins/Platform/scripted/ScriptedPlatform.h lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp lldb/source/Plugins/Process/scripted/ScriptedProcess.h lldb/source/Plugins/Process/scripted/ScriptedThread.cpp lldb/source/Plugins/Process/scripted/ScriptedThread.h Index: lldb/source/Plugins/Process/scripted/ScriptedThread.h === --- lldb/source/Plugins/Process/scripted/ScriptedThread.h +++ lldb/source/Plugins/Process/scripted/ScriptedThread.h @@ -61,7 +61,11 @@ StructuredData::ObjectSP FetchThreadExtendedInfo() override; private: - void CheckInterpreterAndScriptObject() const; + inline void CheckInterpreterAndScriptObject() const { +assert(m_script_object_sp && "Invalid Script Object."); +assert(GetInterface() && "Invalid Scripted Thread Interface."); + } + lldb::ScriptedThreadInterfaceSP GetInterface() const; ScriptedThread(const ScriptedThread &) = delete; Index: lldb/source/Plugins/Process/scripted/ScriptedThread.cpp === --- lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -23,11 +23,6 @@ using namespace lldb; using namespace lldb_private; -void ScriptedThread::CheckInterpreterAndScriptObject() const { - lldbassert(m_script_object_sp && "Invalid Script Object."); - lldbassert(GetInterface() && "Invalid Scripted Thread Interface."); -} - llvm::Expected> ScriptedThread::Create(ScriptedProcess &process, StructuredData::Generic *script_object) { Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.h === --- lldb/source/Plugins/Process/scripted/ScriptedProcess.h +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.h @@ -89,15 +89,18 @@ private: friend class ScriptedThread; - void CheckInterpreterAndScriptObject() const; + inline void CheckInterpreterAndScriptObject() const { +lldbassert(m_interpreter && "Invalid Script Interpreter."); +lldbassert(m_script_object_sp && "Invalid Script Object."); + } + ScriptedProcessInterface &GetInterface() const; + static bool IsScriptLanguageSupported(lldb::ScriptLanguage language); - // Member variables. const ScriptedMetadata m_scripted_metadata; lldb_private::ScriptInterpreter *m_interpreter = nullptr; lldb_private::StructuredData::ObjectSP m_script_object_sp = nullptr; - //@} }; } // namespace lldb_private Index: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp === --- lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -46,11 +46,6 @@ return llvm::is_contained(supported_languages, language); } -void ScriptedProcess::CheckInterpreterAndScriptObject() const { - lldbassert(m_interpreter && "Invalid Script Interpreter."); - lldbassert(m_script_object_sp && "Invalid Script Object."); -} - lldb::ProcessSP ScriptedProcess::CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *file, Index: lldb/source/Plugins/Platform/scripted/ScriptedPlatform.h === --- /dev/null +++ lldb/source/Plugins/Platform/scripted/ScriptedPlatform.h @@ -0,0 +1,86 @@ +//===-- ScriptedPlatform.h --*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#ifndef LLDB_SOURCE_PLUGINS_SCRIPTED_PLATFORM_H +#define LLDB_SOURCE_PLUGINS_SCRIPTED_PLATFORM_H + +#include "lldb/Interpreter/ScriptedMetadata.h" +#include "lldb/Target/Platform.h" + +namespace lldb_private { + +class ScriptedPlatform : public Platform { +public: + ScriptedPlatform(Debugger *debugger, + const ScriptedMetadata *scripted_metadata, Status &error); + + ~ScriptedPlatform() override; + + static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch, + const Debugger *debugger, + const ScriptedMetadata *metadata); + + static void Initialize(); + +
[Lldb-commits] [PATCH] D140102: [lldb] Explain memory history provider in mem hist command description
jingham added a comment. This is a fine idea. However, it doesn't seem immediately obvious that a "memory history provider plugin" is a property of the executable, not lldb. In other instances we say we don't have an architecture plugin for your architecture, etc. So that ends up sounding more like something you have to add to lldb. I'd make this more direct, like "This command requires that your executable run with some memory introspection support library. For example, compile the debug with address sanitizer." You could also be less cagy about the list of memory history introspection libraries since we seem to only support ASAN at present. We could just say "use asan" here so people don't waste time wondering what the others are. Then if we ever support another one we can revise this string. It should be natural at that point because once we support more than one introspection library, we'd probably have to give you a way to choose which among the ones that are available. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140102/new/ https://reviews.llvm.org/D140102 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D140358: [lldb-vscode] Add support for disassembly view
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. I haven't followed the lldb-vscode codebase closely enough to have useful comments on that part of the code. But so far as I can tell, you didn't add a test for SBTarget::GetMaximumOpcodeByteSize, so you should add that before this goes in. Maybe it was folded into the lldb-vscode tests and I missed it, but even so this should have a direct test, not I don't think we should require people to build lldb-vscode to test general features of lldb. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140358/new/ https://reviews.llvm.org/D140358 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D140249: [lldb] Do not deallocate memory after exec
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. It doesn't seem unreasonable that in the course of time we'll come across another circumstance where it's not worth deallocating these memory regions (for instance, we really don't need to do that if we're planning to kill the process). So it seems awkward to encode this particular reason in the Memory::Clear function. I think it would be better to have the parameter be "deallocate_memory", and then move the comment to Process::DidExec. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140249/new/ https://reviews.llvm.org/D140249 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 302f4ae - [lldb] Only add lldb-framework-cleanup dependency to existing targets
Author: Jonas Devlieghere Date: 2023-01-10T16:23:43-08:00 New Revision: 302f4aef7930c125236f071140eb9482532f2877 URL: https://github.com/llvm/llvm-project/commit/302f4aef7930c125236f071140eb9482532f2877 DIFF: https://github.com/llvm/llvm-project/commit/302f4aef7930c125236f071140eb9482532f2877.diff LOG: [lldb] Only add lldb-framework-cleanup dependency to existing targets The Xcode standalone build doesn't have the install-liblldb and install-liblldb-stripped targets. Fix the resulting CMake error "Cannot add target-level dependencies to non-existent target" by only adding the dependency when the targets exist. Added: Modified: lldb/source/API/CMakeLists.txt Removed: diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index f3c8814fcc82d..3e189f387f1ca 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -212,8 +212,13 @@ endif() if(LLDB_BUILD_FRAMEWORK) include(LLDBFramework) - add_dependencies(install-liblldb -lldb-framework-cleanup) - add_dependencies(install-liblldb-stripped -lldb-framework-cleanup) + if (TARGET install-liblldb) +add_dependencies(install-liblldb + lldb-framework-cleanup) + endif() + + if (TARGET install-liblldb-stripped) +add_dependencies(install-liblldb-stripped + lldb-framework-cleanup) + endif() endif() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D139484: [lldb/test] Fix data racing issue in TestStackCoreScriptedProcess
mib updated this revision to Diff 488029. mib added a comment. Address comments from @JDevlieghere & @bulbazord CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139484/new/ https://reviews.llvm.org/D139484 Files: lldb/test/API/functionalities/scripted_process/Makefile lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py lldb/test/API/functionalities/scripted_process/baz.c lldb/test/API/functionalities/scripted_process/baz.cpp lldb/test/API/functionalities/scripted_process/baz.h lldb/test/API/functionalities/scripted_process/main.cpp Index: lldb/test/API/functionalities/scripted_process/main.cpp === --- lldb/test/API/functionalities/scripted_process/main.cpp +++ lldb/test/API/functionalities/scripted_process/main.cpp @@ -1,10 +1,9 @@ -#include -#include #include -extern "C" { -int baz(int); -} +#include "baz.h" + +std::condition_variable cv; +std::mutex mutex; int bar(int i) { int j = i * i; @@ -13,23 +12,20 @@ int foo(int i) { return bar(i); } -void call_and_wait(int &n) { - std::cout << "waiting for computation!" << std::endl; - while (baz(n) != 42) -; - std::cout << "finished computation!" << std::endl; +void compute_pow(int &n) { + std::unique_lock lock(mutex); + n = foo(n); + lock.unlock(); + cv.notify_one(); // waiting thread is notified with n == 42 * 42, cv.wait + // returns } -void compute_pow(int &n) { n = foo(n); } +void call_and_wait(int &n) { baz(n, mutex, cv); } int main() { int n = 42; - std::mutex mutex; - std::unique_lock lock(mutex); - std::thread thread_1(call_and_wait, std::ref(n)); std::thread thread_2(compute_pow, std::ref(n)); - lock.unlock(); thread_1.join(); thread_2.join(); Index: lldb/test/API/functionalities/scripted_process/baz.h === --- lldb/test/API/functionalities/scripted_process/baz.h +++ lldb/test/API/functionalities/scripted_process/baz.h @@ -1,3 +1,6 @@ #pragma once -int baz(int j); +#include +#include + +int baz(int &j, std::mutex &mutex, std::condition_variable &cv); Index: lldb/test/API/functionalities/scripted_process/baz.cpp === --- /dev/null +++ lldb/test/API/functionalities/scripted_process/baz.cpp @@ -0,0 +1,10 @@ +#include "baz.h" + +#include + +int baz(int &j, std::mutex &mutex, std::condition_variable &cv) { + std::unique_lock lock(mutex); + cv.wait(lock, [&j] { return j == 42 * 42; }); + int k = sqrt(j); + return k; // break here +} Index: lldb/test/API/functionalities/scripted_process/baz.c === --- lldb/test/API/functionalities/scripted_process/baz.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "baz.h" - -#include - -int baz(int j) { - int k = sqrt(j); - return k; // break here -} Index: lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py === --- lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py +++ lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py @@ -17,7 +17,7 @@ def create_stack_skinny_corefile(self, file): self.build() target, process, thread, _ = lldbutil.run_to_source_breakpoint(self, "// break here", - lldb.SBFileSpec("baz.c")) + lldb.SBFileSpec("baz.cpp")) self.assertTrue(process.IsValid(), "Process is invalid.") # FIXME: Use SBAPI to save the process corefile. self.runCmd("process save-core -s stack " + file) @@ -109,9 +109,9 @@ self.assertTrue(func, "Invalid function.") self.assertIn("baz", frame.GetFunctionName()) -self.assertEqual(frame.vars.GetSize(), 2) -self.assertEqual(int(frame.vars.GetFirstValueByName('j').GetValue()), 42 * 42) +self.assertGreater(frame.vars.GetSize(), 0) self.assertEqual(int(frame.vars.GetFirstValueByName('k').GetValue()), 42) +self.assertEqual(int(frame.vars.GetFirstValueByName('j').Dereference().GetValue()), 42 * 42) corefile_dylib = self.get_module_with_name(corefile_target, 'libbaz.dylib') self.assertTrue(corefile_dylib, "Dynamic library libbaz.dylib not found.") Index: lldb/test/API/functionalities/scripted_process/Makefile === --- lldb/test/API/functionalities/scripted_process/Makefile +++ lldb/test/API/functionalities/scripted_process/Makefile @@ -6,8 +6,8 @@ all: libbaz.dylib a.out -libbaz.dylib: baz.c +libbaz.dylib: baz.cpp $(MAKE) -f $(MAKEFILE_RULES) ARCH=$(ARCH) \ - DYLIB_ONLY=YES DYLIB_NAME=baz DYLIB_C_SOURCES=baz.c + DYLIB_ONLY=YES DYLIB_NAME=baz
[Lldb-commits] [PATCH] D140249: [lldb] Do not deallocate memory after exec
bulbazord updated this revision to Diff 488035. bulbazord added a comment. Address @jingham's comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140249/new/ https://reviews.llvm.org/D140249 Files: lldb/include/lldb/Target/Memory.h lldb/source/Target/Memory.cpp lldb/source/Target/Process.cpp Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -543,7 +543,7 @@ m_notifications.swap(empty_notifications); m_image_tokens.clear(); m_memory_cache.Clear(); - m_allocated_memory_cache.Clear(); + m_allocated_memory_cache.Clear(/*deallocate_memory=*/true); { std::lock_guard guard(m_language_runtimes_mutex); m_language_runtimes.clear(); @@ -5657,7 +5657,9 @@ m_dyld_up.reset(); m_jit_loaders_up.reset(); m_image_tokens.clear(); - m_allocated_memory_cache.Clear(); + // After an exec, the inferior is a new process and these memory regions are + // no longer allocated. + m_allocated_memory_cache.Clear(/*deallocte_memory=*/false); { std::lock_guard guard(m_language_runtimes_mutex); m_language_runtimes.clear(); Index: lldb/source/Target/Memory.cpp === --- lldb/source/Target/Memory.cpp +++ lldb/source/Target/Memory.cpp @@ -332,9 +332,9 @@ AllocatedMemoryCache::~AllocatedMemoryCache() = default; -void AllocatedMemoryCache::Clear() { +void AllocatedMemoryCache::Clear(bool deallocate_memory) { std::lock_guard guard(m_mutex); - if (m_process.IsAlive()) { + if (m_process.IsAlive() && deallocate_memory) { PermissionsToBlockMap::iterator pos, end = m_memory_map.end(); for (pos = m_memory_map.begin(); pos != end; ++pos) m_process.DoDeallocateMemory(pos->second->GetBaseAddress()); Index: lldb/include/lldb/Target/Memory.h === --- lldb/include/lldb/Target/Memory.h +++ lldb/include/lldb/Target/Memory.h @@ -116,7 +116,7 @@ ~AllocatedMemoryCache(); - void Clear(); + void Clear(bool deallocate_memory); lldb::addr_t AllocateMemory(size_t byte_size, uint32_t permissions, Status &error); Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -543,7 +543,7 @@ m_notifications.swap(empty_notifications); m_image_tokens.clear(); m_memory_cache.Clear(); - m_allocated_memory_cache.Clear(); + m_allocated_memory_cache.Clear(/*deallocate_memory=*/true); { std::lock_guard guard(m_language_runtimes_mutex); m_language_runtimes.clear(); @@ -5657,7 +5657,9 @@ m_dyld_up.reset(); m_jit_loaders_up.reset(); m_image_tokens.clear(); - m_allocated_memory_cache.Clear(); + // After an exec, the inferior is a new process and these memory regions are + // no longer allocated. + m_allocated_memory_cache.Clear(/*deallocte_memory=*/false); { std::lock_guard guard(m_language_runtimes_mutex); m_language_runtimes.clear(); Index: lldb/source/Target/Memory.cpp === --- lldb/source/Target/Memory.cpp +++ lldb/source/Target/Memory.cpp @@ -332,9 +332,9 @@ AllocatedMemoryCache::~AllocatedMemoryCache() = default; -void AllocatedMemoryCache::Clear() { +void AllocatedMemoryCache::Clear(bool deallocate_memory) { std::lock_guard guard(m_mutex); - if (m_process.IsAlive()) { + if (m_process.IsAlive() && deallocate_memory) { PermissionsToBlockMap::iterator pos, end = m_memory_map.end(); for (pos = m_memory_map.begin(); pos != end; ++pos) m_process.DoDeallocateMemory(pos->second->GetBaseAddress()); Index: lldb/include/lldb/Target/Memory.h === --- lldb/include/lldb/Target/Memory.h +++ lldb/include/lldb/Target/Memory.h @@ -116,7 +116,7 @@ ~AllocatedMemoryCache(); - void Clear(); + void Clear(bool deallocate_memory); lldb::addr_t AllocateMemory(size_t byte_size, uint32_t permissions, Status &error); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D140293: [lldb] Update custom commands to always be overrriden
mib updated this revision to Diff 488036. mib added a comment. Fix typo in `crashlog.py` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140293/new/ https://reviews.llvm.org/D140293 Files: lldb/examples/darwin/heap_find/heap.py lldb/examples/python/bsd.py lldb/examples/python/cmdtemplate.py lldb/examples/python/delta.py lldb/examples/python/diagnose_nsstring.py lldb/examples/python/diagnose_unwind.py lldb/examples/python/disassembly_mode.py lldb/examples/python/gdb_disassemble.py lldb/examples/python/gdbremote.py lldb/examples/python/jump.py lldb/examples/python/lldb_module_utils.py lldb/examples/python/memory.py lldb/examples/python/sources.py lldb/examples/python/stacks.py lldb/examples/python/step_and_print.py lldb/examples/python/types.py Index: lldb/examples/python/types.py === --- lldb/examples/python/types.py +++ lldb/examples/python/types.py @@ -351,5 +351,5 @@ def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand( -'command script add -f types.check_padding_command check_padding') +'command script add -o -f types.check_padding_command check_padding') print('"check_padding" command installed, use the "--help" option for detailed help') Index: lldb/examples/python/step_and_print.py === --- lldb/examples/python/step_and_print.py +++ lldb/examples/python/step_and_print.py @@ -21,4 +21,4 @@ return "Does a step-over then runs frame variable passing the command args to it\n" def __lldb_init_module(debugger, unused): -debugger.HandleCommand("command script add -c step_and_print.StepAndPrint sap") +debugger.HandleCommand("command script add -o -c step_and_print.StepAndPrint sap") Index: lldb/examples/python/stacks.py === --- lldb/examples/python/stacks.py +++ lldb/examples/python/stacks.py @@ -64,5 +64,5 @@ def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand( -"command script add -f stacks.stack_frames stack_frames") +"command script add -o -f stacks.stack_frames stack_frames") print("A new command called 'stack_frames' was added, type 'stack_frames --help' for more information.") Index: lldb/examples/python/sources.py === --- lldb/examples/python/sources.py +++ lldb/examples/python/sources.py @@ -27,5 +27,5 @@ def __lldb_init_module(debugger, dict): # Add any commands contained in this module to LLDB debugger.HandleCommand( -'command script add -f sources.info_sources info_sources') +'command script add -o -f sources.info_sources info_sources') print('The "info_sources" command has been installed, type "help info_sources" or "info_sources --help" for detailed help.') Index: lldb/examples/python/memory.py === --- lldb/examples/python/memory.py +++ lldb/examples/python/memory.py @@ -272,5 +272,5 @@ def __lldb_init_module(debugger, internal_dict): memfind_command.__doc__ = create_memfind_options().format_help() debugger.HandleCommand( -'command script add -f memory.memfind_command memfind') +'command script add -o -f memory.memfind_command memfind') print('"memfind" command installed, use the "--help" option for detailed help') Index: lldb/examples/python/lldb_module_utils.py === --- lldb/examples/python/lldb_module_utils.py +++ lldb/examples/python/lldb_module_utils.py @@ -183,9 +183,9 @@ # Add any commands contained in this module to LLDB debugger.HandleCommand( -'command script add -c %s.DumpLineTables %s' % (__name__, +'command script add -o -c %s.DumpLineTables %s' % (__name__, DumpLineTables.command_name)) debugger.HandleCommand( -'command script add -c %s.DumpFiles %s' % (__name__, DumpFiles.command_name)) +'command script add -o -c %s.DumpFiles %s' % (__name__, DumpFiles.command_name)) print('The "%s" and "%s" commands have been installed.' % (DumpLineTables.command_name, DumpFiles.command_name)) Index: lldb/examples/python/jump.py === --- lldb/examples/python/jump.py +++ lldb/examples/python/jump.py @@ -192,5 +192,5 @@ def __lldb_init_module(debugger, internal_dict): # Module is being run inside the LLDB interpreter jump.__doc__ = usage_string() -debugger.HandleCommand('command script add -f jump.jump jump') +debugger.HandleCommand('command script add -o -f jump.jump jump') print('The "jump" command has been installed, type "help jump" or "jump
[Lldb-commits] [PATCH] D134642: Propagate FORK events back to client
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. First off, Is there a meaningful distinction between "fork" and "clone" in this context? we call the act whereby a process generates a child process a fork everywhere else in lldb (e.g. in follow-fork-mode) so unless "clone" really does mean something different from fork, it's confusing to have this setting use "clone". This patch seems to be two orthogonal pieces. One is adding the "detach and keep stopped" capability to the NativeProcess classes. That part seems fine to me, and fairly uncontroversial. This is useful behavior independently of whether the any forks went on or not. This part could really be a separate patch on its own. And the other piece is to stop or not on fork events. That also seems like a generally useful ability, but I'm a little unclear on how this interacts with follow-fork-mode. If I'm following into the child, and I stop on the event, will I stop in the child already? Or does it stop before, then when you "continue" you'll end up switching to the child? If I stop at the fork event, then set "follow-fork-mode" to follow into the child and continue, will I end up in the child? Seems like we should know how we think that's going to go, and test the various different combinations to ensure that behavior. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134642/new/ https://reviews.llvm.org/D134642 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D134642: Propagate FORK events back to client
jingham added a comment. Note, IMO the better solution to the problem of how to follow parent & child over a fork is to implement another "follow-fork" mode: "both" that when it sees the fork event, creates a separate target for the child process, and sets lldb debugging both. Then the user could set in a setting what they want to do, and lldb would just take care of it for them. But that's a bigger job than this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134642/new/ https://reviews.llvm.org/D134642 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D141425: [lldb] Add --gdb-format flag to dwim-print
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. I don't think this is quite right. First off, it's a little weird that your `dwim-print` command only supports the gdb-format option and not the format option? In the long run, I think you need to support both. Being able to say `v -fA variable` but not `dwim-print -fA` would be wrong. But given this is early days, that can be a separate patch. More importantly, your translation is lossy. The gdb format option supports count & size as well as format: e.g. `-G 32xb`. But the current code will turn that into `-G x` for the underlying command. So you either need to reconstitute the gdb-format string from the m_count and m_byte_size as well as m_format, or get the OptionGroupFormat to store the unparsed gdb format string and just hand that back to you. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141425/new/ https://reviews.llvm.org/D141425 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D141425: [lldb] Add --gdb-format flag to dwim-print
jingham added inline comments. Comment at: lldb/source/Commands/CommandObjectDWIMPrint.cpp:61 + // The numerous flags of `OptionGroupValueObjectDisplay` are not exposed by + // the `dwim-print` command. However its defaults are needed for dumping Is this your long term plan? Even in a dwim print command, I will want to control the depth of structure/pointer traversal, and whether I see the raw or synthetic child version of the result, etc. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D141425/new/ https://reviews.llvm.org/D141425 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits