Skip to content

Commit ae1eb0e

Browse files
committed
Add test
1 parent 776dc6d commit ae1eb0e

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
OBJCXX_SOURCES := main.mm
2+
CXX_SOURCES := lib.cpp
3+
include Makefile.rules
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import lldb
2+
from lldbsuite.test.lldbtest import *
3+
from lldbsuite.test.decorators import *
4+
import lldbsuite.test.lldbutil as lldbutil
5+
6+
7+
class TestCase(TestBase):
8+
def test(self):
9+
self.build()
10+
_, _, thread, _ = lldbutil.run_to_source_breakpoint(
11+
self, "break here", lldb.SBFileSpec("lib.cpp")
12+
)
13+
14+
frame = thread.selected_frame
15+
self.assertEqual(frame.GuessLanguage(), lldb.eLanguageTypeC_plus_plus_11)
16+
self.assertEqual(frame.name, "f()")
17+
self.expect(
18+
"help demangle",
19+
substrs=[
20+
"Demangle a C++ mangled name.",
21+
"Syntax: language cplusplus demangle [<mangled-name> ...]",
22+
],
23+
)
24+
self.expect("demangle _Z1fv", startstr="_Z1fv ---> f()")
25+
26+
# Switch the objc caller.
27+
self.runCmd("up")
28+
frame = thread.selected_frame
29+
self.assertEqual(frame.GuessLanguage(), lldb.eLanguageTypeObjC_plus_plus)
30+
self.assertEqual(frame.name, "main")
31+
self.expect("help demangle", error=True)
32+
self.expect(
33+
"help tagged-pointer",
34+
substrs=[
35+
"Commands for operating on Objective-C tagged pointers.",
36+
"Syntax: class-table <subcommand> [<subcommand-options>]",
37+
],
38+
)
39+
self.expect(
40+
"tagged-pointer info 0",
41+
error=True,
42+
startstr="error: could not convert '0' to a valid address",
43+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <stdio.h>
2+
extern void f();
3+
void f() { puts("break here"); }
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
extern void f();
2+
3+
int main() {
4+
f();
5+
return 0;
6+
}

0 commit comments

Comments
 (0)