@@ -259,7 +259,8 @@ class asm_block_bad(asm_bloc):
259259
260260 ERROR_TYPES = {- 1 : "Unknown error" ,
261261 0 : "Unable to disassemble" ,
262- 1 : "Reach a null starting block" ,
262+ 1 : "Null starting block" ,
263+ 2 : "Address forbidden by dont_dis" ,
263264 }
264265
265266 def __init__ (self , label = None , alignment = 1 , errno = - 1 , * args , ** kwargs ):
@@ -426,7 +427,18 @@ def dis_bloc(mnemo, pool_bin, label, offset, job_done, symbol_pool,
426427 if in_delayslot :
427428 delayslot_count -= 1
428429
429- if offset in dont_dis or (lines_cpt > 0 and offset in split_dis ):
430+ if offset in dont_dis :
431+ if not cur_block .lines :
432+ job_done .add (offset )
433+ # Block is empty -> bad block
434+ cur_block = asm_block_bad (label , errno = 2 )
435+ else :
436+ # Block is not empty, stop the desassembly pass and add a
437+ # constraint to the next block
438+ cur_block .add_cst (offset , asm_constraint .c_next , symbol_pool )
439+ break
440+
441+ if lines_cpt > 0 and offset in split_dis :
430442 cur_block .add_cst (offset , asm_constraint .c_next , symbol_pool )
431443 offsets_to_dis .add (offset )
432444 break
@@ -450,6 +462,7 @@ def dis_bloc(mnemo, pool_bin, label, offset, job_done, symbol_pool,
450462 if instr is None :
451463 log_asmbloc .warning ("cannot disasm at %X" , int (off_i ))
452464 if not cur_block .lines :
465+ job_done .add (offset )
453466 # Block is empty -> bad block
454467 cur_block = asm_block_bad (label , errno = 0 )
455468 else :
@@ -547,19 +560,6 @@ def dis_bloc_all(mnemo, pool_bin, offset, job_done, symbol_pool, dont_dis=[],
547560 continue
548561 if n in job_done :
549562 continue
550-
551- if n in dont_dis :
552- continue
553- dd_flag = False
554- for dd in dont_dis :
555- if not isinstance (dd , tuple ):
556- continue
557- dd_a , dd_b = dd
558- if dd_a <= n < dd_b :
559- dd_flag = True
560- break
561- if dd_flag :
562- continue
563563 label = symbol_pool .getby_offset_create (n )
564564 cur_block , nexts = dis_bloc (mnemo , pool_bin , label , n , job_done ,
565565 symbol_pool , dont_dis , split_dis ,
0 commit comments