-
Notifications
You must be signed in to change notification settings - Fork 791
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 3 commits
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,86 @@ def run(self, arguments, options): | |
| fb.evaluateEffect('[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)]') | ||
|
|
||
|
|
||
| def switchBreakpointState(expression,on): | ||
| ci = lldb.debugger.GetCommandInterpreter() | ||
| res = lldb.SBCommandReturnObject() | ||
|
|
||
| expression_pattern = re.compile(r'{}'.format(expression),re.I) | ||
|
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. This can be |
||
|
|
||
| target = lldb.debugger.GetSelectedTarget() | ||
| for breakpoint in target.breakpoint_iter(): | ||
| for location in breakpoint: | ||
| if expression_pattern.search('{}'.format(location)): | ||
|
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. This also doesn't need the |
||
| print location | ||
|
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. Nice addition 👍 |
||
| location.SetEnabled(on) | ||
|
|
||
| class FBMethodBreakpointEnableCommand(fb.FBCommand): | ||
| def name(self): | ||
| return 'rbenable' | ||
|
|
||
| def description(self): | ||
| return """ | ||
| Enable a set of breakpoints for a regular expression | ||
|
|
||
| Examples: | ||
|
|
||
| #use `rbenable disabled` to switch all breakpoints to `enable` | ||
| benable disabled | ||
|
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. This doesn't appear to be implemented. I don't think it's necessary to implement, since
Contributor
Author
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. since
Contributor
Author
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. when i set breakpoint at this address(
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. What does
Contributor
Author
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. i am sorry.i mean that i want search
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. Do you mean you want
Contributor
Author
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. yes
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. Maybe add special cased input handling. If the user's input expression matches
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. I don't think this should be documented. A builtin command already does this: |
||
|
|
||
| * rbenable ***address*** | ||
| benable 0x0000000104514dfc | ||
|
|
||
| #use `rbenable *filename*` to switch all breakpoints in this file to `enable` | ||
| benable SUNNetService.m | ||
|
|
||
| #use `rbenable ***module(AppName)***` to switch all breakpoints in this module to `enable` | ||
| benable UIKit | ||
| benable Foundation | ||
|
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. This documentation block uses |
||
|
|
||
| """ | ||
|
|
||
| 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 'rbdisable' | ||
|
|
||
| def description(self): | ||
| return """ | ||
| Disable a set of breakpoints for a regular expression | ||
|
|
||
| Examples: | ||
|
|
||
| #use `rbdisable disabled` to switch all breakpoints to `disable` | ||
| rbdisable disabled | ||
|
|
||
| * rbdisable ***address*** | ||
| rbdisable 0x0000000104514dfc | ||
|
|
||
| #use `rbdisable *filename*` to switch all breakpoints in this file to `disable` | ||
| rbdisable SUNNetService.m | ||
|
|
||
| #use `rbdisable ***module(AppName)***` to switch all breakpoints in this module to `disable` | ||
| rbdisable UIKit | ||
| rbdisable Foundation | ||
|
|
||
| """ | ||
| 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.