Skip to content

Commit aefeb1c

Browse files
Chris Williamsultramiraculous
Chris Williams
authored andcommittedNov 11, 2015
Add eobjc and eswift commands for running expressions from a specific language context
1 parent c9bf942 commit aefeb1c

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
 

‎commands/FBPrintCommands.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def lldbcommands():
3838
FBPrintInSwift(),
3939
FBPrintObjectInObjc(),
4040
FBPrintObjectInSwift(),
41+
FBExpressionInObjc(),
42+
FBExpressionInSwift(),
4143
]
4244

4345
class FBPrintViewHierarchyCommand(fb.FBCommand):
@@ -584,3 +586,45 @@ def args(self):
584586
def run(self, arguments, options):
585587
expression = arguments[0]
586588
lldb.debugger.HandleCommand('expression -O -l Swift -- ' + expression)
589+
590+
class FBExpressionInObjc(fb.FBCommand):
591+
def name(self):
592+
return 'eobjc'
593+
594+
def description(self):
595+
return 'Run expression run in an ObjC++ context. (Shortcut for "expression -l ObjC++" )'
596+
597+
def args(self):
598+
return [
599+
fb.FBCommandArgument(arg='expression', help='ObjC expression to evaluate and print.'),
600+
]
601+
602+
def run(self, arguments, options):
603+
values = arguments[0].split("--", 1)
604+
if len(values) is 2:
605+
(arguments, expression) = arguments
606+
lldb.debugger.HandleCommand('expression -l ObjC++ ' + arguments + " -- " + expression)
607+
else:
608+
expression = arguments[0]
609+
lldb.debugger.HandleCommand('expression -l ObjC++ -- ' + expression)
610+
611+
class FBExpressionInSwift(fb.FBCommand):
612+
def name(self):
613+
return 'eswift'
614+
615+
def description(self):
616+
return 'Run expression run in a Swift context. (Shortcut for "expression -l Swift" )'
617+
618+
def args(self):
619+
return [
620+
fb.FBCommandArgument(arg='expression', help='Swift expression to evaluate and print.'),
621+
]
622+
623+
def run(self, arguments, options):
624+
values = arguments[0].split("--", 1)
625+
if len(values) is 2:
626+
(arguments, expression) = arguments
627+
lldb.debugger.HandleCommand('expression -l Swift ' + arguments + " -- " + expression)
628+
else:
629+
expression = arguments[0]
630+
lldb.debugger.HandleCommand('expression -l Swift -- ' + expression)

0 commit comments

Comments
 (0)
Please sign in to comment.