[clang] [llvm] [dyndbg][Clang] Implement nested-ELF dynamic debugging support (PR #216307)

Thurston Dang via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 16 19:15:30 PDT 2026


thurstond wrote:

When I reproduced it locally, it failed with:
```
     frame #4: 0x0000555569bc2e5c clang`llvm::MD5::update(llvm::ArrayRef<unsigned char>) at MD5.cpp:205:7
     frame #5: 0x000055556b68b2a1 clang`createAndEmbedModuleForDynamicDebugging at BackendUtil.cpp:1530:12 [inlined]
     frame #6: 0x000055556b68afbd clang`::emitBackendOutput() at BackendUtil.cpp:1654:5
```

clang/lib/CodeGen/BackendUtil.cpp:1530 is `Hash.update(CU->getDirectory());` MD5.cpp:205 is `memcpy(&InternalState.buffer[used], Ptr, Size);`; UBSan complains that Ptr (i.e., `CU->getDirectory().data()`) should not be null.

The debug info appears to not split the path into file and directory (e.g., '!3' and '!7' below):

```
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "external", scope: !2, file: !7, line: 24, type: !8, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 24.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
!3 = !DIFile(filename: "/usr/local/google/home/thurston/llvm-projectA/clang/test/DebugInfo/DynamicDebugging/<stdin>", directory: "")
!4 = !{!0, !5, !9, !11}
!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
!6 = distinct !DIGlobalVariable(name: "used_by_init", linkageName: "_ZL12used_by_init", scope: !2, file: !7, line: 37, type: !8, isLocal: true, isDefinition: true)
!7 = !DIFile(filename: "/usr/local/google/home/thurston/llvm-projectA/clang/test/DebugInfo/DynamicDebugging/compiler-used.cpp", directory: "")
```

https://github.com/llvm/llvm-project/pull/216307


More information about the cfe-commits mailing list