1 # A basic Plugin that creates performance reports from zprint output
5 def plugin_init(kernel_target
, config
, lldb_obj
, isConnected
):
6 """ initialize the common data as required by plugin """
8 kern_version
= str(kernel_target
.version
)
10 def plugin_execute(command_name
, result_output
):
11 """ The xnu framework will call this function with output of a command.
12 The options for returning are as follows
13 returns: (status, outstr, further_cmds)
14 status: Boolean - specifying whether plugin execution succeeded(True) or failed. If failed then xnu will stop doing any further work with this command.
15 outstr: str - string output for user to be printed at the prompt
16 further_cmds: [] of str - this holds set of commands to execute at the lldb prompt. Empty array if nothing is required.
22 submitvars
['type']="text"
23 submitvars
['log']=result_output
25 submiturl
= "http://speedtracer.apple.com/trace/analyze?format=xml"
26 encoded_data
= urllib
.urlencode(submitvars
)
27 request
= urllib2
.Request(submiturl
, encoded_data
, {"Accept":"application/xml"}
)
28 response
= urllib2
.urlopen(request
)
30 status
= response
.info()['status']
31 if status
== 201 or status
== '201':
32 outstr
+= "CrashTracer data found at " + response
.info()['location']
33 newurl
= response
.info()['location']
35 webbrowser
.open(newurl
)
38 outstr
+= "unknown response from server \n" + str(response
.info())
41 return (status
, outstr
, further_cmds
)
44 """ A cleanup call from xnu which is a signal to wrap up any open file descriptors etc. """