Skip to content

[AUTOMATED] type_match: an inlined callee's parameters and locals are scored as the caller's variables #97

Closed

Description

@mahaloz

Problem

type_match scores an inlined callee's parameters and locals as variables of the function they were inlined into. _parse_function_die (type_match.py:410) descends into every DW_TAG_inlined_subroutine child of the subprogram.

At -O2 most of these are parameters of glibc's _FORTIFY_SOURCE wrappers, and they don't exist in the compiled code. coreutils fmt's emit_bug_reporting_address (void) declares no variables, yet its ground truth has three:

$ python -c 'from pathlib import Path; from decbench.metrics.type_match import extract_ground_truth_types as g; print([(v["name"], v["type"]) for v in g(Path("results/<run>/O2/coreutils/compiled/fmt"))["emit_bug_reporting_address"]])'
[('__fmt', ['void']), ('__fmt', ['void']), ('__fmt', ['void'])]

All three come from inlined printf calls:

DW_TAG_subprogram emit_bug_reporting_address
  DW_TAG_inlined_subroutine printf
    DW_TAG_formal_parameter __fmt
  DW_TAG_inlined_subroutine printf
    DW_TAG_formal_parameter __fmt
  DW_TAG_inlined_subroutine printf
    DW_TAG_formal_parameter __fmt

Each __fmt is a string constant passed straight to __printf_chk, so no decompiler has a variable to match it, and the function can never score perfect. (The void spelling is #94.) O2-noinline is affected too, because -fno-inline still inlines glibc's always_inline wrappers.

How much it matters

These numbers cover coreutils, grep, gzip, diffutils, bzip2, findutils, tar and shadow, over the functions kuna is scored on:

GT variables from an inlined callee
O2 21,038 7,148 (34.0%): 4,656 params, 2,492 locals
O2-noinline 23,060 3,075 (13.3%)

The most common names are __fmt (404 at O2), __stream (123), __s and __dest.

With only each function's own variables scored, kuna would go from 74 to 153 perfect functions at O2 and from 380 to 498 at O2-noinline. Other decompilers were not re-scored, but their ground truth is the same, so they would gain the same way.

Proposal

  • Skip inlined callees. In _parse_function_die, skip DW_TAG_inlined_subroutine children and keep descending into DW_TAG_lexical_block. extract_source_evidence in variable_match.py already has this switch as include_inlined (default False); type_match has none.
  • Optional separate count. Report inlined-callee variables as their own count, so a decompiler that un-inlines a callee and recovers its variables still gets visible credit.

This can't be gamed. type_match already ignores extra decompiled variables, so excluding these never costs a decompiler that does recover them. It only stops charging every tool for variables the binary doesn't have.

🤖 Generated with Claude Code

https://claude.ai/code/session_011Q4qgBGM28rgY6CEh5pird

Activity

  1. added a commit that references this issue on Nov 2, 2026
    cdd2df9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions