Skip to content

Stack view merges same-named functions from different translation units #42

In review

Description

@sh00kapic

A merge of reports for a.c and b.c, each defining a file-local helper, returned a single row. With peaks of 16 and 32 bytes respectively, it showed the source location from a.c and the 32-byte value from b.c. The function and CodeLens lookup also indexes by name.

Expected behavior and verification

Preserve distinct definitions across files through aggregation, graph construction, CodeLens lookup and source navigation. Add a two-file regression fixture. Each helper should retain its own metrics, callers and jump target.

ctrace/StackParser.ts line 325 · ctrace/StackManager.ts line 25

Activity

  1. added
    bug
    on Nov 20, 2026
  2. Arthurvroum commented on Nov 25, 2026

    @Arthurvroum
    Collaborator

    Fixed on branch 42-stack-same-name-functions (89ab834), pull request #55.

    • When reports are merged, a function is identified by its name and the file that defines it. A name defined in a single file keeps its name as its id; otherwise the id is name@file. Functions with no known file are still merged by name.
    • Calls are resolved within the file that made them first, then to the only definition of that name elsewhere. An ambiguous name is not linked.
    • CodeLens and source navigation use the definition from their own file, and the sidebar shows the file next to names shared by several functions.

    Tests: a two-file fixture where each helper keeps its own metrics, callers and jump target, plus StackManager and stack tree lookups. Unit and workspace suites pass locally (Linux).

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions