code: def _build_from(self, address, root, base_address, depth=2):
          
          if depth == 0:
              return
  
          end_addr = address
  
          for step in range(1, self._max_bytes + 1):
              start_addr = address - step
  
              if start_addr < 0 or start_addr < base_address:
                  break
  
              raw_bytes = self._mem[start_addr:end_addr]
  
              # TODO: Improve this code.
              if self._architecture == ARCH_ARM:
                  try:
                      asm_instr = self._disasm.disassemble(raw_bytes, start_addr, architecture_mode=self._architecture_mode)
                  except InvalidDisassemblerData:
                      continue
              else:
                  try:
                      asm_instr = self._disasm.disassemble(raw_bytes, start_addr)
                  except:
                      asm_instr = None
  
              if not asm_instr or asm_instr.size != step:
                  continue
  
              try:
                  ir_instrs = self._ir_trans.translate(asm_instr)
              except:
                  continue
  
              if self._is_valid_ins(ir_instrs):
                  asm_instr.ir_instrs = ir_instrs
  
                  child = GadgetTreeNode(asm_instr)
  
                  root.add_child(child)
  
                  self._build_from(address - step, child, base_address, depth - 1)
docs: Build gadgets recursively.