Skip to content

Incorrect file paths in DWARF debug info #17482

@leecannon

Description

@leecannon

Zig Version

0.12.0-dev.878+7abf9b3a8

Steps to Reproduce and Observed Behavior

Sorry, I was unable to replicate the issue with a reduction.

  1. git clone https://github.com/CascadeOS/CascadeOS.git
  2. cd CascadeOS
  3. zig build kernel_x86_64
  4. llvm-dwarfdump zig-out/x86_64/kernel --name=page_size

With 0.12.0-dev.878+7abf9b3a8:

$ llvm-dwarfdump zig-out/x86_64/kernel --name=page_size
zig-out/x86_64/kernel:	file format elf64-x86-64

0x0000097b: DW_TAG_variable
              DW_AT_name	("page_size")
              DW_AT_type	(0x00000863 "size.Size")
              DW_AT_decl_file	("/home/lee/src/CascadeOS/kernel/arch/x86_64/arch/x86_64/setup.zig")
              DW_AT_decl_line	(21)
              DW_AT_linkage_name	("arch.x86_64.setup.page_size")

With 0.12.0-dev.819+75b48ef50:

$ llvm-dwarfdump zig-out/x86_64/kernel --name=page_size
zig-out/x86_64/kernel:	file format elf64-x86-64

0x0000097b: DW_TAG_variable
              DW_AT_name	("page_size")
              DW_AT_type	(0x00000863 "size.Size")
              DW_AT_decl_file	("/home/lee/src/CascadeOS/kernel/arch/x86_64/setup.zig")
              DW_AT_decl_line	(21)
              DW_AT_linkage_name	("arch.x86_64.setup.page_size")

The issue only seems to affect files in subdirectories.

Expected Behavior

Correct file paths in debug info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend-llvmThe LLVM backend outputs an LLVM IR Module.bugObserved behavior contradicts documented or intended behaviorregressionIt worked in a previous version of Zig, but stopped working.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions