-
Notifications
You must be signed in to change notification settings - Fork 800
Add enable&disable breakpoints by rg-expression. #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a21a3ca
ef65202
cb2e255
a8cfd69
80f10d0
8df85b6
c043070
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ def lldbcommands(): | |
| FBMethodBreakpointCommand(), | ||
| FBMemoryWarningCommand(), | ||
| FBFindInstancesCommand(), | ||
| FBMethodBreakpointEnableCommand(), | ||
| FBMethodBreakpointDisableCommand(), | ||
| ] | ||
|
|
||
| class FBWatchInstanceVariableCommand(fb.FBCommand): | ||
|
|
@@ -189,6 +191,58 @@ def run(self, arguments, options): | |
| fb.evaluateEffect('[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)]') | ||
|
|
||
|
|
||
| def switchBreakpointState(expression,on): | ||
| ci = lldb.debugger.GetCommandInterpreter() | ||
| res = lldb.SBCommandReturnObject() | ||
|
|
||
| ci.HandleCommand('br list',res) | ||
| listStr = res.GetOutput() | ||
|
|
||
| br_list = listStr.splitlines() | ||
| expression_pattern = re.compile(r'{}'.format(expression),re.I) | ||
| id_pattern = re.compile(r'^\s*([1-9]\d*)(\.\d+)?',re.I) | ||
|
||
| for br in br_list: | ||
| if expression_pattern.search(br) and id_pattern.search(br): | ||
| id = id_pattern.search(br).group() | ||
| if id: | ||
| print br | ||
| if on: | ||
| lldb.debugger.HandleCommand('br enable {}'.format(id)) | ||
| else: | ||
| lldb.debugger.HandleCommand('br disable {}'.format(id)) | ||
|
|
||
| class FBMethodBreakpointEnableCommand(fb.FBCommand): | ||
| def name(self): | ||
| return 'benable' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lldb has an alias command named |
||
|
|
||
| def description(self): | ||
| return "Enable a set of breakpoints for a relative expression" | ||
|
||
|
|
||
| def args(self): | ||
| return [ | ||
| fb.FBCommandArgument(arg='expression', type='string', help='Expression to enable breakpoint'), | ||
| ] | ||
|
|
||
| def run(self, arguments, options): | ||
| expression = arguments[0] | ||
| switchBreakpointState(expression,True) | ||
|
|
||
| class FBMethodBreakpointDisableCommand(fb.FBCommand): | ||
| def name(self): | ||
| return 'bdisable' | ||
|
|
||
| def description(self): | ||
| return "Disable a set of breakpoints for a relative expression" | ||
|
|
||
| def args(self): | ||
| return [ | ||
| fb.FBCommandArgument(arg='expression', type='string', help='Expression to disable breakpoint'), | ||
| ] | ||
|
|
||
| def run(self, arguments, options): | ||
| expression = arguments[0] | ||
| switchBreakpointState(expression,False) | ||
|
|
||
| class FBFindInstancesCommand(fb.FBCommand): | ||
| def name(self): | ||
| return 'findinstances' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines are no longer used.