Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# perf script event handlers, generated by perf script -g python
# Licensed under the terms of the GNU GPL License version 2
# The common_* event handler fields are the most useful fields common to
# all events. They don't necessarily correspond to the 'common_*' fields
# in the format files. Those fields not available as handler params can
# be retrieved using Python functions of the form common_*(context).
# See the perf-script-python Documentation for the list of available functions.
# TODO: handlers for filters + postordinate parser fails to get named
from __future__ import print_function
import os
import sys
sys.path.append(os.environ['PERF_EXEC_PATH'] + \
'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
from perf_trace_context import *
from Core import *
from collections import defaultdict
# NOTE: Parsers are uniquely identified by their address in memory
# The memory use is further split up along different arenas
class Parser:
#TODO: remove
_parser_names = {}
def __init__(self, name, address):
self.name = name
self.address = address
self.bytes_used = {}
def name_parser(self, name):
#if self.address not in Parser._parser_names:
# Parser._parser_names[self.address] = name
self.name = name
def get_name_or_placeholder(self):
if self.name is None:
return "Wait for it... (if you're reading this, you found a bug)"
else:
return self.name
def add_mem_use(self, state, size):
if bytes_used.setdefault(state, None) is None:
bytes_used[state] = size
else:
bytes_used[state] += size
def get_mem_use(self, state=None):
if state is None:
return bytes_used
else:
return bytes_used.setdefault(state, 0)
class ParserStack:
def __init__(self, parse_state, arena):
self.parse_state = parse_state
self.arena = arena
self.p_stack = []
def push(self, parser):
self.p_stack.append(parser)
def pop(self):
return self.p_stack.pop()
def peek(self):
return self.p_stack[-1]
def set_state(self, state):
self.parse_state = state
# Shortcut for setting the name property of the parser on the top of stack
# In terms of tracing, *most* calls to a parser look something like this with the packrat backend:
# h_do_parse()
# parse_foo()
# perform_lowlevel_parse()
# perform_lowlevel_parse() is called when the memo table at that position is not filled in yet.
# it calls the corresponding parse_* virtual function via the vtable, but other than that does not have type information
# it's probably possible to extract type information, by comparing vtable addresses, but that seems painful
# parse_foo() is the parser's corresponding virtual function in the frontend, which does not have the equivalent of a "this" pointer
# So what we do to keep track of parsers is incrementally filling in the details for both
# h_do_parse() is the backend's "actually run the parser" function, but does not get called for some parsers
# (my intuition says that it gets called only for higher-order parsers)
# also contains the decision logic about whether to call perform_lowlevel_parse()
# possible scenarios:
# h_do_parse()
# perform_lowlevel_parse()
# parse_foo()
# h_do_parse()
# perform_lowlevel_parse()
# h_do_parse()
def name_top_parser(self, name):
self.p_stack[-1].name_parser(name)
def add_mem_use_each(self, size):
for p in self.p_stack:
p.bytes_used += size
def add_mem_use_top(self, size):
self.p_stack[-1].bytes_used += size
def show_stack(self):
print("stack would be printed here. Depth:", len(self.p_stack))
#print([(p.get_name_or_placeholder(), hex(p.address)) for p in self.p_stack])
def depth(self):
return len(self.p_stack)
#parserStack = ParserStack(0,0)
# Class that is responsible for bookkeeping throughout the entire parse
# NB, this is slightly different terminology than the hammer API implicitly uses:
# There, a parse is started by h_parse(), and it is associated with a parse state.
# This corresponds to the ParserStack above.
# Subsequent h_do_parse()s with the same parser state belong to the same parse
# The TopLevelParse class is initialized in trace_begin(), and is used until the end of the trace
class TopLevelParse:
def __init__(self):
self.parser_stacks = []
self.parser_objs = {}
# Called from h_packrat_parse()'s handler, where the parse state and arena get initialized
def enter_h_packrat_parse(self, parser):
# TODO: add a parser stack or something?
parser_stack = ParserStack(None, None)
self.parser_stacks.append(parser_stack)
return 0
def enter_h_do_parse(self, parse_state, arena, parser):
parser_stack = self.peek_parserstack()
if parser_stack.parse_state is None and parser_stack.parse_state != parse_state:
self.first_h_do_parse_after_packrat_parse(parse_state, arena)
# Called from h_do_parse()'s handler, at which point we know the addresses of the state and arena
def first_h_do_parse_after_packrat_parse(self, parse_state, arena):
parser_stack = self.peek_parserstack()
parser_stack.set_state(parse_state)
# Popping the stack of stack of parsers
def return_from_h_packrat_parse(self):
old_stack = self.parser_stacks.pop()
if old_stack.depth() > 0:
print("Warning: parser stack not empty but parse is successful?")
# TODO: capture the return value in the probe, so we can tell if the parse was successful
# Memoize the parser object for this particular address, then push it on the stack
# Returns the parser object we just initalized (or the one already existing)
def enter_perform_lowlevel_parse(self, parser_addr):
try:
parser_obj = self.parser_objs[parser_addr]
except KeyError:
# Create a parser object with no name and the address of the parser
parser_obj = Parser(None, parser_addr)
self.parser_objs[parser_addr] = parser_obj
parser_stack = self.peek_parserstack()
parser_stack.push(parser_obj)
return parser_obj
def return_from_perform_lowlevel_parse(self):
parser_stack = self.peek_parserstack()
parser_obj = parser_stack.pop()
# debug print here
def parse_virtual(self, parser_name):
parser_obj = self.peek_parser()
if parser_obj.name and parser_obj.name != parser_name:
print("Warning: parser already named! This is a bug. old name: %s, new name: %s" % (parser_obj.name, parser_name))
parser_obj.name_parser(parser_name)
def peek_parserstack(self):
# TODO: handle empty stack
return self.parser_stacks[-1]
def peek_parser(self):
return self.parser_stacks[-1].peek()
#TODO: refactor memory use code into TopLevelParse, as well as using the Parser objects to hold memory use
mem_use = {}
top_level_parse = TopLevelParse()
def get_mem_use(parser, arena):
global mem_use
return mem_use[parser].setdefault(arena, 0)
def add_mem_use(parser, arena, size):
global mem_use
try:
mem_use[parser].setdefault(arena, 0)
mem_use[parser][arena] += size
except KeyError as e:
#print("parser: ")
#print(parser)
#print("arena: ")
#print(arena)
#print("size: ")
#print(size)
return
def trace_begin():
global mem_use
print("in trace_begin")
mem_use = defaultdict(dict)
def trace_end():
global mem_use
global parserObjs
print("in trace_end")
#print(mem_use)
#print(mem_use.items())
#for k,v in parserObjs.items():
# print("Address: %x, Parser: " % k, v)
'''for parser,stats in mem_use.items():
print("Parser:")
if parser != None:
print(parsers[parser])
print("Stats:")
print(stats)'''
def probe_pdf__init_parser(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, pdf, tail, xr_td,
dict_p, dict_, dopen, body, header,
objdef, indobj, obj, array, array_,
lbrack, rbrack, elemd, elemd_, elemr,
elemr_, robj, dobj, name, npair,
string, hexstr, rangle, langle, litstr,
stream, xrstm, xstream, xrefs, xrsub,
xrhead, xrent, xrgen, xroff, a85string,
ahexstream, k_v, perf_sample_dict):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, pdf=%u, tail=%u, " \
"xr_td=%u, dict=%u, dict_=%u, " \
"dopen=%u, body=%u, header=%u, " \
"objdef=%u, indobj=%u, obj=%u, " \
"array=%u, array_=%u, lbrack=%u, " \
"rbrack=%u, elemd=%u, elemd_=%u, " \
"elemr=%u, elemr_=%u, robj=%u, " \
"dobj=%u, name=%u, npair=%u, " \
"string=%u, hexstr=%u, rangle=%u, " \
"langle=%u, litstr=%u, stream=%u, " \
"xrstm=%u, xstream=%u, xrefs=%u, " \
"xrsub=%u, xrhead=%u, xrent=%u, " \
"xrgen=%u, xroff=%u, a85string=%u, " \
"ahexstream=%u" % \
(__probe_ip, pdf, tail, xr_td,
dict_p, dict_, dopen, body, header,
objdef, indobj, obj, array, array_,
lbrack, rbrack, elemd, elemd_, elemr,
elemr_, robj, dobj, name, npair,
string, hexstr, rangle, langle, litstr,
stream, xrstm, xstream, xrefs, xrsub,
xrhead, xrent, xrgen, xroff, a85string,
ahexstream))
top_level_parse.parser_objs[pdf] = Parser('pdf', pdf)
top_level_parse.parser_objs[tail] = Parser('tail', tail)
top_level_parse.parser_objs[xr_td] = Parser('xr_td', xr_td)
top_level_parse.parser_objs[dict_p] = Parser('dict', dict_p)
top_level_parse.parser_objs[dict_] = Parser('dict_', dict_)
top_level_parse.parser_objs[dopen] = Parser('dopen', dopen)
top_level_parse.parser_objs[body] = Parser('body', body)
top_level_parse.parser_objs[header] = Parser('header', header)
top_level_parse.parser_objs[objdef] = Parser('objdef', objdef)
top_level_parse.parser_objs[indobj] = Parser('indobj', indobj)
top_level_parse.parser_objs[obj] = Parser('obj', obj)
top_level_parse.parser_objs[array] = Parser('array', array)
top_level_parse.parser_objs[array_] = Parser('array_', array_)
top_level_parse.parser_objs[lbrack] = Parser('lbrack', lbrack)
top_level_parse.parser_objs[elemd] = Parser('elemd', elemd)
top_level_parse.parser_objs[elemd_] = Parser('elemd_', elemd_)
top_level_parse.parser_objs[elemr] = Parser('elemr', elemr)
top_level_parse.parser_objs[elemr_] = Parser('elemr_', elemr_)
top_level_parse.parser_objs[robj] = Parser('robj', robj)
top_level_parse.parser_objs[dobj] = Parser('dobj', dobj)
top_level_parse.parser_objs[name] = Parser('name', name)
top_level_parse.parser_objs[npair] = Parser('npair', npair)
top_level_parse.parser_objs[string] = Parser('string', string)
top_level_parse.parser_objs[hexstr] = Parser('hexstr', hexstr)
top_level_parse.parser_objs[rangle] = Parser('rangle', rangle)
top_level_parse.parser_objs[langle] = Parser('langle', langle)
top_level_parse.parser_objs[litstr] = Parser('litstr', litstr)
top_level_parse.parser_objs[stream] = Parser('stream', stream)
top_level_parse.parser_objs[xrstm] = Parser('xrstm', xrstm)
top_level_parse.parser_objs[xstream] = Parser('xstream', xstream)
top_level_parse.parser_objs[xrefs] = Parser('xrefs', xrefs)
top_level_parse.parser_objs[xrsub] = Parser('xrsub', xrsub)
top_level_parse.parser_objs[xrhead] = Parser('stream', stream)
top_level_parse.parser_objs[xrent] = Parser('xrent', xrent)
top_level_parse.parser_objs[xrgen] = Parser('xrgen', xrgen)
top_level_parse.parser_objs[xroff] = Parser('xroff', xroff)
top_level_parse.parser_objs[a85string] = Parser('a85string', a85string)
top_level_parse.parser_objs[ahexstream] = Parser('ahexstream', ahexstream)
top_level_parse.parser_objs[k_v] = Parser('k_v', k_v)
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
print()
def probe_libhammer__h_do_parse(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, parser, state, arena,
perf_sample_dict):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
top_level_parse.enter_h_do_parse(state, arena, parser)
try:
parsername = top_level_parse.parser_objs[parser].name
except KeyError:
parsername = "unknown"
print("__probe_ip=%u, parser=%s (%u), state=%u, " \
"arena=%u" % \
(__probe_ip, parsername, parser, state, arena))
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
print()
def probe_libhammer__h_do_parse__return(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_func, __probe_ret_ip, parser, state, retval,
perf_sample_dict):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_func=%u, __probe_ret_ip=%u, parser=%u, " \
"state=%u, retval=%u" % \
(__probe_func, __probe_ret_ip, parser, state, retval))
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
print()
def probe_libhammer__h_arena_malloc_raw(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, arena, size, need_zero,
perf_sample_dict):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, arena=%u, size=%u, " \
"need_zero=%u" % \
(__probe_ip, arena, size, need_zero))
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
#for node in common_callchain:
# if 'sym' in node:
# print("\t[%x] %s" % (node['ip'], node['sym']['name']))
# else:
# print(" [%x]" % (node['ip']))
#print()
#add_mem_use(top_level_parse.peek_parser(), arena, size)
return
def probe_libhammer__parse_choice(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, s,
i, p_array, perf_sample_dict):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"s=%u, i=%u, p_array=%u" % \
(__probe_ip, env, state, s,
i, p_array))
top_level_parse.parse_virtual("(Unnamed choice)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_sequence(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, s,
p_array, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"s=%u, p_array=%u" % \
(__probe_ip, env, state, s,
p_array))
top_level_parse.parse_virtual("(Unnamed sequence)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_difference(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, parsers,
p1, p2, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"parsers=%u, p1=%u, p2=%u" % \
(__probe_ip, env, state, parsers,
p1, p2))
top_level_parse.parse_virtual("(Unnamed difference)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_action(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, a,
p, action, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"a=%u, p=%u, action=%u" % \
(__probe_ip, env, state, a,
p, action))
top_level_parse.parse_virtual("(Unnamed action)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_and(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed and)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_attr_bool(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed attr_bool)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_bind(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, be_, state, p,
k, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, be_=%u, state=%u, " \
"p=%u, k=%u" % \
(__probe_ip, be_, state, p,
k))
top_level_parse.parse_virtual("(Unnamed bind/h_indirect)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_bits(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed bits)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_butnot(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, parsers,
p1, p2, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"parsers=%u, p1=%u, p2=%u" % \
(__probe_ip, env, state, parsers,
p1, p2))
top_level_parse.parse_virtual("(Unnamed butnot)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_charset(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed charset (%x))" % env)
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_ch(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, c,
perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"c=%u" % \
(__probe_ip, env, state, c))
top_level_parse.parse_virtual("(Unnamed ch (%s))" % c)
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_end(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed end)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_endianness(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, endianness,
perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"endianness=%d" % \
(__probe_ip, env, state, endianness))
top_level_parse.parse_virtual("(Unnamed endianness)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_epsilon(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed epsilon)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_ignore(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed ignore)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_ignoreseq(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed ignoreseq)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_indirect(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed indirect)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_int_range(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, p,
lower, upper, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"p=%u, lower=%d, upper=%d" % \
(__probe_ip, env, state, p,
lower, upper))
top_level_parse.parse_virtual("(Unnamed int_range (%u %u))" % (lower,upper))
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_many(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, env_,
p, sep, count, perf_sample_dict):
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"env_=%u, p=%u, sep=%u, " \
"count=%u" % \
(__probe_ip, env, state, env_,
p, sep, count))
top_level_parse.parse_virtual("(Unnamed many)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_not(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed not)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_nothing(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, x, y, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, x=%u, y=%u" % \
(__probe_ip, x, y))
top_level_parse.parse_virtual("(Unnamed nothing)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_optional(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u" % \
(__probe_ip, env, state))
top_level_parse.parse_virtual("(Unnamed optional)")
new_parser = top_level_parse.peek_parser()
top_level_parse.peek_parserstack().show_stack()
#print('Sample: {'+get_dict_as_string(perf_sample_dict['sample'], ', ')+'}')
for node in common_callchain:
if 'sym' in node:
print("\t[%x] %s" % (node['ip'], node['sym']['name']))
else:
print(" [%x]" % (node['ip']))
#print()
def probe_libhammer__parse_permutation(event_name, context, common_cpu,
common_secs, common_nsecs, common_pid, common_comm,
common_callchain, __probe_ip, env, state, s,
s_len, p_array, perf_sample_dict):
print()
print_header(event_name, common_cpu, common_secs, common_nsecs,
common_pid, common_comm)
print("__probe_ip=%u, env=%u, state=%u, " \
"s=%u, s_len=%u, p_array=%u" % \
(__probe_ip, env, state, s,