@@ -109,10 +109,6 @@ class Symbolizer:
109
109
self .__html = False
110
110
self .__last_access_address = None
111
111
self .__last_access_tag = None
112
- self .__tag_dump = []
113
- self .__tag_dump_match_idx = None
114
- self .__matched_stack_uas = False
115
- self .__offsets = []
116
112
117
113
def enable_html (self , enable ):
118
114
self .__html = enable
@@ -315,34 +311,6 @@ class Symbolizer:
315
311
if match :
316
312
self .__last_access_tag = int (match .group (2 ), 16 )
317
313
318
- def process_tag_dump_line (self , line , ignore_tags = False ):
319
- m = re .match (r'.*?(0x[0-9a-f]+):' + '([ ]*[\[ ][0-9a-f][0-9a-f]\]?)' * 16 , line )
320
- if m is None :
321
- return False
322
- addr = m .group (1 )
323
- tags = m .group (* range (2 , 18 ))
324
- fault = [i for i , x in enumerate (tags ) if '[' in x ]
325
- if fault :
326
- self .__tag_dump_match_idx = len (self .__tag_dump ) + fault [0 ]
327
- self .__tag_dump .extend (int (x .strip (' [' ).rstrip ('] ' ), 16 ) for x in tags )
328
- return True
329
-
330
- def finish_tag_dump (self ):
331
- if self .__matched_stack_uas or self .__tag_dump_match_idx is None :
332
- return
333
- for offset , size , local in sorted (self .__offsets , key = lambda x : abs (x [0 ])):
334
- idx = self .__tag_dump_match_idx - offset // 16
335
- if idx < 0 or idx > len (self .__tag_dump ):
336
- continue
337
- if self .__tag_dump [idx ] == self .__last_access_tag :
338
- self .print ('' )
339
- self .print ('Potentially referenced stack object:' )
340
- if offset > 0 :
341
- self .print (' %d bytes after a variable "%s" in stack frame of function "%s"' % (offset - size , local [2 ], local [0 ]))
342
- if offset < 0 :
343
- self .print (' %d bytes before a variable "%s" in stack frame of function "%s"' % (- offset , local [2 ], local [0 ]))
344
- self .print (' at %s' % (local [1 ],))
345
-
346
314
def process_stack_history (self , line , ignore_tags = False ):
347
315
if self .__last_access_address is None or self .__last_access_tag is None :
348
316
return
@@ -368,18 +336,16 @@ class Symbolizer:
368
336
size = local [4 ]
369
337
if frame_offset is None or size is None :
370
338
continue
371
- obj_offset = (self .__last_access_address & fp_mask ) - (fp & fp_mask + frame_offset )
339
+ obj_offset = (self .__last_access_address - fp - frame_offset ) & fp_mask
340
+ if obj_offset >= size :
341
+ continue
372
342
tag_offset = local [5 ]
373
343
if not ignore_tags and (tag_offset is None or base_tag ^ tag_offset != self .__last_access_tag ):
374
344
continue
375
- if obj_offset < 0 or obj_offset >= size :
376
- self .__offsets .append ((obj_offset , size , local ))
377
- continue
378
345
self .print ('' )
379
346
self .print ('Potentially referenced stack object:' )
380
347
self .print (' %d bytes inside a variable "%s" in stack frame of function "%s"' % (obj_offset , local [2 ], local [0 ]))
381
348
self .print (' at %s' % (local [1 ],))
382
- self .__matched_stack_uas = True
383
349
return True
384
350
return False
385
351
@@ -490,18 +456,9 @@ def main():
490
456
sys .exit (1 )
491
457
symbolizer .read_linkify (args .linkify )
492
458
493
- tag_dump = False
494
459
for line in sys .stdin :
495
460
if sys .version_info .major < 3 :
496
461
line = line .decode ('utf-8' )
497
- if tag_dump :
498
- tag_dump = symbolizer .process_tag_dump_line (line )
499
- if tag_dump :
500
- continue
501
- symbolizer .finish_tag_dump ()
502
- if 'Memory tags around the buggy address' in line :
503
- tag_dump = True
504
-
505
462
symbolizer .save_access_address (line )
506
463
if symbolizer .process_stack_history (line , ignore_tags = args .ignore_tags ):
507
464
continue
0 commit comments