Skip to content

Conversation

@gamozolabs
Copy link

Previously, functions with missing DW_AT_type (void return) were assigned confidence 0, allowing Binary Ninja's analysis to override them with incorrect inferred types (e.g., uint64_t).

Per DWARF spec section 3.3.2, a missing DW_AT_type on a subprogram means void, not "unknown". However, with minimal debug info (-g1), types are omitted entirely, so we can't distinguish void from unknown.

This fix:

  • Uses MAX_CONFIDENCE for explicit return types (was 128), matching parameter confidence for consistency
  • Uses MAX_CONFIDENCE for void when full debug info is present (detected by checking if any type definitions exist in the compilation unit)
  • Keeps confidence 0 for minimal debug info (-g1) to allow analysis to infer

Tested with C (-g1, -g2) and C++ (-g1, -g2) code to verify correct behavior across debug levels and languages (C uses DW_AT_prototyped, C++ doesn't).

Here's the before and after (TL;DR: void applies from dwarf debug info now)
image
After
image

Previously, functions with missing DW_AT_type (void return) were assigned
confidence 0, allowing Binary Ninja's analysis to override them with
incorrect inferred types (e.g., uint64_t).

Per DWARF spec section 3.3.2, a missing DW_AT_type on a subprogram means
void, not "unknown". However, with minimal debug info (-g1), types are
omitted entirely, so we can't distinguish void from unknown.

This fix:
- Uses MAX_CONFIDENCE for explicit return types (was 128), matching
  parameter confidence for consistency
- Uses MAX_CONFIDENCE for void when full debug info is present (detected
  by checking if any type definitions exist in the compilation unit)
- Keeps confidence 0 for minimal debug info (-g1) to allow analysis to infer

Tested with C (-g1, -g2) and C++ (-g1, -g2) code to verify correct behavior
across debug levels and languages (C uses DW_AT_prototyped, C++ doesn't).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@CLAassistant
Copy link

CLAassistant commented Jan 15, 2026

CLA assistant check
All committers have signed the CLA.

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.

2 participants