Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range
jasonmolenda added a subscriber: jasonmolenda. jasonmolenda added a comment. NB: Greg is out for the next nine days, Enrico for the next five days. http://reviews.llvm.org/D13058 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
KLapshin added a comment. @brucem, @enlight Is this patch is fine for you now ? Repository: rL LLVM http://reviews.llvm.org/D12977 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run
ki.stfu requested changes to this revision. ki.stfu added a comment. This revision now requires changes to proceed. Update the summary + a few inline comments below. Comment at: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py:13-31 @@ -12,3 +12,21 @@ @lldbmi_test @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows +@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented +def test_lldbmi_gdb_set_process_stopatentry_on(self): +"""Test that 'lldb-mi --interpreter' can stop at entry.""" + +self.spawnLldbMi(args = None) + +# Load executable +self.runCmd("-file-exec-and-symbols %s" % self.myexe) +self.expect("\^done") + +# Test that program is stopped at entry +self.runCmd("-exec-run --start") +self.expect("\^running") + self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*thread-id=\"1\",stopped-threads=\"all\"") + +# Test that lldb-mi is ready to execute next commands +self.expect(self.child_prompt, exactly = True) + And move this test case to test/tools/lldb-mi/control/TestMiExec.py Comment at: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py:16 @@ +15,3 @@ +@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented +def test_lldbmi_gdb_set_process_stopatentry_on(self): +"""Test that 'lldb-mi --interpreter' can stop at entry.""" Rename it to ``` def test_lldbmi_exec_run(self): ``` Comment at: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py:28 @@ +27,3 @@ +self.expect("\^running") + self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*thread-id=\"1\",stopped-threads=\"all\"") + Use lazy regex please: ``` self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"") ``` Comment at: tools/lldb-mi/MICmdCmdExec.h:58 @@ -57,2 +57,3 @@ bool Acknowledge() override; +bool ParseArgs() override; // From CMICmnBase Please move it on few lines above for consistency with others: ``` bool ParseArgs() override; bool Execute() override; [...] ``` Repository: rL LLVM http://reviews.llvm.org/D12977 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248676 - Added python script to support running pylint.
Author: tfiala Date: Sat Sep 26 18:00:35 2015 New Revision: 248676 URL: http://llvm.org/viewvc/llvm-project?rev=248676&view=rev Log: Added python script to support running pylint. See the script comments for how to modify your pylintrc file (e.g. $HOME/.pylintrc) to support always finding the lldb-specific Python library directories. With the pylintrc modification using this script, the lldb python tests and test inferstructure can be linted on any of potentially multiple lldb source trees on the system without further work from the developer. Added: lldb/trunk/test/lldb_pylint_helper.py Added: lldb/trunk/test/lldb_pylint_helper.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldb_pylint_helper.py?rev=248676&view=auto == --- lldb/trunk/test/lldb_pylint_helper.py (added) +++ lldb/trunk/test/lldb_pylint_helper.py Sat Sep 26 18:00:35 2015 @@ -0,0 +1,92 @@ +""" + The LLVM Compiler Infrastructure + +This file is distributed under the University of Illinois Open Source +License. See LICENSE.TXT for details. + +Sync lldb and related source from a local machine to a remote machine. + +This facilitates working on the lldb sourcecode on multiple machines +and multiple OS types, verifying changes across all. + +Provides helper support for adding lldb test paths to the python path. +""" +import os +import sys + + +def add_lldb_test_paths(check_dir): +"""Adds lldb test-related paths to the python path. + +Starting with the given directory and working upward through +each parent directory up to the root, it looks for the lldb +test directory. When found, the lldb test directory and its +child test_runner/lib directory will be added to the python +system path. + +Instructions for use: + +This method supports a simple way of getting pylint to be able +to reliably lint lldb python test scripts (including the test +infrastructure itself). To do so, add the following to a +.pylintrc file in your home directory: + +[Master] +init-hook='import os; import sys; sys.path.append(os.path.expanduser("~/path/to/lldb/test")); import lldb_pylint_helper; lldb_pylint_helper.add_lldb_test_paths(os.getcwd()); print("sys.path={}\n".format(sys.path))' + +Replace ~/path/to/lldb/test with a valid path to your local lldb source +tree. Note you can have multiple lldb source trees on your system, and +this will work just fine. The path in your .pylintrc is just needed to +find the paths needed for pylint in whatever lldb source tree you're in. +pylint will use the python files in whichever tree it is run from. + +Note it is critical that the init-hook line be contained on a single line. +You can remove the print line at the end once you know the pythonpath is +getting set up the way you expect. + +With these changes, you will be able to run the following, for example. + +cd lldb/sourcetree/1-of-many/test/lang/c/anonymous +pylint TestAnonymous.py + +This will work, and include all the lldb/sourcetree/1-of-many lldb-specific +python directories to your path. + +You can then run it in another lldb source tree on the same machine like +so: + +cd lldb/sourcetree/2-of-many/test/functionalities/inferior-assert +pyline TestInferiorAssert.py + +and this will properly lint that file, using the lldb-specific python +directories from the 2-of-many source tree. + +Note at the time I'm writing this, our tests are in pretty sad shape +as far as a stock pylint setup goes. But we need to start somewhere :-) + +@param check_dir specifies a directory that will be used to start +looking for the lldb test infrastructure python library paths. +""" +check_dir = os.path.realpath(check_dir) +while check_dir and len(check_dir) > 0: +# If the current directory is test, it might be the lldb/test +# directory. If so, we've found an anchor that will allow us +# to add the relevant lldb-sourcetree-relative python lib +# dirs. +if os.path.basename(check_dir) == 'test': +# If this directory has a dotest.py file in it, +# then this is an lldb test tree. Add the +# test directories to the python path. +if os.path.exists(os.path.join(check_dir, "dotest.py")): +sys.path.insert(0, check_dir) +sys.path.insert(0, os.path.join( +check_dir, "test_runner", "lib")) +break +# Continue looking up the parent chain until we have no more +# directories to check. +new_check_dir = os.path.dirname(check_dir) +# We're done when the new check dir is not different +# than the current one. +if new_check_dir == check_dir: +break +check_dir = new_check_dir __
Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism
tfiala updated this revision to Diff 35814. tfiala added a comment. Minor refactor, moving new components to test/test_runner/lib. Will be adding test runner tests to test/test_runner/test and will make sure the normal test runner doesn't try to run them. (These will be test infrastructure tests, i.e. tests for the test infrastructure, not tests that run on them). This is vs. llvm.org lldb trunk r248676. Note I've also now had positive timeout confirmation on OS X. As I suspected, it is less convenient there to have the soft kill do a SIGQUIT, since on OS X this brings up the crash log generator dialog where now user input is required (and very bad if the tests are running in a session that doesn't have access to a window server). I'll be working in a --no-core-on-timeout and --core-on-timeout option, and have it default to "no" on OS X and "yes" everywhere else. When no cores are desired, we'll generate a SIGTERM instead of a SIGQUIT on the soft terminate request. http://reviews.llvm.org/D13124 Files: test/dosep.py test/test_runner/README.txt test/test_runner/lib/lldb_utils.py test/test_runner/lib/process_control.py Index: test/test_runner/lib/process_control.py === --- /dev/null +++ test/test_runner/lib/process_control.py @@ -0,0 +1,474 @@ +""" +The LLVM Compiler Infrastructure + +This file is distributed under the University of Illinois Open Source +License. See LICENSE.TXT for details. + +Provides classes used by the test results reporting infrastructure +within the LLDB test suite. + + +This module provides process-management support for the LLDB test +running infrasructure. +""" + +# System imports +import os +import re +import signal +import subprocess +import sys +import threading + + +class CommunicatorThread(threading.Thread): +"""Provides a thread class that communicates with a subprocess.""" +def __init__(self, process, event, output_file): +super(CommunicatorThread, self).__init__() +# Don't let this thread prevent shutdown. +self.daemon = True +self.process = process +self.pid = process.pid +self.event = event +self.output_file = output_file +self.output = None + +def run(self): +try: +# Communicate with the child process. +# This will not complete until the child process terminates. +self.output = self.process.communicate() +except Exception as exception: # pylint: disable=broad-except +if self.output_file: +self.output_file.write( +"exception while using communicate() for pid: {}\n".format( +exception)) +finally: +# Signal that the thread's run is complete. +self.event.set() + + +# Provides a regular expression for matching gtimeout-based durations. +TIMEOUT_REGEX = re.compile(r"(^\d+)([smhd])?$") + + +def timeout_to_seconds(timeout): +"""Converts timeout/gtimeout timeout values into seconds. + +@param timeout a timeout in the form of xm representing x minutes. + +@return None if timeout is None, or the number of seconds as a float +if a valid timeout format was specified. +""" +if timeout is None: +return None +else: +match = TIMEOUT_REGEX.match(timeout) +if match: +value = float(match.group(1)) +units = match.group(2) +if units is None: +# default is seconds. No conversion necessary. +return value +elif units == 's': +# Seconds. No conversion necessary. +return value +elif units == 'm': +# Value is in minutes. +return 60.0 * value +elif units == 'h': +# Value is in hours. +return (60.0 * 60.0) * value +elif units == 'd': +# Value is in days. +return 24 * (60.0 * 60.0) * value +else: +raise Exception("unexpected units value '{}'".format(units)) +else: +raise Exception("could not parse TIMEOUT spec '{}'".format( +timeout)) + + +class ProcessHelper(object): +"""Provides an interface for accessing process-related functionality. + +This class provides a factory method that gives the caller a +platform-specific implementation instance of the class. + +Clients of the class should stick to the methods provided in this +base class. + +@see ProcessHelper.process_helper() +""" +def __init__(self): +super(ProcessHelper, self).__init__() + +@classmethod +def process_helper(cls): +"""Returns a platform-specific ProcessHelper instance. +@return a ProcessHelper instance that does the right thing for +the current platform. +""" +if os.name ==
Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism
tfiala added a comment. > When no cores are desired, we'll generate a SIGTERM instead of a SIGQUIT on > the soft terminate request. That on the POSIX-y systems, of course. It would be cool if Zachary can work in the mini crashdumps or similar on Windows. http://reviews.llvm.org/D13124 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits