[llvm] 6139626 - llvm-dwp: Include dwo name even when the input is a dwo
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 28 13:24:13 PDT 2022
Author: David Blaikie
Date: 2022-07-28T20:24:05Z
New Revision: 6139626d738fd03b968e07698f5cd26924e3cd65
URL: https://github.com/llvm/llvm-project/commit/6139626d738fd03b968e07698f5cd26924e3cd65
DIFF: https://github.com/llvm/llvm-project/commit/6139626d738fd03b968e07698f5cd26924e3cd65.diff
LOG: llvm-dwp: Include dwo name even when the input is a dwo
This still only includes the dwo name if it's in the DW_AT_dwo_name
attribute in the split unit - though it could be improved/modified to
use the dwo name from the command line (if linking raw dwo files) or
retrieved from the DW_AT_dwo_name in the executable (when using -e).
It's useful in any case because you might have a large command line with
many files and knowing exactly which dwo files are relevant will
simplify debugging, but especially with '-e' when you didn't pass the
dwo files explicitly in nthe first place it would be quite non-obvious
where the duplicate units are coming from.
Added:
Modified:
llvm/lib/DWP/DWP.cpp
llvm/test/tools/llvm-dwp/X86/duplicate.test
llvm/test/tools/llvm-dwp/X86/handle_strx.test
Removed:
################################################################################
diff --git a/llvm/lib/DWP/DWP.cpp b/llvm/lib/DWP/DWP.cpp
index 346f4dfd290d1..7f825a16529df 100644
--- a/llvm/lib/DWP/DWP.cpp
+++ b/llvm/lib/DWP/DWP.cpp
@@ -252,16 +252,23 @@ static std::string buildDWODescription(StringRef Name, StringRef DWPName,
std::string Text = "\'";
Text += Name;
Text += '\'';
- if (!DWPName.empty()) {
+ bool HasDWO = !DWOName.empty();
+ bool HasDWP = !DWPName.empty();
+ if (HasDWO || HasDWP) {
Text += " (from ";
- if (!DWOName.empty()) {
+ if (HasDWO) {
Text += '\'';
Text += DWOName;
- Text += "' in ";
+ Text += '\'';
+ }
+ if (HasDWO && HasDWP)
+ Text += " in ";
+ if (!DWPName.empty()) {
+ Text += '\'';
+ Text += DWPName;
+ Text += '\'';
}
- Text += '\'';
- Text += DWPName;
- Text += "')";
+ Text += ")";
}
return Text;
}
diff --git a/llvm/test/tools/llvm-dwp/X86/duplicate.test b/llvm/test/tools/llvm-dwp/X86/duplicate.test
index de5f1fdd4231f..66eede9b5d2df 100644
--- a/llvm/test/tools/llvm-dwp/X86/duplicate.test
+++ b/llvm/test/tools/llvm-dwp/X86/duplicate.test
@@ -22,6 +22,6 @@ DWOS: error: duplicate DWO ID ({{.*}}) in 'c.c' and 'c.c'{{$}}
1DWP: error: duplicate DWO ID ({{.*}}) in 'c.c' (from '{{.*}}ac.dwp') and 'c.c'{{$}}
2DWP: error: duplicate DWO ID ({{.*}}) in 'c.c' and 'c.c' (from '{{.*}}bc.dwp'){{$}}
-DWODWOS: error: duplicate DWO ID ({{.*}}) in 'c.c' and 'c.c'{{$}}
-DWO1DWP: error: duplicate DWO ID ({{.*}}) in 'c.c' (from 'c.dwo' in '{{.*}}ac.dwp') and 'c.c'{{$}}
-DWO2DWP: error: duplicate DWO ID ({{.*}}) in 'c.c' and 'c.c' (from 'c.dwo' in '{{.*}}bc.dwp'){{$}}
+DWODWOS: error: duplicate DWO ID ({{.*}}) in 'c.c' (from 'c.dwo') and 'c.c' (from 'c.dwo'){{$}}
+DWO1DWP: error: duplicate DWO ID ({{.*}}) in 'c.c' (from 'c.dwo' in '{{.*}}ac.dwp') and 'c.c' (from 'c.dwo'){{$}}
+DWO2DWP: error: duplicate DWO ID ({{.*}}) in 'c.c' (from 'c.dwo') and 'c.c' (from 'c.dwo' in '{{.*}}bc.dwp'){{$}}
diff --git a/llvm/test/tools/llvm-dwp/X86/handle_strx.test b/llvm/test/tools/llvm-dwp/X86/handle_strx.test
index 8fd6fe5b725f3..c62f923f30e22 100644
--- a/llvm/test/tools/llvm-dwp/X86/handle_strx.test
+++ b/llvm/test/tools/llvm-dwp/X86/handle_strx.test
@@ -10,5 +10,5 @@ with options -gdwarf-5 and -gsplit-dwarf.
READ_STRX: DW_AT_name [DW_FORM_strx1]{{.*}}dw5.cc
-PARSE_STRX: error: duplicate DWO ID ({{.*}}) in 'dw5.cc' and 'dw5.cc'
+PARSE_STRX: error: duplicate DWO ID ({{.*}}) in 'dw5.cc' (from 'dw5.dwo') and 'dw5.cc' (from 'dw5.dwo')
More information about the llvm-commits
mailing list