summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/value
Commit message (Collapse)AuthorAgeFilesLines
* Move lldb/test to lldb/packages/Python/lldbsuite/test.Zachary Turner2015-10-289-565/+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-273-3/+3
| | | | llvm-svn: 251444
* Port the python api decorator to use test categoriesPavel Labath2015-10-263-3/+3
| | | | | | | | | | | | | | | | | | 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-233-10/+16
| | | | | | | | | | | | | 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-223-21/+6
| | | | | | | | | | | | | | | | | | | | | 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
* Merge dwarf and dsym testsTamas Berghammer2015-09-303-67/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Remove expectedFailureFreeBSD from passing TestChangeValueAPI testEd Maste2015-09-231-1/+0
| | | | | | | | | | This test used fail intermittently, but now passes consistently on FreeBSD in local runs. We'll investigate further if it's intermittent on the FreeBSD buildbot, once it's restored. llvm.org/pr15039 llvm-svn: 248410
* XFAIL some more tests related to value apiZachary Turner2015-09-112-0/+2
| | | | | | llvm.org/pr24772 llvm-svn: 247458
* Add a class ValueObjectConstResultCast.Siva Chandra2015-07-162-0/+16
| | | | | | | | | | | | | | | | | | | | | Summary: Other changes around the main change include: 1. Add a method Cast to ValueObjectConstResult, ValueObjectConstResultImpl and ValueObjectConstResultChild. 2. Add an argument |live_address| of type lldb::addr_t to the constructor of ValueObjectConstResultChild. This is passed on to the backing ValueObjectConstResultImpl object constructor so that the address of the child value can be calculated properly. Reviewers: granata.enrico, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11203 llvm-svn: 242374
* [TestChangeValueAPI] Remove expectedFailureGcc decorator.Siva Chandra2015-05-211-1/+0
| | | | | | | | | | | | | | Test Plan: dotest.py -C <clang|gcc> -p TestChangeValueAPI Reviewers: vharron Reviewed By: vharron Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9116 llvm-svn: 237927
* Enable TestChangeValueAPI on LinuxPavel Labath2015-05-051-2/+1
| | | | | | | | the test has passed in the last 300 runs, enabling to see what the build bot says. Also, downgrading skipIfGcc to XFAIL, with plans of enabling it in the future if it shows to be working. llvm-svn: 236496
* Replace sys.platform skips in tests with @skip decorators which check ↵Robert Flack2015-03-303-3/+3
| | | | | | | | | | | | | | | | against remote platform. Adds @skipIfPlatform and @skipUnlessPlatform decorators which will skip if / unless the target platform is in the provided platform list. Test Plan: ninja check-lldb shows no regressions. When running cross platform, tests which cannot run on the target platform are skipped. Differential Revision: http://reviews.llvm.org/D8665 llvm-svn: 233547
* Avoid a failing test case by fixing things so the compiler generates a line ↵Greg Clayton2015-03-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | table entry for line the very start of the printf() before any values have been loaded into registers. The issue was the previous code tried to stop on the following code in main.c: 21 // Stop here and set values 22 printf ("Val - %d Mine - %d, %d, %llu. Ptr - %d, %d, %llu\n", 23 val, 24 mine.first_val, mine.second_val, mine.third_val, 25 ptr->first_val, ptr->second_val, ptr->third_val); We we set a source regex breakpoint on "// Stop here and set values" we would set a breakpoint on line 22 as expected. The problem is the most recent clang compiler generates a line table like this 0x1000: main.c:23 // Loading of "val" into a register 0x1010: main.c:24 // Load mine.first_val, mine.second_val, mine.third_val values into registers or on the stack 0x1020: main.c:25 // Load ptr->first_val, ptr->second_val, ptr->third_val values into registers or on the stack 0x1030: main.c:22 // Call to printf In this test, we run to line 22, then we use python to modify the value of "val" and then continue to another breakpoint and try to read the STDOUT from the printf to verify the values changed correctly. With the above line table the value for "val" had already been loaded into a register so the string from printf would be incorrect. Doing an easy fix for now by changing the code to: 21 // Stop here and set values 22 printf ("Val - %d Mine - %d, %d, %llu. Ptr - %d, %d, %llu\n", val, 23 mine.first_val, mine.second_val, mine.third_val, 24 ptr->first_val, ptr->second_val, ptr->third_val); Now we get a line table entry for line 22 that is before any locals are read from the stack into registers. I need to follow up with the compiler guys and see if we can get a fix for this as anyone setting file + line breeakpoints might be very surprised to have code from lines below the current line already have had their code run. llvm-svn: 232068
* XFAIL tests that are known to fail occasionally on LinuxVince Harron2015-03-051-0/+1
| | | | | | | | Trying to get the build green so we can notice new failures easier. Differential Revision: http://reviews.llvm.org/D8039 llvm-svn: 231407
* Add decorator for intermittently failing test on FreeBSDEd Maste2014-11-171-0/+1
| | | | | | | | | | This test has intermittently failed on FreeBSD for quite some time when run as part of the full test suite. It generally passes when run by itself. Mark as expected failure for now to reduce buildbot noise. llvm.org/pr15039 test fails intermittently on FreeBSD llvm-svn: 222134
* Correctly set the working directory when launching processes for both local ↵Greg Clayton2013-12-133-3/+3
| | | | | | and remote targets. llvm-svn: 197266
* Massive test suite cleanup to stop everyone from manually having to compute ↵Greg Clayton2013-12-103-3/+3
| | | | | | | | | | "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
* Clean up linux test decorators and add links to known bugsDaniel Malea2013-05-151-1/+1
| | | | | | | | | - s/skipOnLinux/skipIfLinux/ to match style of every other decorator - linkify bugizilla/PR numbers in comments No intended change in functionality. llvm-svn: 181913
* skip randomly failing test to avoid buildbot noiseDaniel Malea2013-04-261-1/+1
| | | | llvm-svn: 180636
* Mark TestChangeValueAPI.py as expected fail with gcc as it still reproduces.Matt Kopec2013-03-191-0/+1
| | | | llvm-svn: 177447
* Fixed incorrect python that was trying to validate that we got a valid ↵Greg Clayton2013-03-193-4/+4
| | | | | | | | lldb.SBThread object by checking to see if it is equal to "None". This test is incorrect as functions that return lldb.SBThread objects never return None, they just return lldb.SBThread objects that contain invalid opaque classes. llvm-svn: 177416
* Rework TestChangedValueAPI.py to account for gcc setting multiple breakpoints.Matt Kopec2013-03-152-3/+16
| | | | llvm-svn: 177198
* Minor test runner improvemenstDaniel Malea2013-02-191-0/+1
| | | | | | | | - rework the way SBDebugger.SetAsync() is used to avoid side effects (reset original value at TearDownHook) - refactor expectedFailureClang (and add expectedFailureGcc decorator) - mark TestChangeValueAPI.py as expectedFailureGcc due to PR-15039 llvm-svn: 175523
* Linux test case cleanup:Daniel Malea2013-02-151-1/+0
| | | | | | | | | - Enable TestFormatters.py: expressions with "new" work - Enable TestChangeValueAPI.py: llvm.org/PR15039 fixed - Disable expression_command/call-restarts due to llvm.org/PR15278 - Disable expression_command/call-throws due to ObjC test program llvm-svn: 175287
* Marking test cases with @expectedFailureLinux as per recently opened bugsDaniel Malea2013-01-241-0/+1
| | | | | | | | | - PR 15038: missing wide char support on Linux - PR 14600 - Exception state registers not supported on Linux - PR 15039: SBProcess.GetSTDOUT() returns an empty buffer - PR 15037: stop-hooks sometimes fail to fire on Linux llvm-svn: 173363
* Second batch of adding @dsym_test/@dwarf_test decorators to existing test cases.Johnny Chen2012-04-063-0/+6
| | | | | | | Plus some minor cleanup of test method names. Third and final batch is coming. llvm-svn: 154197
* Work in progress for:Johnny Chen2011-12-201-0/+4
| | | | | | | | | rdar://problem/10577182 Audit lldb API impl for places where we need to perform a NULL check Add a NULL check for SBValue.CreateValueFromExpression(). llvm-svn: 146954
* While we are at it, verify that 'my_int_ptr' points to 'g_my_int', using the ↵Johnny Chen2011-11-151-0/+6
| | | | | | | | SBTarget.ResolveLoadAddress() to get its SBAddress, and SBAddress.GetSymbol() to get the corresponding symbol. llvm-svn: 144728
* Add test scenario for value.GetChildAtIndex(0) where value is a pointer to a ↵Johnny Chen2011-11-152-0/+12
| | | | | | simple type. llvm-svn: 144697
* File renaming.Johnny Chen2011-11-151-0/+0
| | | | llvm-svn: 144693
* Re-enable the test for ValueAsUnsigned on a register Value.Jim Ingham2011-08-161-5/+3
| | | | llvm-svn: 137738
* Test case for changing ValueObjects with SBValue::SetValueFromCString.Jim Ingham2011-08-133-0/+181
| | | | llvm-svn: 137543
* Add logic to SBValue.linked_list_iter() to detect infinite loop and to bail ↵Johnny Chen2011-08-112-0/+21
| | | | | | | | | | | | out early. Add code to test case to create an evil linked list with: task_evil -> task_2 -> task_3 -> task_evil ... and to check that the linked list iterator only iterates 3 times. llvm-svn: 137291
* Change the SBValue.linked_list_iter() to treat the value object as a ↵Johnny Chen2011-08-111-3/+3
| | | | | | | | | | | | | homogeneous linked list data structure where an empty linked list is represented as a value object with a NULL value, instead of a special value object which 'points' to NULL. Also modifies the test case to comply. rdar://problem/9933692 llvm-svn: 137289
* The SBValue.linked_list_iter() API failed for an empty list.Johnny Chen2011-07-272-2/+24
| | | | | | Fix the bug and add a test case. llvm-svn: 136265
* We can do better with the SBValue.linked_list_iter() API by supplying a defaultJohnny Chen2011-07-261-10/+26
| | | | | | | | | | | | | | end of list test function as __eol_test__. The simple example can be reduced to: for t in task_head.linked_list_iter('next'): print t Modify the test program to exercise the API for both cases: supplying or not supplying an end of list test function. llvm-svn: 136144
* The test function to determine whether we have reached the end of the list wasJohnny Chen2011-07-261-17/+12
| | | | | | | | | | | too complex in the test case. We can just simply test that the SBValue object is a valid object and it does not correspond to a null pointer in order to say that EOL has not been reached. Modify the test case and the lldb.py docstring to have a more compact test function. llvm-svn: 136123
* Add a stronger assert for the test to ensure that the visited items from ↵Johnny Chen2011-07-251-0/+9
| | | | | | | | iterating through the SBValue.linked_list_iter() API is equal to [1, 2, 4, 5]. llvm-svn: 135944
* Provide an add-on API to SBValue class by post-processing to provide a wayJohnny Chen2011-07-253-0/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to iterate through an SBValue instance by treating it as the head of a linked list. API program must provide two args to the linked_list_iter() method: the first being the child member name which points to the next item on the list and the second being a Python function which an SBValue (for the next item) and returns True if end of list is reached, otherwise it returns False. For example, suppose we have the following sample program. #include <stdio.h> class Task { public: int id; Task *next; Task(int i, Task *n): id(i), next(n) {} }; int main (int argc, char const *argv[]) { Task *task_head = new Task(-1, NULL); Task *task1 = new Task(1, NULL); Task *task2 = new Task(2, NULL); Task *task3 = new Task(3, NULL); // Orphaned. Task *task4 = new Task(4, NULL); Task *task5 = new Task(5, NULL); task_head->next = task1; task1->next = task2; task2->next = task4; task4->next = task5; int total = 0; // Break at this line Task *t = task_head; while (t != NULL) { if (t->id >= 0) ++total; t = t->next; } printf("We have a total number of %d tasks\n", total); return 0; } The test program produces the following output while exercising the linked_list_iter() SBVAlue API: task_head: TypeName -> Task * ByteSize -> 8 NumChildren -> 2 Value -> 0x0000000106400380 ValueType -> local_variable Summary -> None IsPointerType -> True Location -> 0x00007fff65f06e60 (Task *) next = 0x0000000106400390 (int) id = 1 (Task *) next = 0x00000001064003a0 (Task *) next = 0x00000001064003a0 (int) id = 2 (Task *) next = 0x00000001064003c0 (Task *) next = 0x00000001064003c0 (int) id = 4 (Task *) next = 0x00000001064003d0 (Task *) next = 0x00000001064003d0 (int) id = 5 (Task *) next = 0x0000000000000000 llvm-svn: 135938
* Add an additional formatter class RecursiveDecentFormatter which prints theJohnny Chen2011-07-222-1/+26
| | | | | | | | | | | | | | | | | value and the decendents. For an example, rdf = lldbutil.RecursiveDecentFormatter(indent_child=2) print rdf.format(g_table) produces: (const char **[2]) g_table = 0x00000001055a80f0 (location) (const char **) [0] = 0x00000001055a8080 (const char *) *[0] = "Sunday" (const char **) [1] = 0x00000001055a80c0 (const char *) *[1] = "Monday" llvm-svn: 135815
* Add BasicFormatter and ChildVisitingFormatter utility classes to the ↵Johnny Chen2011-07-222-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | lldbutil.py module which provide some convenient ways to print an SBValue object. Use that in TestValueAPI.py to print the 'days_of_week' char* array variable. For an example: cvf = lldbutil.ChildVisitingFormatter(indent=2) print cvf.format(days_of_week) produces: (const char *[7]) days_of_week = 0x00000001026a5060 (location) (const char *) [0] = "Sunday" (const char *) [1] = "Monday" (const char *) [2] = "Tuesday" (const char *) [3] = "Wednesday" (const char *) [4] = "Thursday" (const char *) [5] = "Friday" (const char *) [6] = "Saturday" llvm-svn: 135736
* Add test scenario of SBValue APIs for the 'days_of_week' global variable.Johnny Chen2011-07-211-0/+7
| | | | llvm-svn: 135716
* Add test scenario for exercising SBValue API: TypeIsPointerType() and ↵Johnny Chen2011-07-211-0/+10
| | | | | | GetByteSize(). llvm-svn: 135699
* Add TestValueAPI.py to exercise the newly added/modified SBValue APIs:Johnny Chen2011-07-153-0/+122
o GetChildAtIndex, and o GetValueForExpressionPath llvm-svn: 135315
OpenPOWER on IntegriCloud