5 @lldb_type_summary(['atm_value', 'atm_value_t'])
6 @header("{0: <20s} {1: <16s} {2: <20s} {3: <16s}".format("atm_value", "aid", "voucher_value", "sync"))
7 def GetATMValueSummary(atm_value
):
8 """ Summarizes the atm_value
9 params: atm_value = value object of type atm_value_t
10 returns: string with the summary of the type.
12 format_str
= "{0: <#020x} {1: <16d} {2: <#020x} {3: <16d}"
13 out_string
= format_str
.format(atm_value
, unsigned(atm_value
.aid
), atm_value
, atm_value
.sync
)
17 @lldb_type_summary(['atm_task_descriptor', 'atm_task_descriptor_t'])
18 @header("{0: <20s} {1: <20s} {2: <16s} {3: <16s} {4: <10s}".format("task_descriptor", "trace_buffer", "buffer_size", "refcount", "flags"))
19 def GetATMTaskDescriptorSummary(descriptor
):
20 """ Summarizes atm_task_descriptor object
21 params: descriptor - value object of type atm_task_descriptor_t
22 returns: string - containing the description.
24 format_str
= "{0: <#020x} {1: <#020x} {2: <#016x} {3: <16d} {4: <10s}"
26 if unsigned(descriptor
.flags
) & 0x1:
28 out_string
= format_str
.format(descriptor
, descriptor
.trace_buffer
, descriptor
.trace_buffer_size
, descriptor
.reference_count
, flags_str
)
31 if hasattr(descriptor
, 'task'):
32 out_string
+= " " + GetTaskSummary(descriptor
.task
) + " " + GetProcNameForTask(descriptor
.task
)
37 # Macro: showatmvaluelisteners
38 @lldb_command('showatmvaluelisteners')
39 def ShowATMValueListeners(cmd_args
=None, cmd_options
={}):
40 """ show a list of listeners for an atm_value object.
41 Usage: (lldb)showatmvaluelisteners <atm_value_t>
44 raise ArgumentError("Please provide arguments")
46 atm_val
= kern
.GetValueFromAddress(cmd_args
[0], 'atm_value_t')
47 print GetATMValueSummary
.header
48 print GetATMValueSummary(atm_val
)
49 header_str
= "{0: <20s} ".format("#guard") + GetATMTaskDescriptorSummary
.header
51 header_str
+= " " + GetTaskSummary
.header
+ " procname"
54 for listener
in IterateQueue(atm_val
.listeners
, 'atm_link_object_t', 'listeners_element'):
55 listener_summary
= "{0: <#020x}".format(listener
.guard
)
56 listener_summary
+= " " + GetATMTaskDescriptorSummary(listener
.descriptor
)
57 print listener_summary
59 # EndMacro: showatmvaluelisteners
64 # Macro: showallatmallocatedvalueslist
65 @lldb_command('showallatmallocatedvalueslist')
66 def ShowAllATMAllocatedValuesList(cmd_args
=None, cmd_options
={}):
67 """ A DEVELOPMENT macro that walks the list of all allocated atm_value objects
69 usage: (lldb) showallatmallocatedvalueslist
71 if not hasattr(kern
.globals, 'atm_values_list'):
72 print "It seems you are running a build of kernel that does not have the list of all atm_values_list."
74 print GetATMValueSummary
.header
75 for v
in IterateQueue(kern
.globals.atm_values_list
, 'atm_value_t', 'value_elt'):
76 print GetATMValueSummary(v
)
78 # EndMacro: showallatmallocatedvalueslist
80 # Macro: showallatmdescriptors
81 @lldb_command('showallatmdescriptors')
82 def ShowAllATMDescriptors(cmd_args
=None, cmd_options
={}):
83 """ A DEVELOPMENT macro that walks the list of all atm_descriptors_list
84 and prints the summary for each.
85 usage: (lldb) showallatmdescriptors
87 if not hasattr(kern
.globals, 'atm_descriptors_list'):
88 print "It seems you are running a build of kernel that does not have the list of all atm_descriptors_list."
91 print GetATMTaskDescriptorSummary
.header
92 for d
in IterateQueue(kern
.globals.atm_descriptors_list
, 'atm_task_descriptor_t', 'descriptor_elt'):
93 print GetATMTaskDescriptorSummary(d
)