summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api
Commit message (Collapse)AuthorAgeFilesLines
* Add support for DW_AT_export_symbols for anonymous structsshafik2019-10-282-2/+14
| | | | | | | | | Summary: We add support for DW_AT_export_symbols to detect anonymous struct on top of the heuristics implemented in D66175 This should allow us to differentiate anonymous structs and unnamed structs. We also fix TestTypeList.py which was incorrectly detecting an unnamed struct as an anonymous struct. Differential Revision: https://reviews.llvm.org/D68961
* Add arm64_32 support to lldb, an ILP32 codegen Jason Molenda2019-10-161-1/+1
| | | | | | | | | | that runs on arm64 ISA targets, specifically Apple watches. Differential Revision: https://reviews.llvm.org/D68858 llvm-svn: 375032
* update ScriptInterpreterPython to use File, not FILE*Lawrence D'Anna2019-10-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: ScriptInterpreterPython needs to save and restore sys.stdout and friends when LLDB runs a python script. It currently does this using FILE*, which is not optimal. If whatever was in sys.stdout can not be represented as a FILE*, then it will not be restored correctly when the script is finished. It also means that if the debugger's own output stream is not representable as a file, ScriptInterpreterPython will not be able to redirect python's output correctly. This patch updates ScriptInterpreterPython to represent files with lldb_private::File, and to represent whatever the user had in sys.stdout as simply a PythonObject. This will make lldb interoperate better with other scripts or programs that need to manipulate sys.stdout. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68962 llvm-svn: 374964
* remove FILE* usage from SBStream.iLawrence D'Anna2019-10-151-0/+27
| | | | | | | | | | | | | | | | | | | | Summary: This patch removes FILE* and replaces it with SBFile and FileSP the SWIG interface for `SBStream.i`. And this is the last one. With this change, nothing in the python API will can access a FILE* method on the C++ side. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68960 llvm-svn: 374924
* convert SBDebugger::***FileHandle() wrappers to native files.Lawrence D'Anna2019-10-151-9/+42
| | | | | | | | | | | | | | | | | | | | Summary: This patch converts the swig wrappers for SetInputFileHandle() and friends to emulate the old behavior using SetInputFile(). This will clear the way for deleting the FILE* typemaps altogether. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: mehdi_amini, dexonsmith, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68856 llvm-svn: 374912
* SBFile::GetFile: convert SBFile back into python native files.Lawrence D'Anna2019-10-151-1/+34
| | | | | | | | | | | | | | | | | | | | | | Summary: This makes SBFile::GetFile public and adds a SWIG typemap to convert the result back into a python native file. If the underlying File itself came from a python file, it is returned identically. Otherwise a new python file object is created using the file descriptor. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68737 llvm-svn: 374911
* Fix TestDisassemble_VST1_64Pavel Labath2019-10-151-7/+7
| | | | | | | | - use a full triple instead of just the architecture (makes the test pass on non-apple hosts) - skip the test if the ARM llvm target is not built llvm-svn: 374863
* remove FILE* bindings from SBInstruction.Lawrence D'Anna2019-10-143-11/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch replaces the FILE* python bindings for SBInstruction and SBInstructionList and replaces them with the new, safe SBFile and FileSP bindings. I also re-enable `Test_Disassemble_VST1_64`, because now we can use the file bindings as an additional test of the disassembler, and we can use the disassembler test as a test of the file bindings. The bugs referred to in the comments appear to have been fixed. The radar is closed now and the bugzilla bug does not reproduce with the instructions given. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68890 llvm-svn: 374820
* remove FILE* usage from ReportEventState() and HandleProcessEvent()Lawrence D'Anna2019-10-142-2/+8
| | | | | | | | | | | | | | | | | | | Summary: This patch adds FileSP and SBFile versions of the API methods ReportEventState and HandleProcessEvent. It points the SWIG wrappers at these instead of the ones that use FILE* streams. Reviewers: JDevlieghere, jasonmolenda, labath, jingham Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68546 llvm-svn: 374816
* Fix test breakage caused by r374424Lawrence D'Anna2019-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The build directory name is based on the test method name, so having two test methods with the same name in the same test file is a problem, even if they're in different test classes. On linux and darwin this conflict can go unnoticed, but windows has different filesystem semantics and it will fail when one process tries to delete files still held open by another. The problem is fixed just by changing the name of one of the test methods. Reviewers: JDevlieghere, jasonmolenda, labath, stella.stamenova Reviewed By: stella.stamenova Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68951 llvm-svn: 374803
* IOHandler: fall back on File::Read if a FILE* isn't available.Lawrence D'Anna2019-10-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: IOHandler needs to read lines of input from a lldb::File. The way it currently does this using, FILE*, which is something we want to avoid now. I'd prefer to just replace the FILE* code with calls to File::Read, but it contains an awkward and delicate workaround specific to ctrl-C handling on windows, and it's not clear if or how that workaround would translate to lldb::File. So in this patch, we use use the FILE* if it's available, and only fall back on File::Read if that's the only option. I think this is a reasonable approach here for two reasons. First is that interactive terminal support is the one area where FILE* can't be avoided. We need them for libedit and curses anyway, and using them here as well is consistent with that pattern. The second reason is that the comments express a hope that the underlying windows bug that's being worked around will be fixed one day, so hopefully when that happens, that whole path can be deleted. Reviewers: JDevlieghere, jasonmolenda, labath, lanza Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68622 llvm-svn: 374576
* update TestRunCommandInterpreterAPI to use SBFileLawrence D'Anna2019-10-101-4/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If you look at what this test is doing, it's actually quite mysterious why it works at all. It sets the input file inside a "with open". As soon as the with block ends, that file will be closed. And yet somehow LLDB reads commands from it anyway. What's actually happening is that the file descriptor gets dup'd when something inside LLDB calls File::GetStream(). I think it's fair to say that what this test is doing is illegal and it has no right to expect it to work. This patch updates the test with two cases. One uses the SBFile api, and actually transfers ownership of the original file descriptor to the debugger. The other just uses the old FILE* API, but in a sane way. I also set NO_DEBUG_INFO_TESTCASE, because this test doesn't use any debug info and doesn't need to run three times. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: aprantl, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68738 llvm-svn: 374424
* update SBDebugger::SetInputFile() etc to work on native FilesLawrence D'Anna2019-10-101-6/+0
| | | | | | | | | | | | | | | | | | | Summary: This patch adds FileSP versions of SetInputFile(), SetOutputFile, and SetErrorFile(). SWIG will convert native python file objects into FileSP. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68734 llvm-svn: 374422
* TestFileHandle.py: fix for Python 3.6Lawrence D'Anna2019-10-101-2/+2
| | | | | | | | | | | | | | | | | | | Summary: Python 3.6 stringifies exceptions as `ExceptionClass("foo",)` instead of `ExceptionClass("foo")`. This patch makes the test assertions a little more flexible so the test passes anyway. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68745 llvm-svn: 374417
* TestFileHandle.py: relax exception type checksPavel Labath2019-10-101-3/+3
| | | | | | | | | | | | the exceptions returned differ between swig4 (TypeError) and swig<=3 (NotImplementedError). Just check for the base Exception class instead. Theoretically we could switch on the swig version and expect the precise type directly, but checking the exact type does not seem that important. Thanks to Raphael for helping me figure this out. llvm-svn: 374322
* s/@expectedFailure/@expectedFailureAll in TestFileHandlePavel Labath2019-10-101-12/+11
| | | | | | | | | The test isn't using @expectedFailure correctly, which causes weird errors, at least with python2, at least with linux. Possibly that function shouldn't even be public as it's main use is as a backed for other decorators. llvm-svn: 374299
* SBFile support in SBCommandReturnObjectLawrence D'Anna2019-10-091-2/+2
| | | | | | | | | | | | | | | | | | Summary: This patch add SBFile interfaces to SBCommandReturnObject, and removes the internal callers of its FILE* interfaces. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68434 llvm-svn: 374238
* SBFile: add a bunch of tests that should eventually work.Lawrence D'Anna2019-10-091-4/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It's really annoying and confusing to have to keep referring back to earlier versions of this SBFile work to find the tests that need to be added for each patch, and not duplicate them with new tests. This patch just imports all my tests. A bunch of them don't work yet, so they are marked to be skipped. They'll be unmarked as I fix them. One of these tests will actually trip an assert in the SWIG code now instead of just failing, so I'm fixing that here too. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: JDevlieghere, labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68433 llvm-svn: 374237
* TestHelloWorld: Make compatible with remote testingFrederic Riss2019-10-091-10/+14
| | | | | | The synchronization token handling was not remote-friendly. llvm-svn: 374234
* allow arbitrary python streams to be converted to SBFileLawrence D'Anna2019-10-091-17/+301
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds SWIG typemaps that can convert arbitrary python file objects into lldb_private::File. A SBFile may be initialized from a python file using the constructor. There are also alternate, tagged constructors that allow python files to be borrowed, and for the caller to control whether or not the python I/O methods will be called even when a file descriptor is available.I Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: zturner, amccarth, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68188 llvm-svn: 374225
* SBDebugger::SetInputFile, SetOutputFile, etc.Lawrence D'Anna2019-10-031-1/+125
| | | | | | | | | | | | | | | | | | | | | Summary: Add new methods to SBDebugger to set IO files as SBFiles instead of as FILE* streams. In future commits, the FILE* methods will be deprecated and these will become the primary way to set the debugger I/O streams. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68181 llvm-svn: 373563
* new api class: SBFileLawrence D'Anna2019-10-032-0/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: SBFile is a scripting API wrapper for lldb_private::File This is the first step in a project to enable arbitrary python io.IOBase file objects -- including those that override the read() and write() methods -- to be used as the main debugger IOStreams. Currently this is impossible because python file objects must first be converted into FILE* streams by SWIG in order to be passed into the debugger. full prototype: https://github.com/smoofra/llvm-project/tree/files Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath Reviewed By: labath Subscribers: labath, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67793 llvm-svn: 373562
* Revert: [lldb] [testsuite] Remove redundant MAKE_DSYM := NOJan Kratochvil2019-09-274-0/+4
| | | | | | | | | | Revert: llvm-svn: 373061 It broke OSX testsuite: https://reviews.llvm.org/D67589#1686150 lldb/packages/Python/lldbsuite/test/macosx/function-starts/TestFunctionStarts.py llvm-svn: 373110
* [lldb] [testsuite] Remove redundant MAKE_DSYM := NOJan Kratochvil2019-09-274-4/+0
| | | | | | | According to a comment by Pavel Labath: https://reviews.llvm.org/D67589#inline-612375 llvm-svn: 373061
* Canonicalize variable usage in testsuite MakefilesAdrian Prantl2019-09-258-13/+17
| | | | | | | | | | | | This test streamlines our use of variables that are expected by Makefile.rules throughout the test suite. Mostly it replaced potentially dangerous overrides and updates of variables like CFLAGS with safe assignments to variables reserved for this purpose like CFLAGS_EXTRAS. Differential Revision: https://reviews.llvm.org/D67984 llvm-svn: 372795
* [ScriptInterpreter] Limit LLDB's globals to interactive mode.Jonas Devlieghere2019-09-181-1/+1
| | | | | | | | | | | Jim pointed out that the LLDB global variables should only be available in interactive mode. When used from a command for example, their values might be stale or not at all what the user expects. Therefore we want to explicitly make these variables unavailable. Differential revision: https://reviews.llvm.org/D67685 llvm-svn: 372192
* Ah, only skip this for embedded darwin targets.Jason Molenda2019-09-111-1/+1
| | | | llvm-svn: 371583
* Skip a test in TestProcessIO.py when running against ios devices.Jason Molenda2019-09-111-0/+1
| | | | llvm-svn: 371582
* [Windows] Add support of watchpoints to `ProcessWindows`Aleksandr Urakov2019-09-066-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support of watchpoints to the old `ProcessWindows` plugin. The `ProcessWindows` plugin uses the `RegisterContext` to set and reset watchpoints. The `RegisterContext` has some interface to access watchpoints, but it is very limited (e.g. it is impossible to retrieve the last triggered watchpoint with it), that's why I have implemented a slightly different interface in the `RegisterContextWindows`. Moreover, I have made the `ProcessWindows` plugin responsible for search of a vacant watchpoint slot, because watchpoints exist per-process (not per-thread), then we can place the same watchpoint in the same slot in different threads. With this scheme threads don't need to have their own watchpoint lists, and it simplifies identifying of the last triggered watchpoint. Reviewers: asmith, stella.stamenova, amccarth Reviewed By: amccarth Subscribers: labath, zturner, leonid.mashinskiy, abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67168 llvm-svn: 371166
* [dotest] Delete trivial inline test makefilesPavel Labath2019-09-051-3/+0
| | | | | | inline tests are able to generate these automatically llvm-svn: 371015
* [Python] Implement __next__ for value_iterJonas Devlieghere2019-09-041-0/+7
| | | | | | | | | Python 3 iteration calls the next() method instead of next() and value_iter only implemented the Python 2 version. Differential revision: https://reviews.llvm.org/D67184 llvm-svn: 370954
* [Python] Implement truth testing for lldb.valueJonas Devlieghere2019-09-041-0/+4
| | | | | | | | | Python 3 calls __bool__() instead of __len__() and lldb.value only implemented the __len__ method. This adds the __bool__() implementation. Differential revision: https://reviews.llvm.org/D67183 llvm-svn: 370953
* [dotest] Avoid the need for LEVEL= makefile boilerplatePavel Labath2019-09-0439-116/+39
| | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of each test case knowing its depth relative to the test root, we can just have dotest add the folder containing Makefile.rules to the include path. This was motivated by r370616, though I have been wanting to do this ever since we moved to building tests out-of-tree. The only manually modified files in this patch are lldbinline.py and plugins/builder_base.py. The rest of the patch has been produced by this shell command: find . \( -name Makefile -o -name '*.mk' \) -exec sed --in-place -e '/LEVEL *:\?=/d' -e '1,2{/^$/d}' -e 's,\$(LEVEL)/,,' {} + Reviewers: teemperor, aprantl, espindola, jfb Subscribers: emaste, javed.absar, arichardson, christof, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D67083 llvm-svn: 370845
* [API] Have SBCommandReturnObject::GetOutput/Error return "" instead of nullptrPavel Labath2019-08-141-0/+17
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems this was an unintended side-effect of D26698. AFAICT, these functions did return an empty string before that patch, and the patch contained code which attempted to ensure that, but those efforts were negated by ConstString::AsCString, which by default returns a nullptr even for empty strings. This patch: - fixes the GetOutput/Error methods to really return empty strings - adds and explicit test for that - removes a workaround in lldbtest.py, which was masking this problem from our other tests Reviewers: jingham, clayborg Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D65739 llvm-svn: 368806
* [lldb][NFC] Remove unused imports in python testsRaphael Isemann2019-08-0274-146/+0
| | | | llvm-svn: 367663
* Fix `skipIfSanitized` decorator on macOSJonas Devlieghere2019-08-011-1/+1
| | | | | | | | | | | For security reasons, DYLD_INSERT_LIBRARIES is not propagated to a child process. This breaks the skipIfSanitized decorator, which checks for the environment variable being set. Instead, always set the ASAN_OPTIONS and make the decorator check for that. Differential revision: https://reviews.llvm.org/D65594 llvm-svn: 367595
* [lldb] [test] Mark newly running test XFAIL on NetBSDMichal Gorny2019-07-301-0/+1
| | | | | | | | The test was not previously run due to decorator bug (fixed in r366903). It is not a regression and is probably related to the other failing test, so just disable it. llvm-svn: 367285
* [lldb][test_suite] Update tests with unexpected pass on Android aarch64Alex Langford2019-07-231-0/+1
| | | | | | | | | | Summary: update some test decorates that can actually pass on andriod aarch64 Patch by Wanyi Ye <kusmour@gmail.com> Differential Revision: https://reviews.llvm.org/D64767 llvm-svn: 366858
* [lldb] [test] Un-XFAIL TestFormattersSBAPI on NetBSDMichal Gorny2019-07-131-1/+0
| | | | llvm-svn: 365991
* [lldb] [test] Update NetBSD XFAILs in test suiteMichal Gorny2019-07-085-4/+1
| | | | llvm-svn: 365338
* [lldb] [lldbsuite] Use a unique class name for TestValueVarUpdateStella Stamenova2019-07-011-1/+1
| | | | | | It looks like when this test was added, it was based on TestHelloWorld and it ended up with the same class name. This is an issue because the logs associated with the tests use the class name as the identifier for the file and if two tests have the same name their logs overwrite each other. On non-windows, this just means we lose one of the logs, but on Windows this means that one of the tests will fail occasionally because the file are locked by the other test. llvm-svn: 364860
* [ABI] Implement Windows ABI for x86_64Alex Langford2019-06-241-1/+0
| | | | | | | | | | | | | | | | | | Summary: Implement the ABI for WIndows-x86_64 including register info and calling convention. Handled nested struct returned in register (SysV doesn't have it supported) Reviewers: xiaobai, compnerd Reviewed By: compnerd Subscribers: labath, jasonmolenda, fedor.sergeev, mgorny, teemperor, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62213 llvm-svn: 364216
* [lldb] [test] Mark frequently failing flaky tests skipped on NetBSDMichal Gorny2019-05-151-0/+2
| | | | llvm-svn: 360767
* Make SBDebugger.RunCommandInterpreter callable from Python.Jim Ingham2019-05-151-0/+38
| | | | | | | | Authored by: Lukas Boger Differential Revision: https://reviews.llvm.org/D61602 llvm-svn: 360730
* typedef enum -> enumFangrui Song2019-05-142-4/+4
| | | | | | | | Reviewed By: labath Differential Revision: https://reviews.llvm.org/D61883 llvm-svn: 360654
* Revert "Disable the step over skipping calls feature since buildbots are not ↵Pavel Labath2019-05-101-1/+0
| | | | | | | | | | | | | | | | happy." While this fixed the windows bot failures, it also broke all other bots. Upon closer inspection, it turns out that the windows bots were "broken" because two tests were unexpectedly passing -- i.e., the original patch (r360375) actually improved our stepping support on windows. So instead, I remove the relevant XFAILs. This reverts commit r360397. llvm-svn: 360407
* Another use of the interactive lldb.debugger.Jason Molenda2019-04-251-1/+1
| | | | llvm-svn: 359240
* Make TestPrintStackTraces deterministicPavel Labath2019-04-122-158/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This test contained an incredibly complicated inferior, but in reality, all it was testing was that we can backtrace up to main and see main's arguments. However, the way this was implemented (setting a breakpoint on a separate thread) meant that each time the test would run, it would stop in a different location on the main thread. Most of the time this location would be deep in some libc function, which meant that the success of this test depended on our ability to backtrace out of a random function of the c library that the user happens to have installed. This makes the test unpredictable. Backtracing out of a libc function is an important functionality, but this is not the way to test it. Often it is not even our fault that we cannot backtrace out because the C library contains a lot of assembly routines that may not have correct unwind info associated with them. For this reason the test has accumulated numerous @expectedFail/Flaky decorators. In this patch, I replace the inferior with one that does not depend on libc functions. Instead I create a couple of stack frames of user code, and have the test verify that. I also simplify the test by using lldbutil.run_to_source_breakpoint. llvm-svn: 358266
* modify-python-lldb.py: (Re)move __len__ and __iter__ supportPavel Labath2019-04-041-0/+1
| | | | | | | | | | | | | | | | Summary: This patch moves the modify-python-lldb code for adding new functions to the SBModule class into the SBModule interface file. As this is the last class using this functionality, I also remove all support for this kind of modifications from modify-python-lldb.py. Reviewers: amccarth, clayborg, jingham Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D60195 llvm-svn: 357680
* modify-python-lldb.py: clean up __iter__ and __len__ supportPavel Labath2019-04-036-0/+13
| | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of modifying the swig-generated code, just add the appropriate methods to the interface files in order to get the swig to do the generation for us. This is a straight-forward move from the python script to the interface files. The single class which has nontrivial handling in the script (SBModule) has been left for a separate patch. For the cases where I did not find any tests exercising the iteration/length methods (i.e., no tests failed after I stopped emitting them), I tried to add basic tests for that functionality. Reviewers: zturner, jingham, amccarth Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D60119 llvm-svn: 357572
OpenPOWER on IntegriCloud