aboutsummaryrefslogtreecommitdiff
path: root/test/lang/c
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-03-06 06:23:54 +0000
committerGreg Clayton <gclayton@apple.com>2013-03-06 06:23:54 +0000
commitd8d97f556ab58fae76d5c677d43a2d621bf039be (patch)
tree4b0a3aa2fd008793f18b317dd1ab94367e8b3d5b /test/lang/c
parent48c6b3354d308f669a29f21db7037bc66317fb75 (diff)
downloadlldb-d8d97f556ab58fae76d5c677d43a2d621bf039be.tar.gz
Fixed enum printing for negative enums. There previously was no testing to validate that enum values were being displayed correctly.
Also added C++11 enum test cases to cover enums as int8_t, int16_t int32_t, int64_t, uint8_t, uint16_t, uint32_t, and uint64_t both for DWARF and dSYM cases. The DWARF being emitted by clang is missing the enum integer type, but the code is now ready to accept and deal with the integral type if it is supplied. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176548 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/lang/c')
-rw-r--r--test/lang/c/enum_types/TestEnumTypes.py25
-rw-r--r--test/lang/c/enum_types/main.c2
2 files changed, 21 insertions, 6 deletions
diff --git a/test/lang/c/enum_types/TestEnumTypes.py b/test/lang/c/enum_types/TestEnumTypes.py
index 725a22b32..e0ec93342 100644
--- a/test/lang/c/enum_types/TestEnumTypes.py
+++ b/test/lang/c/enum_types/TestEnumTypes.py
@@ -13,7 +13,7 @@ class EnumTypesTestCase(TestBase):
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@dsym_test
def test_with_dsym(self):
- """Test 'image lookup -t days' and check for correct display."""
+ """Test 'image lookup -t days' and check for correct display and enum value printing."""
self.buildDsym()
self.image_lookup_for_enum_type()
@@ -21,7 +21,7 @@ class EnumTypesTestCase(TestBase):
# 'image lookup -t days' returns nothing with dwarf debug format.
@dwarf_test
def test_with_dwarf(self):
- """Test 'image lookup -t days' and check for correct display."""
+ """Test 'image lookup -t days' and check for correct display and enum value printing."""
self.buildDwarf()
self.image_lookup_for_enum_type()
@@ -37,7 +37,7 @@ class EnumTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ bkpt_id = lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -54,17 +54,32 @@ class EnumTypesTestCase(TestBase):
# Check for correct display.
self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY,
substrs = ['enum days {',
- 'Monday,',
+ 'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
- 'Sunday,',
+ 'Sunday',
'kNumDays',
'}'])
+ enum_values = [ '-4',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '5'];
+ bkpt = self.target().FindBreakpointByID(bkpt_id)
+ for enum_value in enum_values:
+ self.expect("frame variable day", 'check for valid enumeration value',
+ substrs = [enum_value])
+ lldbutil.continue_to_breakpoint (self.process(), bkpt)
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
diff --git a/test/lang/c/enum_types/main.c b/test/lang/c/enum_types/main.c
index bd66fa08d..3d59654ef 100644
--- a/test/lang/c/enum_types/main.c
+++ b/test/lang/c/enum_types/main.c
@@ -11,7 +11,7 @@
int main (int argc, char const *argv[])
{
enum days {
- Monday = 10,
+ Monday = -3,
Tuesday,
Wednesday,
Thursday,