Skip to content

[UVTD] Preferred organization for PDB/DWARF readers and shared generators #1349

Description

@tc-imba

Current progress

I have a working branch that builds UVTD on Linux and generates member layouts, Sol bindings, and primary Itanium vtables from LLVM DWARF while preserving the existing Windows raw_pdb path; I have not opened a PR yet.

Context

The existing Windows UVTD code combines metadata extraction and generated-file emission in several places. To reuse the established output format from Linux, the current prototype makes the following targeted extractions:

Symbols.hpp
  platform-neutral metadata types -> TypeMetadata.hpp
  Windows Symbols/raw_pdb class    -> remains in Symbols.hpp

MemberVarsDumper.cpp
  PDB member extraction            -> remains in MemberVarsDumper
  generate_files()                 -> MemberVarsOutputGenerator

VTableDumper.cpp
  PDB vtable extraction            -> remains in VTableDumper
  method-key helpers               -> VTableMethodNames
  generate_files()/cleanup         -> VTableOutputGenerator

The resulting flow is:

Windows PDB reader  --\
                      -> TypeContainer -> shared output generators
Linux DWARF reader  --/

This keeps one implementation of the member, vtable, virtual-integration, and Sol output formats. It also makes the diff look larger because Git shows moved code as deletions from the original Windows files and additions to new shared files. For example, the Symbols class itself remains unchanged; only its platform-neutral data structures move out of the PDB-heavy header.

Questions

Which organization would you prefer for an eventual PR?

  1. Keep the current shared pipeline: separate PDB and DWARF readers populate a common TypeContainer, followed by shared generators. This moves existing output code, but minimizes duplicated behavior and makes Windows/Linux output consistency testable.

  2. Minimize movement in the existing Windows files and implement Linux-specific generation separately. This produces a smaller-looking diff, but duplicates member/vtable output and method-naming logic that could drift later.

  3. Introduce a deeper reader abstraction and reorganize the source tree, for example:

    UVTD/src/Metadata/Windows/
    UVTD/src/Metadata/Linux/
    UVTD/src/Generators/
    

    This gives the clearest separation but would move considerably more existing code and seems contrary to a minimum-change PR.

More specifically:

  • Is extracting the platform-neutral structures from Symbols.hpp into a small shared header acceptable, or would you prefer keeping Symbols.hpp as the common type header with platform guards around the raw-PDB class?
  • Is moving only generate_files() out of MemberVarsDumper and VTableDumper the preferred boundary, or should the existing Windows classes remain completely untouched?
  • Would you prefer new files to remain in the current flat UVTD/include/UVTD and UVTD/src layout, or should platform readers and shared generators have subdirectories?

My preference is the first option because it keeps platform-specific code limited to metadata extraction while using the existing Windows emitter as the single source of truth, but I would like to align the code layout with maintainer expectations before cleaning the branch and opening a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions