summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:26:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:26:05 +0000
commit14f1b3e8826ce43b978db93a62d1166055db5394 (patch)
tree0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
parent4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py58
1 files changed, 43 insertions, 15 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py b/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
index 4b1880dee96fc..937ac92700193 100644
--- a/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
+++ b/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
@@ -3,13 +3,13 @@
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConvenienceVariablesCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,9 +20,11 @@ class ConvenienceVariablesCase(TestBase):
# Find the line number to break on inside main.cpp.
self.line = line_number('main.c', 'Hello world.')
- @skipIfFreeBSD # llvm.org/pr17228
+ @skipIfFreeBSD # llvm.org/pr17228
@skipIfRemote
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
def test_with_run_commands(self):
"""Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame."""
self.build()
@@ -32,7 +34,9 @@ class ConvenienceVariablesCase(TestBase):
python_prompt = ">>> "
# So that the child gets torn down after the test.
- self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
+ self.child = pexpect.spawn(
+ '%s %s %s' %
+ (lldbtest_config.lldbExec, self.lldbOption, exe))
child = self.child
# Turn on logging for what the child sends back.
if self.TraceOn():
@@ -56,25 +60,49 @@ class ConvenienceVariablesCase(TestBase):
child.sendline('print(lldb.debugger)')
child.expect_exact(python_prompt)
self.expect(child.before, exe=False,
- patterns = ['Debugger \(instance: .*, id: \d\)'])
+ patterns=['Debugger \(instance: .*, id: \d\)'])
child.sendline('print(lldb.target)')
child.expect_exact(python_prompt)
self.expect(child.before, exe=False,
- substrs = ['a.out'])
+ substrs=['a.out'])
child.sendline('print(lldb.process)')
child.expect_exact(python_prompt)
- self.expect(child.before, exe=False,
- patterns = ['SBProcess: pid = \d+, state = stopped, threads = \d, executable = a.out'])
+ self.expect(child.before, exe=False, patterns=[
+ 'SBProcess: pid = \d+, state = stopped, threads = \d, executable = a.out'])
- child.sendline('print(lldb.thread)')
+ child.sendline('print(lldb.thread.GetStopDescription(100))')
child.expect_exact(python_prompt)
- # Linux outputs decimal tid and 'name' instead of 'queue'
- self.expect(child.before, exe=False,
- patterns = ['thread #1: tid = (0x[0-9a-f]+|[0-9]+), 0x[0-9a-f]+ a\.out`main\(argc=1, argv=0x[0-9a-f]+\) \+ \d+ at main\.c:%d, (name|queue) = \'.+\', stop reason = breakpoint 1\.1' % self.line])
+ self.expect(
+ child.before,
+ exe=False,
+ patterns=[
+ 'breakpoint 1\.1'])
- child.sendline('print(lldb.frame)')
+ child.sendline('lldb.frame.GetLineEntry().GetLine()')
child.expect_exact(python_prompt)
- self.expect(child.before, exe=False,
- patterns = ['frame #0: 0x[0-9a-f]+ a\.out`main\(argc=1, argv=0x[0-9a-f]+\) \+ \d+ at main\.c:%d' % self.line])
+ line_number = "%d"%(self.line)
+ self.expect(
+ child.before,
+ exe=False,
+ substrs=[
+ line_number])
+
+ child.sendline('lldb.frame.GetLineEntry().GetFileSpec().GetFilename()')
+ child.expect_exact(python_prompt)
+ line_number = "%d"%(self.line)
+ self.expect(
+ child.before,
+ exe=False,
+ substrs=[
+ "main.c"])
+
+ child.sendline('lldb.frame.GetFunctionName()')
+ child.expect_exact(python_prompt)
+ line_number = "%d"%(self.line)
+ self.expect(
+ child.before,
+ exe=False,
+ substrs=[
+ "main"])