summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/default-constructor
Commit message (Collapse)AuthorAgeFilesLines
* Move lldb/test to lldb/packages/Python/lldbsuite/test.Zachary Turner2015-10-2830-1170/+0
| | | | | | | | | | | This is the conclusion of an effort to get LLDB's Python code structured into a bona-fide Python package. This has a number of benefits, but most notably the ability to more easily share Python code between different but related pieces of LLDB's Python infrastructure (for example, `scripts` can now share code with `test`). llvm-svn: 251532
* Rename `lldb_shared` to `use_lldb_suite`.Zachary Turner2015-10-271-1/+1
| | | | llvm-svn: 251444
* Python3 - Change sys.maxint to sys.maxsize.Zachary Turner2015-10-263-5/+5
| | | | | | | | | Python3 has no analogue to sys.maxint since ints in Python 3 have arbitrary size. However, the distinction was not actually important in any of these cases, and in a few cases using maxint was already a bug to begin with. llvm-svn: 251306
* Port the python api decorator to use test categoriesPavel Labath2015-10-261-33/+33
| | | | | | | | | | | | | | | | | | Summary: Per discussions on the mailing list, I have implemented a decorator which annotates individual test methods with categories. I have used this framework to replace the '-a' and '+a' command-line switches (now '-G pyapi' and '--skip-category pyapi') and the @python_api_test decorator (now @add_test_categories('pyapi')). The test suite now gives an error message suggesting the new options if the user specifies the deprecated +/-a switches. If the general direction is good, I will follow this up with other switches. Reviewers: tberghammer, tfiala, granata.enrico, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14020 llvm-svn: 251277
* Add from __future__ import print_function everywhere.Zachary Turner2015-10-231-33/+35
| | | | | | | | | | | | | Apparently there were tons of instances I missed last time, I guess I accidentally ran 2to3 non-recursively. This should be every occurrence of a print statement fixed to use a print function as well as from __future__ import print_function being added to every file. After this patch print statements will stop working everywhere in the test suite, and the print function should be used instead. llvm-svn: 251121
* Update every test to import `lldb_shared`.Zachary Turner2015-10-221-8/+2
| | | | | | | | | | | | | | | | | | | | | This is necessary in order to allow third party modules to be located under lldb/third_party rather than under the test folder directly. Since we're already touching every test file anyway, we also go ahead and delete the unittest2 import and main block wherever possible. The ability to run a test as a standalone file has already been broken for some time, and if we decide we want this back, we should use unittest instead of unittest2. A few places could not have the import of unittest2 removed,because they depend on the unittest2.expectedFailure or skip decorators. Removing all those was orthogonal in spirit to the purpose of this CL, so the import of unittest2 remains in those files that were using it for its test decorators. Those can be addressed separately. llvm-svn: 251055
* Fix TestTargetAPI.py test for users who use Swig 3.0.5 or greater.Adrian McCarthy2015-10-131-0/+3
| | | | | DifferentialRevision: http://reviews.llvm.org/D13679 llvm-svn: 250188
* Merge dwarf and dsym testsTamas Berghammer2015-09-301-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently most of the test files have a separate dwarf and a separate dsym test with almost identical content (only the build step is different). With adding dwo symbol file handling to the test suit it would increase this to a 3-way duplication. The purpose of this change is to eliminate this redundancy with generating 2 test case (one dwarf and one dsym) for each test function specified (dwo handling will be added at a later commit). Main design goals: * There should be no boilerplate code in each test file to support the multiple debug info in most of the tests (custom scenarios are acceptable in special cases) so adding a new test case is easier and we can't miss one of the debug info type. * In case of a test failure, the debug symbols used during the test run have to be cleanly visible from the output of dotest.py to make debugging easier both from build bot logs and from local test runs * Each test case should have a unique, fully qualified name so we can run exactly 1 test with "-f <test-case>.<test-function>" syntax * Test output should be grouped based on test files the same way as it happens now (displaying dwarf/dsym results separately isn't preferable) Proposed solution (main logic in lldbtest.py, rest of them are test cases fixed up for the new style): * Have only 1 test fuction in the test files what will run for all debug info separately and this test function should call just "self.build(...)" to build an inferior with the right debug info * When a class is created by python (the class object, not the class instance), we will generate a new test method for each debug info format in the test class with the name "<test-function>_<debug-info>" and remove the original test method. This way unittest2 see multiple test methods (1 for each debug info, pretty much as of now) and will handle the test selection and the failure reporting correctly (the debug info will be visible from the end of the test name) * Add new annotation @no_debug_info_test to disable the generation of multiple tests for each debug info format when the test don't have an inferior Differential revision: http://reviews.llvm.org/D13028 llvm-svn: 248883
* Added minor commentVince Harron2015-05-121-0/+1
| | | | llvm-svn: 237174
* I removed SetCallback from the Python API's since it wasn't actually useful, ↵Jim Ingham2014-04-031-1/+2
| | | | | | | | and added SetScriptCallbackFunction, and SetScriptCallbackBody. So add these to the default constructor test case. llvm-svn: 205494
* Merging the iohandler branch back into main. Greg Clayton2014-01-273-29/+0
| | | | | | | | | | | | The many many benefits include: 1 - Input/Output/Error streams are now handled as real streams not a push style input 2 - auto completion in python embedded interpreter 3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use 4 - it is now possible to use curses to drive LLDB (please try the "gui" command) We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases. llvm-svn: 200263
* Massive test suite cleanup to stop everyone from manually having to compute ↵Greg Clayton2013-12-101-1/+1
| | | | | | | | | | "mydir" inside each test case. This has led to many test suite failures because of copy and paste where new test cases were based off of other test cases and the "mydir" variable wasn't updated. Now you can call your superclasses "compute_mydir()" function with "__file__" as the sole argument and the relative path will be computed for you. llvm-svn: 196985
* Changed fuzz tests to not print their values (we only need to test if access ↵Richard Mitton2013-09-2513-18/+18
| | | | | | | | to them does not crash). This fixes the 'No value' string appearing in the dotest results. llvm-svn: 191399
* Added a typemap and wrappers for SBInputReader callbacksFilipe Cabecinhas2012-08-221-1/+4
| | | | | | | | | | | | | | Now it's possible to use SBInputReader callbacks in Python. We leak the callback object, unfortunately. A __del__ method can be added to SBInputReader, but we have no way to check the callback function that is on the reader. So we can't call Py_DECREF on it when we have our PythonCallback function. One way to do it is to assume that reified SBInputReaders always have a Python callback (and always call Py_DECREF). Another one is to add methods or properties to SBInputReader (or make the m_callback_function property public). llvm-svn: 162356
* Fix a crash (_wrap_SBDebugger_SetInputFileHandle -> PyString_AsString) ↵Johnny Chen2012-08-201-1/+4
| | | | | | | | running the test suite. Also modify the boundary condition test case SBDebugger.DispatchInput(None) to be wrapped inside a try-except clause for now. llvm-svn: 162228
* A baton isn't needed to dispatch input.Filipe Cabecinhas2012-08-201-1/+1
| | | | | | I also added a typemap to make DispatchInput usable in Python. llvm-svn: 162204
* rdar://problem/11584012Johnny Chen2012-06-043-4/+5
| | | | | | | | | | | Refactorings of watchpoint creation APIs so that SBTarget::WatchAddress(), SBValue::Watch(), and SBValue::WatchPointee() now take an additional 'SBError &error' parameter (at the end) to contain the reason if there is some failure in the operation. Update 'watchpoint set variable/expression' commands to take advantage of that. Update existing test cases to reflect the API change and add test cases to verify that the SBError mechanism works for SBTarget::WatchAddress() by passing an invalid watch_size. llvm-svn: 157964
* Add SBProcess::GetNumSupportedHardwareWatchpoints() API and export it ↵Johnny Chen2012-05-231-0/+1
| | | | | | | | through the Python scripting bridge. Add/modify some test cases. llvm-svn: 157353
* Removed all of the "#ifndef SWIG" from the SB header files since we are usingGreg Clayton2012-02-062-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interface (.i) files for each class. Changed the FindFunction class from: uint32_t SBTarget::FindFunctions (const char *name, uint32_t name_type_mask, bool append, lldb::SBSymbolContextList& sc_list) uint32_t SBModule::FindFunctions (const char *name, uint32_t name_type_mask, bool append, lldb::SBSymbolContextList& sc_list) To: lldb::SBSymbolContextList SBTarget::FindFunctions (const char *name, uint32_t name_type_mask = lldb::eFunctionNameTypeAny); lldb::SBSymbolContextList SBModule::FindFunctions (const char *name, uint32_t name_type_mask = lldb::eFunctionNameTypeAny); This makes the API easier to use from python. Also added the ability to append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList. Exposed properties for lldb.SBSymbolContextList in python: lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...) and then the result can be used to extract the desired information: sc_list = lldb.target.FindFunctions("erase") for function in sc_list.functions: print function for symbol in sc_list.symbols: print symbol Exposed properties for the lldb.SBSymbolContext objects in python: lldb.SBSymbolContext.module => lldb.SBModule lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit lldb.SBSymbolContext.function => lldb.SBFunction lldb.SBSymbolContext.block => lldb.SBBlock lldb.SBSymbolContext.line_entry => lldb.SBLineEntry lldb.SBSymbolContext.symbol => lldb.SBSymbol Exposed properties for the lldb.SBBlock objects in python: lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block) lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned lldb.SBBlock.ranges => an array or all address ranges for this block lldb.SBBlock.num_ranges => the number of address ranges for this blcok SBFunction objects can now get the SBType and the SBBlock that represents the top scope of the function. SBBlock objects can now get the variable list from the current block. The value list returned allows varaibles to be viewed prior with no process if code wants to check the variables in a function. There are two ways to get a variable list from a SBBlock: lldb::SBValueList SBBlock::GetVariables (lldb::SBFrame& frame, bool arguments, bool locals, bool statics, lldb::DynamicValueType use_dynamic); lldb::SBValueList SBBlock::GetVariables (lldb::SBTarget& target, bool arguments, bool locals, bool statics); When a SBFrame is used, the values returned will be locked down to the frame and the values will be evaluated in the context of that frame. When a SBTarget is used, global an static variables can be viewed without a running process. llvm-svn: 149853
* Added fuzz testing for when we call API calls with an invalid object.Greg Clayton2012-01-313-1/+33
| | | | | | | | | We previously weren't catching that SBValue::Cast(...) would crash if we had an invalid (empty) SBValue object. Cleaned up the SBType API a bit. llvm-svn: 149447
* Add fuzz call to SBStringList.AppendString(None). LLDB should not crash.Johnny Chen2011-12-201-0/+1
| | | | llvm-svn: 146935
* Add a test sequence which passes None to lldb.SBFileSpec(). LLDB should not ↵Johnny Chen2011-12-191-0/+6
| | | | | | crash. llvm-svn: 146922
* Tes passing None to SetErrorString() and SetErrorStringWithFormat().Johnny Chen2011-12-191-0/+2
| | | | llvm-svn: 146919
* Add a fuzz call for SBCommunication: obj.connect(None).Johnny Chen2011-12-191-0/+1
| | | | llvm-svn: 146912
* Add fuzz call for newly added method SBTarget.GetInstructions().Johnny Chen2011-12-151-0/+1
| | | | llvm-svn: 146696
* Add fuzz calls for newly added SBProcess methods. Fix a typo in the audodoc ↵Johnny Chen2011-12-151-0/+3
| | | | | | of SBProcess.ReadCStringFromMemory(). llvm-svn: 146695
* http://llvm.org/bugs/show_bug.cgi?id=11560 lldb::SBTarget::FindFirstType ↵Johnny Chen2011-12-141-0/+1
| | | | | | | | crashes when passed None Add null checks to several functions. Plus add test scenario for passing None to SBTarget.FindFirstType(None) and friends. llvm-svn: 146540
* SBProcess.PutSTDIN() needs to be properly typemapped when swigging,Johnny Chen2011-11-281-1/+1
| | | | | | | | | | | | | | | | | so that we can do Python scripting like this: target = self.dbg.CreateTarget(self.exe) self.dbg.SetAsync(True) process = target.LaunchSimple(None, None, os.getcwd()) process.PutSTDIN("Line 1 Entered.\n") process.PutSTDIN("Line 2 Entered.\n") process.PutSTDIN("Line 3 Entered.\n") Add TestProcessIO.py to exercise the process IO API: PutSTDIN()/GetSTDOUT()/GetSTDERR(). llvm-svn: 145282
* Add test cases for setting condition on a watchpoint for both command and API.Johnny Chen2011-10-171-0/+2
| | | | llvm-svn: 142291
* Add SBWatchpoint::GetError() API, which is not currently populated as yet.Johnny Chen2011-10-141-0/+2
| | | | llvm-svn: 141979
* Add a test case to exercise the newly added SB API:Johnny Chen2011-10-141-2/+3
| | | | | | | lldb::SBWatchpoint SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write) llvm-svn: 141931
* SBValue::Watch() and SBValue::WatchPointee() are now the official API for ↵Johnny Chen2011-10-145-14/+14
| | | | | | | | | | | | | | | | | | creating a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee encapsulated by SBValue (WatchPointee). Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that. Modified the watchpoint related test suite to reflect the change. Plus replacing WatchpointLocation with Watchpoint throughout the code base. There are still cleanups to be dome. This patch passes the whole test suite. Check it in so that we aggressively catch regressions. llvm-svn: 141925
* Add fuzz call for SBBreakpointLocation.GetAddress().Johnny Chen2011-10-071-0/+1
| | | | llvm-svn: 141443
* Add fuzz call for sub-section iteration for SBSection.Johnny Chen2011-10-031-0/+2
| | | | llvm-svn: 141041
* Add SBSection API to the fuzz testing.Johnny Chen2011-10-032-0/+30
| | | | llvm-svn: 141039
* Add fuzz call for watchpoint location iterator, too.Johnny Chen2011-10-031-0/+2
| | | | llvm-svn: 141036
* Add fuzz calls for various iterators, too.Johnny Chen2011-10-0312-1/+31
| | | | llvm-svn: 141035
* Add SBTarget::GetLastCreatedWatchpointLocation() API and export to the ↵Johnny Chen2011-09-271-0/+8
| | | | | | | | | | | Python interface. Also add rich comparison methods (__eq__ and __ne__) for SBWatchpointLocation. Modify TestWatchpointLocationIter.py to exercise the new APIs. Add fuzz testings for the recently added SBTarget APIs related to watchpoint manipulations. llvm-svn: 140633
* Add fuzz testing for newly added SBWatchpointLocation API.Johnny Chen2011-09-272-0/+28
| | | | llvm-svn: 140632
* Add FindValue() and WatchValue() fuzz calls to the mix.Johnny Chen2011-09-241-0/+3
| | | | llvm-svn: 140439
* Added to the public API to allow symbolication:Greg Clayton2011-09-242-2/+2
| | | | | | | | | | | | | | | | | - New SBSection objects that are object file sections which can be accessed through the SBModule classes. You can get the number of sections, get a section at index, and find a section by name. - SBSections can contain subsections (first find "__TEXT" on darwin, then us the resulting SBSection to find "__text" sub section). - Set load addresses for a SBSection in the SBTarget interface - Set the load addresses of all SBSection in a SBModule in the SBTarget interface - Add a new module the an existing target in the SBTarget interface - Get a SBSection from a SBAddress object This should get us a lot closer to being able to symbolicate using LLDB through the public API. llvm-svn: 140437
* Add fuzz calls for added API methods: FindFirstType(), FindTypes(), and ↵Johnny Chen2011-09-151-0/+3
| | | | | | GetSourceManager(). llvm-svn: 139857
* Add fuzz calls to newly added methods: GetAsync() and ↵Johnny Chen2011-09-151-0/+2
| | | | | | SetSelectedTarget(SBTarget). llvm-svn: 139855
* Add new SBAddress APIs to the fuzz tests.Johnny Chen2011-08-151-0/+8
| | | | llvm-svn: 137625
* On second thought, add the IsValid() method to SBTypeList, making it similar ↵Johnny Chen2011-08-051-4/+2
| | | | | | | | to SBSymbolContextList and SBValueList. Modify the test suite accordingly. llvm-svn: 136990
* Fixed test suite failure of test_SBTypeList().Johnny Chen2011-08-051-1/+4
| | | | | | | | SBTypeList does not have IsValid() method defined. It's always valid in a sense. So the Python's truth value testing in turn delegates to __len__() method, which is defined for SBTypeList, and returns 0. llvm-svn: 136985
* Remove expectedFailure decorator for test_SBType, which does not take an ↵Johnny Chen2011-08-052-30/+15
| | | | | | | | | empty constructor after the recent changes. And remove expectedFailure decorator for test_SBTypeMember, which no longer exists after the recent changes, replace it with test_SBTypeList. llvm-svn: 136947
* Public API changes:Enrico Granata2011-07-291-0/+2
| | | | | | | | | | | | | | | | | | | | | - Completely new implementation of SBType - Various enhancements in several other classes Python synthetic children providers for std::vector<T>, std::list<T> and std::map<K,V>: - these return the actual elements into the container as the children of the container - basic template name parsing that works (hopefully) on both Clang and GCC - find them in examples/synthetic and in the test suite in functionalities/data-formatter/data-formatter-python-synth New summary string token ${svar : - the syntax is just the same as in ${var but this new token lets you read the values coming from the synthetic children provider instead of the actual children - Python providers above provide a synthetic child len that returns the number of elements into the container Full bug fix for the issue in which getting byte size for a non-complete type would crash LLDB Several other fixes, including: - inverted the order of arguments in the ClangASTType constructor - EvaluationPoint now only returns SharedPointer's to Target and Process - the help text for several type subcommands now correctly indicates argument-less options as such llvm-svn: 136504
* Add new API for SBAddress to the fuzz test:Johnny Chen2011-07-221-0/+1
| | | | | | | SetLoadAddress (lldb::addr_t load_addr, lldb::SBTarget &target); llvm-svn: 135793
* Make the SBAddress class easier to use when using the publicGreg Clayton2011-07-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API. SBTarget changes include changing: bool SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr, lldb::SBAddress& addr); to be: lldb::SBAddress SBTarget::ResolveLoadAddress (lldb::addr_t vm_addr); SBAddress can how contruct itself using a load address and a target which can be used to resolve the address: SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target); This will actually just call the new SetLoadAddress accessor: void SetLoadAddress (lldb::addr_t load_addr, lldb::SBTarget &target); This function will always succeed in making a SBAddress object that can be used in API calls (even if "target" isn't valid). If "target" is valid and there are sections currently loaded, then it will resolve the address to a section offset address if it can. Else an address with a NULL section and an offset that is the "load_addr" that was passed in. We do this because a load address might be from the heap or stack. llvm-svn: 135770
OpenPOWER on IntegriCloud