Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
angr documentation
angr documentation
  • Introduction
  • Getting Started
  • Core Concepts
  • Build-in Analyses
  • Advanced Topics
  • Extending angr
  • angr examples
  • Frequently Asked Questions
  • Appendix
  • API Reference
    • angr.ail_callable
    • angr.ailment
    • angr.analyses
    • angr.angrdb
    • angr.annocfg
    • angr.blade
    • angr.block
    • angr.callable
    • angr.calling_conventions
    • angr.code_location
    • angr.codenode
    • angr.concretization_strategies
    • angr.distributed
    • angr.emulator
    • angr.engines
    • angr.enums
    • angr.errors
    • angr.exploration_techniques
      • angr.exploration_techniques.base
      • angr.exploration_techniques.bucketizer
      • angr.exploration_techniques.common
      • angr.exploration_techniques.dfs
      • angr.exploration_techniques.directed_search
      • angr.exploration_techniques.director
      • angr.exploration_techniques.driller_core
      • angr.exploration_techniques.explorer
      • angr.exploration_techniques.lengthlimiter
      • angr.exploration_techniques.local_loop_seer
      • angr.exploration_techniques.loop_seer
      • angr.exploration_techniques.manual_mergepoint
      • angr.exploration_techniques.memory_watcher
      • angr.exploration_techniques.oppologist
      • angr.exploration_techniques.slicecutor
      • angr.exploration_techniques.spiller
      • angr.exploration_techniques.spiller_db
      • angr.exploration_techniques.stochastic
      • angr.exploration_techniques.stub_stasher
      • angr.exploration_techniques.suggestions
      • angr.exploration_techniques.tech_builder
      • angr.exploration_techniques.threading
      • angr.exploration_techniques.timeout
      • angr.exploration_techniques.tracer
      • angr.exploration_techniques.unique
      • angr.exploration_techniques.veritesting
    • angr.factory
    • angr.flirt
    • angr.go
    • angr.keyed_region
    • angr.knowledge_base
    • angr.knowledge_plugins
    • angr.llm_client
    • angr.llm_models
    • angr.mcp
    • angr.misc
    • angr.procedures
    • angr.project
    • angr.protos
    • angr.rust
    • angr.rustylib
    • angr.serializable
    • angr.sim_manager
    • angr.sim_options
    • angr.sim_procedure
    • angr.sim_state
    • angr.sim_state_options
    • angr.sim_type
    • angr.sim_variable
    • angr.simos
    • angr.slicer
    • angr.state_hierarchy
    • angr.state_plugins
    • angr.storage
    • angr.tablespecs
    • angr.utils
    • angr.vaults
Back to top
View this page

angr.exploration_techniques.directed_search¶

class angr.exploration_techniques.directed_search.DirectedSearch¶

Bases: ExplorationTechnique

Best-first search toward a target address, ranked by distance in a CFG.

After every step, the states in the stepped stash and in deferred_stash are ranked together by their distance to target_addr, and the beam_width closest stay in the stepped stash. The rest wait in deferred_stash, so a deferred state comes back as soon as it is among the closest. Ties keep the earlier-deferred state first. The technique keeps deferred_stash sorted by distance.

The distance of a state is the fewest CFG edges from the block holding its address to the block holding the target. It is a heuristic: every block counts as one hop, and it ignores calling context, so from inside a function the shortest return to any caller counts. States whose address is not in the CFG, or that cannot reach the target, rank last.

A state that loops close to the target stays ahead of farther ones indefinitely; pair this technique with LoopSeer or LengthLimiter when that can happen. Use one instance per stepped stash: states in deferred_stash can move into whichever stash is stepped, and successors sent elsewhere with target_stash are not ranked.

__init__(cfg, target_addr, beam_width=1, deferred_stash='directed_deferred')¶
Parameters:
  • cfg – A CFG analysis (e.g. project.analyses.CFGFast()) or its CFGModel.

  • target_addr (int) – The address to steer toward. It need not start a block.

  • beam_width (int) – How many of the closest states to keep after each step (at least 1).

  • deferred_stash (str) – The stash for states that are not among the closest.

Raises:

ValueError – If beam_width is below 1, or no CFG node contains target_addr.

distance(addr)¶

The CFG distance from addr to the target, or inf when addr is not in the CFG or cannot reach it.

Return type:

float

Parameters:

addr (int)

Next
angr.exploration_techniques.director
Previous
angr.exploration_techniques.dfs
Copyright © 2026, The angr Project contributors
Made with Sphinx and @pradyunsg's Furo
On this page
  • angr.exploration_techniques.directed_search
    • DirectedSearch
      • DirectedSearch.__init__()
      • DirectedSearch.distance()