44# ------------------------------------------------------------------------------
55# The MIT License (MIT)
66#
7- # Copyright (c) 2021-2024 Aarno Labs, LLC
7+ # Copyright (c) 2021-2025 Aarno Labs, LLC
88#
99# Permission is hereby granted, free of charge, to any person obtaining a copy
1010# of this software and associated documentation files (the "Software"), to deal
@@ -384,11 +384,6 @@ def block_analyses(self) -> Mapping[str, BlockRelationalAnalysis]:
384384 trampoline = self .has_trampoline ()
385385 if trampoline is not None :
386386 self .setup_trampoline_analysis (trampoline )
387- else :
388- trampoline_minimal_pair_2_and_3 = self .has_minimal_pair_2_and_3_trampoline ()
389- if trampoline_minimal_pair_2_and_3 is not None :
390- self .setup_minimal_pair_2_and_3_trampoline_analysis (
391- trampoline_minimal_pair_2_and_3 )
392387
393388 return self ._blockanalyses
394389
@@ -408,8 +403,8 @@ def setup_trampoline_analysis(self, b: str) -> None:
408403 tpre [0 ] in cfg2unmapped
409404 and tpost [0 ] in cfg2unmapped
410405 and tpre [0 ] in cfg1unmapped ):
411- # Case where trampoline has an early return and a fallthrough case
412- # (what we mark as the exit block)
406+ # Case where trampoline has an early return and a fallthrough
407+ # case (what we mark as the exit block)
413408 roles ["entry" ] = self .basic_blocks2 [tpre [0 ]]
414409 roles ["exit" ] = self .basic_blocks2 [tpost [0 ]]
415410 for (role , addr ) in trampoline .roles .items ():
@@ -420,33 +415,40 @@ def setup_trampoline_analysis(self, b: str) -> None:
420415 self .app2 ,
421416 roles )
422417 else :
423- chklogger .logger .warning ("Found unhandled trampoline case. Should be an early return "
424- "trampoline (pre %s, post %s), but the blocks are not "
425- "in the unmapped lists. cfg1: %s, cfg2: %s" ,
426- tpre [0 ], tpost [0 ], cfg1unmapped , cfg2unmapped )
418+ chklogger .logger .warning (
419+ "Found unhandled trampoline case. Should be an early "
420+ "return trampoline (pre %s, post %s), but the blocks "
421+ " are not in the unmapped lists. cfg1: %s, cfg2: %s" ,
422+ tpre [0 ], tpost [0 ], cfg1unmapped , cfg2unmapped )
427423 elif len (tpre ) == 1 and len (tpost ) == 2 :
428424 # Trampoline has a continue statement.
429- # One of the post blocks is the fallthrough/exit, one is the loop continuation.
425+ # One of the post blocks is the fallthrough/exit, one is the
426+ # loop continuation.
430427 # Need to figure out which one is which
431428 if not 'continuepath' in trampoline .roles :
432- chklogger .logger .error ("Found unsupported trampoline case, "
433- "There are 2 post trampoline blocks %s but no continuepath role %s" ,
434- tpost , trampoline .roles )
429+ chklogger .logger .error (
430+ "Found unsupported trampoline case, "
431+ "There are 2 post trampoline blocks %s but no "
432+ "continuepath role %s" ,
433+ tpost , trampoline .roles )
435434 return
436435
437436 cont = self .basic_blocks2 [trampoline .roles ['continuepath' ]]
438437 cont_post = self .cfg2 .edges [cont .baddr ]
439438 if len (cont_post ) != 1 :
440- chklogger .logger .error ("Found unsupported trampoline case, "
441- "continue block %s has more than one outgoing edges: %s" ,
442- cont .baddr , cont_post )
439+ chklogger .logger .error (
440+ "Found unsupported trampoline case, "
441+ "continue block %s has more than one outgoing edges: %s" ,
442+ cont .baddr , cont_post )
443443 return
444444 fallthrough = self .basic_blocks2 [trampoline .roles ['fallthrough' ]]
445445 fallthrough_post = self .cfg2 .edges [fallthrough .baddr ]
446446 if len (fallthrough_post ) != 1 :
447- chklogger .logger .error ("Found unsupported trampoline case, "
448- "fallthrough block %s has more than one outgoing edges: %s" ,
449- fallthrough .baddr , fallthrough_post )
447+ chklogger .logger .error (
448+ "Found unsupported trampoline case, "
449+ "fallthrough block %s has more than one outgoing edges: "
450+ "%s" ,
451+ fallthrough .baddr , fallthrough_post )
450452 return
451453
452454 roles ["entry" ] = self .basic_blocks2 [tpre [0 ]]
@@ -459,9 +461,10 @@ def setup_trampoline_analysis(self, b: str) -> None:
459461 self .app2 ,
460462 roles )
461463 else :
462- chklogger .logger .warning ("Found unhandled trampoline case. Have %d pre-blocks "
463- "%d post-blocks. pre: %s, post %s" ,
464- len (tpre ), len (tpost ), tpre , tpost )
464+ chklogger .logger .warning (
465+ "Found unhandled trampoline case. Have %d pre-blocks "
466+ "%d post-blocks. pre: %s, post %s" ,
467+ len (tpre ), len (tpost ), tpre , tpost )
465468
466469 def setup_minimal_pair_2_and_3_trampoline_analysis (self , b : str ) -> None :
467470 chklogger .logger .info ("Setup minimal_pair_2_and_3_trampoline at %s" , b )
@@ -494,12 +497,6 @@ def has_trampoline(self) -> Optional[str]:
494497 return b
495498 return None
496499
497- def has_minimal_pair_2_and_3_trampoline (self ) -> Optional [str ]:
498- for (b , cfgb ) in self .cfgtc_blocks2 .items ():
499- if cfgb .is_trampoline_minimal_pair_2_and_3 :
500- return b
501- return None
502-
503500 def blocks_changed (self ) -> List [str ]:
504501 """Return a list of block addresses that are not md5-equal."""
505502
0 commit comments