aboutsummaryrefslogtreecommitdiffstats
path: root/idatui/launch.py
diff options
context:
space:
mode:
authorblasty <peter@haxx.in>2026-08-14 00:26:19 +0200
committerblasty <peter@haxx.in>2026-08-14 00:26:19 +0200
commitdb3576d7b4174e78222203a7d5246c5ee080049b (patch)
tree6544667596d6209054eab7c8ce03cf31c3c7dad3 /idatui/launch.py
parentFix: rebuilding the row index on every switch back to the listing (diff)
downloadida-tui-db3576d7b4174e78222203a7d5246c5ee080049b.tar.gz
ida-tui-db3576d7b4174e78222203a7d5246c5ee080049b.tar.xz
ida-tui-db3576d7b4174e78222203a7d5246c5ee080049b.zip
Port to the ida-codemode 0.5.3+ public API
0.5.x turned ida_codemode.__all__ into a real public API and hid the rest: client.py -> handle.py, registry.py -> _registry.py + instances.py, resolver.py -> _resolver.py. Every import we had was from a module that no longer exists, so the TUI could not attach at all. - handle.entry -> handle.instance (RegistryEntry -> DatabaseInstance) - 30 keyword-only options -> DatabaseOpenOptions(...) passed as options= - IdbBusy -> DatabaseBusyError - InstanceDisconnected/ClientError -> DatabaseDisconnected/CodeModeConnectionError - our scan_instances()+idb_key() ownership walks -> find_database_owner() - our FileLock poking (_wait_for_entry_release) -> wait_database_released() - registry.discover_instances() -> discover_databases() + InstanceState _database_exists() is deleted with it: upstream now drops the loader switches itself when reopening an existing IDB (_resolver._build_worker_command), which is the same fix we had client-side. See docs/CODEMODE_UPSTREAM.md section 4 for the one invocation that still slips through. The offline contract suite has to keep running under a stdlib-only python3, where every Code Mode name is bound to None -- so it now injects a strict fake DatabaseOpenOptions and a real DatabaseBusyError exception alongside the fake handle. Without the latter, `except DatabaseBusyError` is `except None`, and the TypeError it raises masks whatever actually failed inside the try. The loader-option names moved inside the options dataclass, so the guard that caught `loading_address` vs `image_base` moved with them (_option_fields_are_real). uv.lock pins 0.6.1; ~/ida-venv and .venv are on 0.6.1 with the ida-domain 0.5.1 / zeromcp 1.8.0 floors it requires. Full gate: 1065 passed.
Diffstat (limited to 'idatui/launch.py')
-rw-r--r--idatui/launch.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/idatui/launch.py b/idatui/launch.py
index 0c53987..e3cb091 100644
--- a/idatui/launch.py
+++ b/idatui/launch.py
@@ -36,8 +36,25 @@ def _log(msg: str) -> None:
def _registered_databases() -> tuple[list[dict], list[dict]]:
"""Ready and blocked Code Mode registrations, with normalized errors."""
try:
- from ida_codemode.registry import discover_instances
- return discover_instances()
+ from ida_codemode import InstanceState, discover_databases
+
+ ready: list[dict] = []
+ blocked: list[dict] = []
+ for discovered in discover_databases():
+ instance = discovered.instance
+ item = {
+ "record_id": instance.record_id,
+ "backend": instance.backend,
+ "pid": instance.pid,
+ "exe_path": instance.exe_path,
+ "idb_path": instance.idb_path,
+ }
+ if discovered.state is InstanceState.READY:
+ ready.append(item)
+ else:
+ item["error"] = discovered.detail or "instance is unavailable"
+ blocked.append(item)
+ return ready, blocked
except Exception as exc: # discovery diagnostics belong at the CLI boundary
return [], [{"error": str(exc)}]