diff options
author | Enrico Granata <egranata@apple.com> | 2013-07-11 21:49:38 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2013-07-11 21:49:38 +0000 |
commit | da504ff00a6cf2e33260f1faa58381559b50a645 (patch) | |
tree | f9f8becf25eca0ce313bb0b9c2614eb10984682f /lldb/examples | |
parent | b1c7b58424a0a47a85e6a110859bd9fa1cb8a5c0 (diff) | |
download | bcm5719-llvm-da504ff00a6cf2e33260f1faa58381559b50a645.tar.gz bcm5719-llvm-da504ff00a6cf2e33260f1faa58381559b50a645.zip |
Tweaks to the Python reference and example command to use the preferred print style and the (finally available :-) SetError API
llvm-svn: 186122
Diffstat (limited to 'lldb/examples')
-rw-r--r-- | lldb/examples/python/cmdtemplate.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lldb/examples/python/cmdtemplate.py b/lldb/examples/python/cmdtemplate.py index 11187b8d981..ca575362f9b 100644 --- a/lldb/examples/python/cmdtemplate.py +++ b/lldb/examples/python/cmdtemplate.py @@ -38,8 +38,8 @@ def the_framestats_command(debugger, command, result, dict): except: # if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit # (courtesy of OptParse dealing with argument errors by throwing SystemExit) - result.SetStatus (lldb.eReturnStatusFailed) - return "option parsing failed" # returning a string is the same as returning an error whose description is the string + result.SetError ("option parsing failed") + return # in a command - the lldb.* convenience variables are not to be used # and their values (if any) are undefined @@ -54,7 +54,7 @@ def the_framestats_command(debugger, command, result, dict): variables_list = frame.GetVariables(options.arguments, options.locals, options.statics, options.inscope) variables_count = variables_list.GetSize() if variables_count == 0: - result.PutCString("no variables here") + print >> result, "no variables here" return total_size = 0 for i in range(0,variables_count): @@ -62,8 +62,8 @@ def the_framestats_command(debugger, command, result, dict): variable_type = variable.GetType() total_size = total_size + variable_type.GetByteSize() average_size = float(total_size) / variables_count - result.PutCString("Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (variables_count,total_size,average_size)) - # not returning anything is askin to returning success + print >>result, "Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (variables_count,total_size,average_size) + # not returning anything is akin to returning success def __lldb_init_module (debugger, dict): # This initializer is being run from LLDB in the embedded command interpreter |