jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed.
Use the form of the command that gets an SBExecutionContext, then you can avoid having to cache the target at all. ================ Comment at: utils/clangdiag.py:98-100 +def the_diag_command(debugger, command, result, dict): + # Use the Shell Lexer to properly parse up command options just like a + # shell would ---------------- If you use the form of the command function that takes an execution context: def command_function(debugger, command, exe_ctx, result, internal_dict): then you can grab the target from there when the command gets invoked and pass it to your enable & disable funcs. That way you won't have to rely on GetSelectedTarget. That's important, for instance, if you were running a debug session with two targets and you wanted to invoke your command in a breakpoint command of a breakpoint in target A. There's no guarantee when target A hits the breakpoint that A is the currently selected target (it won't get selected till it actually decides to stop.) But when the breakpoint runs its command, it sets the right target, & thread in the execution context that gets passed in. https://reviews.llvm.org/D36347 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits