Skip to content

Commit 9f9b417

Browse files
authored
Merge pull request swiftlang#14437 from gottesmm/pr-b71f0e1f265a5e9eb05dc7d52f66b5b02dceca44
2 parents 229be6b + 40ef5b1 commit 9f9b417

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

utils/lldbToolBox.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
LLDB Helpers for working with the swift compiler.
3+
4+
Load into LLDB with 'command script import /path/to/lldbToolBox.py'
5+
6+
This will also import LLVM data formatters as well, assuming that llvm is next
7+
to the swift checkout.
8+
"""
9+
10+
import os
11+
12+
REPO_BASE = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir,
13+
os.pardir))
14+
SWIFT_REPO = os.path.join(REPO_BASE, "swift")
15+
LLVM_REPO = os.path.join(REPO_BASE, "llvm")
16+
LLVM_DATAFORMATTER_PATH = os.path.join(LLVM_REPO, "utils",
17+
"lldbDataFormatters.py")
18+
19+
20+
def import_llvm_dataformatters(debugger):
21+
if not os.access(LLVM_DATAFORMATTER_PATH, os.F_OK):
22+
print("WARNING! Could not find LLVM data formatters!")
23+
return
24+
cmd = 'command script import {}'.format(LLVM_DATAFORMATTER_PATH)
25+
debugger.HandleCommand(cmd)
26+
print("Loaded LLVM data formatters.")
27+
28+
29+
def __lldb_init_module(debugger, internal_dict):
30+
import_llvm_dataformatters(debugger)

0 commit comments

Comments
 (0)