MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / print_all_fxns

Function print_all_fxns

tools/WCS.py:302–343  ·  view source on GitHub ↗
(call_graph)

Source from the content-addressed store, hash-verified

300
301
302def print_all_fxns(call_graph):
303
304 def print_fxn(row_format, fxn_dict2):
305 unresolved = fxn_dict2['unresolved_calls']
306 stack = str(fxn_dict2['wcs'])
307 if unresolved:
308 unresolved_str = '({})'.format(' ,'.join(unresolved))
309 if stack != 'unbounded':
310 stack = "unbounded:" + stack
311 else:
312 unresolved_str = ''
313
314 print(row_format.format(fxn_dict2['tu'], fxn_dict2['demangledName'], stack, unresolved_str))
315
316 def get_order(val):
317 if val == 'unbounded':
318 return 1
319 else:
320 return -val
321
322 # Loop through every global and local function
323 # and resolve each call, save results in r_calls
324 d_list = []
325 for fxn_dict in call_graph['globals'].values():
326 d_list.append(fxn_dict)
327
328 for l_dict in call_graph['locals'].values():
329 for fxn_dict in l_dict.values():
330 d_list.append(fxn_dict)
331
332 d_list.sort(key=lambda item: get_order(item['wcs']))
333
334 # Calculate table width
335 tu_width = max(max([len(d['tu']) for d in d_list]), 16)
336 name_width = max(max([len(d['name']) for d in d_list]), 13)
337 row_format = "{:<" + str(tu_width + 2) + "} {:<" + str(name_width + 2) + "} {:>14} {:<17}"
338
339 # Print out the table
340 print("")
341 print(row_format.format('Translation Unit', 'Function Name', 'Stack', 'Unresolved Dependencies'))
342 for d in d_list:
343 print_fxn(row_format, d)
344
345
346def find_rtl_ext():

Callers 1

mainFunction · 0.85

Calls 3

print_fxnFunction · 0.85
sortMethod · 0.80
get_orderFunction · 0.70

Tested by

no test coverage detected