Skip to content

Comments

feat: support DW_TAG_enumeration_type and DW_TAG_enumerator#1548

Open
abroooo wants to merge 24 commits intomasterfrom
abroooo/handle_enum_as_enum_for_debug_info
Open

feat: support DW_TAG_enumeration_type and DW_TAG_enumerator#1548
abroooo wants to merge 24 commits intomasterfrom
abroooo/handle_enum_as_enum_for_debug_info

Conversation

@abroooo
Copy link
Contributor

@abroooo abroooo commented Nov 12, 2025

This PR improves the debug information generation for enumerations by representing them as proper DWARF enumeration types instead of type aliases.

Improves debug information generation for enumerations by representing them as proper DWARF enumeration types instead of type aliases.

Changes:

  • enhance enum debug info: enums are now emitted as DW_TAG_enumeration_type with proper enumerator entries for each variant, making them fully visible in debuggers with their symbolic names and values
  • update inkwell to 0.8: use inkwell 0.8 release which provides create_enumeration_type and create_enumerator APIs
  • refactor call expression handling: Updated expression generator to use inkwell's new CallSiteValue::try_as_basic_value().basic() API

Before vs After:

Before: enums appeared as simple integer typedefs in debug info
!DIDerivedType(tag: DW_TAG_typedef, name: "en1", baseType: !9)

After: enums are represented as enumeration types with their variants
!DICompositeType(tag: DW_TAG_enumeration_type, name: "en1", baseType: !13, elements: !5)
!5 = !{!6, !7, !8}
!6 = !DIEnumerator(name: "a", value: 0)
!7 = !DIEnumerator(name: "b", value: 1)
!8 = !DIEnumerator(name: "c", value: 2)

This allows debuggers to display enum values by their symbolic names rather than raw integer values.

@abroooo abroooo changed the title WIP: feat: support DW_TAG_enumeration_type and DW_TAG_enumerator feat: support DW_TAG_enumeration_type and DW_TAG_enumerator Nov 12, 2025
@abroooo abroooo marked this pull request as draft November 12, 2025 10:25
@abroooo abroooo marked this pull request as ready for review January 15, 2026 09:12
@abroooo abroooo requested review from ghaith, mhasel and volsa and removed request for mhasel and volsa January 15, 2026 09:12
@abroooo abroooo marked this pull request as draft January 19, 2026 10:24
introduce two new substutions to make checking IR possible
@abroooo abroooo marked this pull request as ready for review January 19, 2026 14:29
mhasel
mhasel previously approved these changes Jan 21, 2026
Copy link
Member

@mhasel mhasel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@mhasel mhasel self-requested a review February 25, 2026 14:22
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