[PATCH] D57157: [DEBUG_INFO][NVPTX] Generate DW_AT_address_class to get the values in debugger.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 24 07:30:48 PST 2019


ABataev created this revision.
ABataev added reviewers: echristo, probinson.
Herald added subscribers: aprantl, jholewinski.

According to
https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf,
the compiler should emit the DW_AT_address_class attribute for all
variable and parameter. It means, that DW_AT_address_class attribute
should be used in the non-standard way to support compatibility with the
cuda-gdb debugger.
Clang is able to generate the information about the variable address
class. This information is emitted as the expression sequence
`DW_OP_constu <DWARF Address Space> DW_OP_swap DW_OP_xderef`. The patch
tries to find all such expressions and transform them into
`DW_AT_address_class <DWARF Address Space>` if target is NVPTX and the debugger is gdb.
If the expression is not found, then default values are used. For the
local variables <DWARF Address Space> is set to ADDR_local_space(6), for
the globals <DWARF Address Space> is set to ADDR_global_space(5). The
values are taken from the table in the same section 5.2. CUDA-Specific
DWARF Definitions.


Repository:
  rL LLVM

https://reviews.llvm.org/D57157

Files:
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  test/DebugInfo/NVPTX/dbg-declare-alloca.ll
  test/DebugInfo/NVPTX/debug-addr-class.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57157.183313.patch
Type: text/x-patch
Size: 26050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/b7800d31/attachment.bin>


More information about the llvm-commits mailing list