Commit 432f010
Fix DWARF void return type confidence
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>1 parent 56010d2 commit 432f010
1 file changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
669 | | - | |
670 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
671 | 683 | | |
672 | 684 | | |
673 | 685 | | |
| |||
0 commit comments