Accept functions with DW_AT_linkage_name present
authorAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Sun, 22 May 2022 16:16:06 +0000 (21:46 +0530)
committerKavitha Natarajan <kavitha.natarajan@amd.com>
Sun, 22 May 2022 16:16:06 +0000 (21:46 +0530)
commit6f9b09edaee43ea34d34b1998fe7b844834f251a
treec0ae8cd64603201c664070d06c2efdc9dcee4bab
parentcb3a7614feb82ffdc25161bf60529116c6112ab3
Accept functions with DW_AT_linkage_name present

Currently GDB is not able to debug (Binary generated with Clang) variables
present in shared/private clause of OpenMP Task construct. Please note that
LLVM debugger LLDB is able to debug.

In case of OpenMP, compilers generate artificial functions which are not
present in actual program. This is done to apply parallelism to block of
code.

For non-artifical functions, DW_AT_name attribute should contains the name
exactly as present in actual program.
(Ref# http://wiki.dwarfstd.org/index.php?title=Best_Practices)
Since artificial functions are not present in actual program they not having
DW_AT_name and having DW_AT_linkage_name instead should be fine.

Currently GDB is invalidating any function not havnig DW_AT_name which is why
it is not able to debug OpenMP (Clang).

It should be fair to fallback to check DW_AT_linkage_name in case DW_AT_name
is absent.
gdb/dwarf2/read.c
gdb/testsuite/gdb.threads/omp-task.c [new file with mode: 0644]
gdb/testsuite/gdb.threads/omp-task.exp [new file with mode: 0644]