[Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID
ramana-nvr added a reviewer: jingham. ramana-nvr added a comment. In https://reviews.llvm.org/D48865#1150995, @jingham wrote: > check should also use thread->GetID not m_options.m_thread_idx. This is all > error reporting, so it's not a big deal. But having the error be "failed to > resolve line table for frame 5 of thread 4294967295" would be confusing. > Could you change those uses as well? On the trunk, the error message will be "Failed to resolve the line table for frame 5 of thread index 3", which I think is okay. Changed couple of others. https://reviews.llvm.org/D48865 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID
ramana-nvr updated this revision to Diff 154059. https://reviews.llvm.org/D48865 Files: source/Commands/CommandObjectThread.cpp Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -1183,7 +1183,7 @@ thread->GetStackFrameAtIndex(m_options.m_frame_idx).get(); if (frame == nullptr) { result.AppendErrorWithFormat( -"Frame index %u is out of range for thread %u.\n", +"Frame index %u is out of range for thread index %u.\n", m_options.m_frame_idx, m_options.m_thread_idx); result.SetStatus(eReturnStatusFailed); return false; @@ -1279,13 +1279,13 @@ new_plan_sp->SetOkayToDiscard(false); } else { result.AppendErrorWithFormat( -"Frame index %u of thread %u has no debug information.\n", +"Frame index %u of thread index %u has no debug information.\n", m_options.m_frame_idx, m_options.m_thread_idx); result.SetStatus(eReturnStatusFailed); return false; } - process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx); + process->GetThreadList().SetSelectedThreadByID(thread->GetID()); StreamString stream; Status error; Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -1183,7 +1183,7 @@ thread->GetStackFrameAtIndex(m_options.m_frame_idx).get(); if (frame == nullptr) { result.AppendErrorWithFormat( -"Frame index %u is out of range for thread %u.\n", +"Frame index %u is out of range for thread index %u.\n", m_options.m_frame_idx, m_options.m_thread_idx); result.SetStatus(eReturnStatusFailed); return false; @@ -1279,13 +1279,13 @@ new_plan_sp->SetOkayToDiscard(false); } else { result.AppendErrorWithFormat( -"Frame index %u of thread %u has no debug information.\n", +"Frame index %u of thread index %u has no debug information.\n", m_options.m_frame_idx, m_options.m_thread_idx); result.SetStatus(eReturnStatusFailed); return false; } - process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx); + process->GetThreadList().SetSelectedThreadByID(thread->GetID()); StreamString stream; Status error; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336272 - [CMake] Move some variables around
Author: jdevlieghere Date: Wed Jul 4 06:59:25 2018 New Revision: 336272 URL: http://llvm.org/viewvc/llvm-project?rev=336272&view=rev Log: [CMake] Move some variables around This improves consistency by creating a CMake variable for the dsymutil path. The motivation is that for Swift, the dsymutil binary and the lldb binary live in different directories and we need an option to configure this from the build script. Modified: lldb/trunk/CMakeLists.txt lldb/trunk/test/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=336272&r1=336271&r2=336272&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Wed Jul 4 06:59:25 2018 @@ -88,6 +88,10 @@ option(LLDB_INCLUDE_TESTS "Generate buil option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) if(LLDB_INCLUDE_TESTS) + + set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}") + set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}") + if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang) set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}") else() @@ -100,8 +104,10 @@ if(LLDB_INCLUDE_TESTS) set(LLDB_DEFAULT_TEST_CXX_COMPILER "") endif() + set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing") set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors") set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors") + set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles") if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR ("${LLDB_TEST_CXX_COMPILER}" STREQUAL "")) @@ -130,7 +136,7 @@ if(LLDB_INCLUDE_TESTS) endif() if(NOT LLDB_BUILT_STANDALONE) -list(APPEND LLDB_TEST_DEPS yaml2obj dsymutil) +list(APPEND LLDB_TEST_DEPS yaml2obj) endif() if(TARGET liblldb) @@ -141,6 +147,10 @@ if(LLDB_INCLUDE_TESTS) list(APPEND LLDB_TEST_DEPS clang) endif() + if(TARGET dsymutil) +list(APPEND LLDB_TEST_DEPS dsymutil) + endif() + add_subdirectory(test) add_subdirectory(unittests) add_subdirectory(lit) Modified: lldb/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=336272&r1=336271&r2=336272&view=diff == --- lldb/trunk/test/CMakeLists.txt (original) +++ lldb/trunk/test/CMakeLists.txt Wed Jul 4 06:59:25 2018 @@ -47,8 +47,8 @@ set(LLDB_TEST_COMMON_ARGS ) list(APPEND LLDB_TEST_COMMON_ARGS - --executable ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX} - --dsymutil ${LLVM_RUNTIME_OUTPUT_INTDIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX} + --executable ${LLDB_TEST_EXECUTABLE} + --dsymutil ${LLDB_TEST_DSYMUTIL} -C ${LLDB_TEST_C_COMPILER} ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336278 - [CMake] Use LLVM_RUNTIME_OUTPUT_INTDIR for LLDB exectuable
Author: jdevlieghere Date: Wed Jul 4 07:34:32 2018 New Revision: 336278 URL: http://llvm.org/viewvc/llvm-project?rev=336278&view=rev Log: [CMake] Use LLVM_RUNTIME_OUTPUT_INTDIR for LLDB exectuable Apparently there's a difference between using LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_BINARY_DIR. The former will point to the current binary directory (i.e. that where lldb is built) while the former will always point to LLVM's. This was causing trouble for the swift build but should be a transparent for upstream lldb. Modified: lldb/trunk/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=336278&r1=336277&r2=336278&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Wed Jul 4 07:34:32 2018 @@ -89,7 +89,10 @@ option(LLDB_TEST_USE_CUSTOM_C_COMPILER " option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) if(LLDB_INCLUDE_TESTS) - set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}") + # The difference between the following two paths is significant. The path to + # LLDB will point to LLDB's binary directory, while the other will point to + # LLVM's binary directory in case the two differ. + set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}") set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}") if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336279 - [CMake] Remove redundant path component
Author: jdevlieghere Date: Wed Jul 4 07:38:21 2018 New Revision: 336279 URL: http://llvm.org/viewvc/llvm-project?rev=336279&view=rev Log: [CMake] Remove redundant path component Fixes spurious path component introduced in r336278. The variable is cached so might require you to re-run CMake. Modified: lldb/trunk/CMakeLists.txt Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=336279&r1=336278&r2=336279&view=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Wed Jul 4 07:38:21 2018 @@ -92,7 +92,7 @@ if(LLDB_INCLUDE_TESTS) # The difference between the following two paths is significant. The path to # LLDB will point to LLDB's binary directory, while the other will point to # LLVM's binary directory in case the two differ. - set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/bin/lldb${CMAKE_EXECUTABLE_SUFFIX}") + set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}") set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}") if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r336287 - Fix and simplify lldb.command decorator
Author: kastiglione Date: Wed Jul 4 09:11:43 2018 New Revision: 336287 URL: http://llvm.org/viewvc/llvm-project?rev=336287&view=rev Log: Fix and simplify lldb.command decorator Summary: This change fixes one issue with `lldb.command`, and also reduces the implementation. The fix: a command function's docstring was not shown when running `help `. This is because the docstring attached the source function is not propagated to the decorated function (`f.__call__`). By returning the original function, the docstring will be properly displayed by `help`. Also with this change, the command name is assumed to be the function's name, but can still be explicitly defined as previously. Additionally, the implementation was updated to: * Remove inner class * Remove use of `inspect` module * Remove `*args` and `**kwargs` Reviewers: clayborg Reviewed By: clayborg Subscribers: keith, xiaobai, lldb-commits Differential Revision: https://reviews.llvm.org/D48658 Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import lldb/trunk/scripts/Python/python-extensions.swig Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py?rev=336287&r1=336286&r2=336287&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py Wed Jul 4 09:11:43 2018 @@ -49,6 +49,7 @@ class CmdPythonTestCase(TestBase): self.runCmd('command script delete tell_curr', check=False) self.runCmd('command script delete bug11569', check=False) self.runCmd('command script delete takes_exe_ctx', check=False) +self.runCmd('command script delete decorated', check=False) # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) @@ -67,13 +68,19 @@ class CmdPythonTestCase(TestBase): substrs=['Just a docstring for welcome_impl', 'A command that says hello to LLDB users']) +decorated_commands = ["decorated" + str(n) for n in range(1, 5)] +for name in decorated_commands: +self.expect(name, substrs=["hello from " + name]) +self.expect("help " + name, +substrs=["Python command defined by @lldb.command"]) + self.expect("help", substrs=['For more information run', - 'welcome']) + 'welcome'] + decorated_commands) self.expect("help -a", substrs=['For more information run', - 'welcome']) + 'welcome'] + decorated_commands) self.expect("help -u", matching=False, substrs=['For more information run']) Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py?rev=336287&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py Wed Jul 4 09:11:43 2018 @@ -0,0 +1,35 @@ +from __future__ import print_function + +import lldb + + +@lldb.command() +def decorated1(debugger, args, exe_ctx, result, dict): +""" +Python command defined by @lldb.command +""" +print("hello from decorated1", file=result) + + +@lldb.command(doc="Python command defined by @lldb.command") +def decorated2(debugger, args, exe_ctx, result, dict): +""" +This docstring is overridden. +""" +print("hello from decorated2", file=result) + + +@lldb.command() +def decorated3(debugger, args, result, dict): +""" +Python command defined by @lldb.command +""" +print("hello from decorated3", file=result) + + +@lldb.command("decorated4") +def _decorated4(debugger, args, exe_ctx, result, dict): +""" +Python command defined by @lldb.command +""" +print("hello from decorated4", file=result) Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import?
[Lldb-commits] [PATCH] D48658: Fix and simplify lldb.command decorator
This revision was automatically updated to reflect the committed changes. Closed by commit rL336287: Fix and simplify lldb.command decorator (authored by kastiglione, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D48658 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import lldb/trunk/scripts/Python/python-extensions.swig Index: lldb/trunk/scripts/Python/python-extensions.swig === --- lldb/trunk/scripts/Python/python-extensions.swig +++ lldb/trunk/scripts/Python/python-extensions.swig @@ -839,29 +839,18 @@ %pythoncode %{ -def command(*args, **kwargs): +def command(command_name=None, doc=None): import lldb -import inspect """A decorator function that registers an LLDB command line command that is bound to the function it is attached to.""" -class obj(object): -"""The object that tracks adding the command to LLDB one time and handles -calling the function on subsequent calls.""" -def __init__(self, function, command_name, doc = None): -if doc: -function.__doc__ = doc -command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name) -lldb.debugger.HandleCommand(command) -self.function = function -def __call__(self, debugger, command, exe_ctx, result, dict): -if len(inspect.getargspec(self.function).args) == 5: -self.function(debugger, command, exe_ctx, result, dict) -else: -self.function(debugger, command, result, dict) def callable(function): -"""Creates a callable object that gets used.""" -f = obj(function, *args, **kwargs) -return f.__call__ +"""Registers an lldb command for the decorated function.""" +command = "command script add -f %s.%s %s" % (function.__module__, function.__name__, command_name or function.__name__) +lldb.debugger.HandleCommand(command) +if doc: +function.__doc__ = doc +return function + return callable class declaration(object): Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py @@ -49,6 +49,7 @@ self.runCmd('command script delete tell_curr', check=False) self.runCmd('command script delete bug11569', check=False) self.runCmd('command script delete takes_exe_ctx', check=False) +self.runCmd('command script delete decorated', check=False) # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) @@ -67,13 +68,19 @@ substrs=['Just a docstring for welcome_impl', 'A command that says hello to LLDB users']) +decorated_commands = ["decorated" + str(n) for n in range(1, 5)] +for name in decorated_commands: +self.expect(name, substrs=["hello from " + name]) +self.expect("help " + name, +substrs=["Python command defined by @lldb.command"]) + self.expect("help", substrs=['For more information run', - 'welcome']) + 'welcome'] + decorated_commands) self.expect("help -a", substrs=['For more information run', - 'welcome']) + 'welcome'] + decorated_commands) self.expect("help -u", matching=False, substrs=['For more information run']) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/py_import @@ -10,3 +10,4 @@ command script add tell_async --function welcome.check_for_synchro --synchronicity async command script add tell_curr --function welcome.check_for_synchro --synchronicity curr command script add takes_exe_ctx --function welcome.takes_exe_ctx +command script import decorated.py Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py === --- lldb/tru
[Lldb-commits] [lldb] r336290 - [lit] Don't require semicolon separator
Author: jdevlieghere Date: Wed Jul 4 10:14:52 2018 New Revision: 336290 URL: http://llvm.org/viewvc/llvm-project?rev=336290&view=rev Log: [lit] Don't require semicolon separator This patch removes the requirement for a semicolon as a separator when passing arguments to lit. It relies on the shlex module that is part of Python to do simple lexical analysis, similar to what happens in a Unix shell. Modified: lldb/trunk/lit/Suite/lit.cfg lldb/trunk/lit/Suite/lit.site.cfg.in Modified: lldb/trunk/lit/Suite/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.cfg?rev=336290&r1=336289&r2=336290&view=diff == --- lldb/trunk/lit/Suite/lit.cfg (original) +++ lldb/trunk/lit/Suite/lit.cfg Wed Jul 4 10:14:52 2018 @@ -3,6 +3,7 @@ # Configuration file for the 'lit' test runner. import os +import shlex import lit.formats @@ -14,13 +15,20 @@ config.suffixes = ['.py'] # test_source_root: The root path where tests are located. # test_exec_root: The root path where tests should be run. -config.test_source_root = os.path.join(config.lldb_src_root, 'packages','Python','lldbsuite','test') +config.test_source_root = os.path.join(config.lldb_src_root, 'packages', + 'Python', 'lldbsuite', 'test') config.test_exec_root = config.test_source_root # Build dotest command. dotest_cmd = [config.dotest_path, '-q'] dotest_cmd.extend(config.dotest_args_str.split(';')) +# We don't want to force users passing arguments to lit to use `;` as a +# separator. We use Python's simple lexical analyzer to turn the args into a +# list. +if config.dotest_lit_args_str: + dotest_cmd.extend(shlex.split(config.dotest_lit_args_str)) + # Load LLDB test format. sys.path.append(os.path.join(config.lldb_src_root, "lit", "Suite")) import lldbtest Modified: lldb/trunk/lit/Suite/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=336290&r1=336289&r2=336290&view=diff == --- lldb/trunk/lit/Suite/lit.site.cfg.in (original) +++ lldb/trunk/lit/Suite/lit.site.cfg.in Wed Jul 4 10:14:52 2018 @@ -14,14 +14,13 @@ config.python_executable = "@PYTHON_EXEC config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py" config.dotest_args_str = "@LLDB_DOTEST_ARGS@" config.lldb_disable_python = @LLDB_DISABLE_PYTHON@ - +config.dotest_lit_args_str = None # Additional dotest arguments can be passed to lit by providing a # semicolon-separates list: --param dotest-args="arg;arg". dotest_lit_args_str = lit_config.params.get('dotest-args', None) if dotest_lit_args_str: -config.dotest_args_str += ';' -config.dotest_args_str += dotest_lit_args_str +config.dotest_lit_args_str = dotest_lit_args_str # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits