Skip to content

fix(db_info): report real program metadata for the active program (#1) - #9

Merged
0xeb merged 1 commit into
mainfrom
fix/headless-db-info-metadata
Jun 23, 2026
Merged

fix(db_info): report real program metadata for the active program (#1)#9
0xeb merged 1 commit into
mainfrom
fix/headless-db-info-metadata

Conversation

@0xeb

@0xeb 0xeb commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Problem

In headless mode (and any session where the client never issued an explicit OpenProgram), db_info reported placeholder metadata — program_name = "active-program", empty language_id/compiler_spec, image_base = 0 — even though a program was fully loaded and analysis queries worked. Reported in #1.

Root cause: read_program_info() only filled metadata from opened_program_, which is never set on the headless path; neither GetStatus nor GetRevision carries language_id/image_base.

Fix

db_info now resolves the active program's path from GetRevision (which the host always knows) and best-effort OpenPrograms it to populate program_name/language_id/compiler_spec/image_base. If the open fails it falls back to the real program path instead of the "active-program" placeholder. The analysis-query path is untouched — it already runs against the active program, so there is no regression (verified).

md5/sha256 remain empty: the host's OpenProgram response doesn't carry them (separate, host-side gap).

Note: the "analysis tables return 0 rows" part of #1's title was a separate bug — the UINT64_MAX range-end sentinel — already fixed in #7 / 0xeb/libghidra#16. This PR addresses the remaining db_info metadata gap.

Verification

program_name language_id compiler_spec image_base
ELF fixture (before) active-program (empty) (empty) 0
ELF fixture (after) t_linux.o x86:LE:64:default gcc 0x100000
/bin/ls (after) ls x86:LE:64:default gcc 0x100000000

Analysis queries unchanged across the fix: funcs 9 / 136, names/instructions intact.

In headless mode (and any session where the client never issued an explicit
OpenProgram), db_info reported program_name='active-program' with empty
language_id/compiler_spec and image_base=0, because opened_program_ was never
populated.

The host does know the active program: GetRevision returns its path. db_info now
resolves the active program from the revision and best-effort opens it to fill
name/language/compiler/image_base, falling back to the real program path (not
'active-program') if the open fails. The analysis-query path is unchanged --
it already runs against the active program, so there is no regression.

md5/sha256 stay empty: the host's OpenProgram response doesn't carry them.
@0xeb
0xeb merged commit 21a7c2a into main Jun 23, 2026
2 of 8 checks passed
@0xeb
0xeb deleted the fix/headless-db-info-metadata branch June 23, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant