summaryrefslogtreecommitdiffstats
path: root/lldb/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/tools/lldb-mi/TestMiData.py28
-rw-r--r--lldb/test/tools/lldb-mi/TestMiExec.py26
-rw-r--r--lldb/test/tools/lldb-mi/main.c2
3 files changed, 43 insertions, 13 deletions
diff --git a/lldb/test/tools/lldb-mi/TestMiData.py b/lldb/test/tools/lldb-mi/TestMiData.py
index 8d59197eca8..d01b1c4dd32 100644
--- a/lldb/test/tools/lldb-mi/TestMiData.py
+++ b/lldb/test/tools/lldb-mi/TestMiData.py
@@ -37,6 +37,34 @@ class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
@lldbmi_test
@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+ def test_lldbmi_data_read_memory_bytes(self):
+ """Test that 'lldb-mi --interpreter' works for -data-read-memory-bytes."""
+
+ self.spawnLldbMi(args = None)
+
+ # Load executable
+ self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+ self.expect("\^done")
+
+ # Run to main
+ self.runCmd("-break-insert -f main")
+ self.expect("\^done,bkpt={number=\"1\"")
+ self.runCmd("-exec-run")
+ self.expect("\^running")
+ self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+ # Get address of s_RawData
+ self.runCmd("-data-evaluate-expression &s_RawData")
+ self.expect("\^done,value=\"0x[0-9a-f]+\"",timeout=1)
+ addr = int(self.child.after.split("\"")[1], 16)
+ size = 5
+
+ # Test -data-read-memory-bytes: try to read data of s_RawData
+ self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
+ self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1234567800\"}\]" % (addr, addr + size))
+
+ @lldbmi_test
+ @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
def test_lldbmi_data_list_register_names(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-names."""
diff --git a/lldb/test/tools/lldb-mi/TestMiExec.py b/lldb/test/tools/lldb-mi/TestMiExec.py
index 0936f40c321..79c32ebee3b 100644
--- a/lldb/test/tools/lldb-mi/TestMiExec.py
+++ b/lldb/test/tools/lldb-mi/TestMiExec.py
@@ -152,22 +152,22 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -exec-next
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
# Test that --thread is optional
self.runCmd("-exec-next --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"25\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
# Test that --frame is optional
self.runCmd("-exec-next --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"29\"")
# Test that both --thread and --frame are optional
self.runCmd("-exec-next --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"29\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"31\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next --thread 0")
@@ -204,23 +204,23 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# Test -exec-next-instruction
self.runCmd("-exec-next-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"22\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
# Test that --thread is optional
self.runCmd("-exec-next-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"22\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
# Test that --frame is optional
self.runCmd("-exec-next-instruction --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"22\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
# Test that both --thread and --frame are optional
self.runCmd("-exec-next-instruction --thread 1")
self.expect("\^running")
# Depending on compiler, it can stop at different line.
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[2-4]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next-instruction --thread 0")
@@ -259,7 +259,7 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
#FIXME: is this supposed to step into printf?
self.runCmd("-exec-step --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
# Test that -exec-step steps into a_MyFunction and back out
# (and that --thread is optional)
@@ -274,10 +274,10 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# -exec-step can keep us in the a_MyFunction for gcc
self.runCmd("-exec-finish --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"24\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"26\"")
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"25\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"27\"")
# Test that -exec-step steps into b_MyFunction
# (and that --frame is optional)
@@ -329,13 +329,13 @@ class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
# instruction
self.runCmd("-exec-step-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[2-4]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
# Test that -exec-step-instruction steps over non branching
# instruction (and that --thread is optional)
self.runCmd("-exec-step-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[2-4]\"")
+ self.expect("\*stopped,reason=\"end-stepping-range\".*main.c\",line=\"2[4-6]\"")
# Test that -exec-step-instruction steps into a_MyFunction
# (and that --frame is optional)
diff --git a/lldb/test/tools/lldb-mi/main.c b/lldb/test/tools/lldb-mi/main.c
index 3398e35a8a8..d8083e01371 100644
--- a/lldb/test/tools/lldb-mi/main.c
+++ b/lldb/test/tools/lldb-mi/main.c
@@ -15,6 +15,8 @@ extern int local_test();
int doloop, dosegfault;
int g_MyVar = 3;
static int s_MyVar = 4;
+//FIXME -data-evaluate-expression/print can't evaluate value of type "static char[]"
+const char s_RawData[] = "\x12\x34\x56\x78"; //FIXME static const char s_RawData[] = "\x12\x34\x56\x78";
int main (int argc, char const *argv[])
{
OpenPOWER on IntegriCloud