Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lldb/test/API/lang/swift/command_memory_find/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SWIFT_SOURCES := main.swift

include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Test that running Swift expressions in the
`memory find` command works.
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil


class TestSwiftCommandMemoryFind(TestBase):
def memory_find(self, name: str, expr: str, target):
var = target.FindGlobalVariables(name, 1)
self.assertEqual(len(var), 1)
addr = var[0].AddressOf()
self.assertTrue(addr)
addr = addr.GetValueAsUnsigned()
self.expect(f'memory find -e "{expr}" {hex(addr)} {hex(addr + 8)}',
substrs=["data found at location"])

@swiftTest
def test(self):
self.build()
target, _, _, _ = lldbutil.run_to_source_breakpoint(
self, 'Break', lldb.SBFileSpec('main.swift'))

self.memory_find('elem1', 'elem1', target)
self.memory_find('elem1', '130 + 7', target)

self.memory_find('elem2', 'elem2', target)
self.memory_find('elem2', '-42', target)
3 changes: 3 additions & 0 deletions lldb/test/API/lang/swift/command_memory_find/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let elem1: Int32 = 137
let elem2: Int64 = -42
print ("Break")