-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm-gsymutil] Don't warn about duplicate debug info for merged functions #122973
Open
alx32
wants to merge
3
commits into
llvm:main
Choose a base branch
from
alx32:15_no_dup_dbg_warn
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-debuginfo Author: None (alx32) ChangesWhen the input has merged functions, it's expected for the same address range to contain duplicate (and different) debug information. Don't warn about this when merged functions are expected in the input. Full diff: https://github.com/llvm/llvm-project/pull/122973.diff 4 Files Affected:
diff --git a/llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h b/llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
index 0d098da96dd278..4433111327d67a 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
@@ -147,7 +147,8 @@ class GsymCreator {
bool IsSegment = false;
bool Finalized = false;
bool Quiet;
-
+ // Specifies weather the input might contain merged functions
+ bool InputHasMergedFunctions;
/// Get the first function start address.
///
@@ -292,7 +293,12 @@ class GsymCreator {
}
public:
- GsymCreator(bool Quiet = false);
+ /// Construct a GsymCreator object.
+ ///
+ /// \param Quiet Whether to suppress warning messages
+ /// \param InputHasMergedFunctions Weather the input might contain merged
+ /// functions - functions with identical address ranges.
+ GsymCreator(bool Quiet = false, bool InputHasMergedFunctions = false);
/// Save a GSYM file to a stand alone file.
///
diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
index 14078f5aaf9a46..8c8892cace8538 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
@@ -21,8 +21,9 @@
using namespace llvm;
using namespace gsym;
-GsymCreator::GsymCreator(bool Quiet)
- : StrTab(StringTableBuilder::ELF), Quiet(Quiet) {
+GsymCreator::GsymCreator(bool Quiet, bool InputHasMergedFunctions)
+ : StrTab(StringTableBuilder::ELF), Quiet(Quiet),
+ InputHasMergedFunctions(InputHasMergedFunctions) {
insertFile(StringRef());
}
@@ -314,12 +315,16 @@ llvm::Error GsymCreator::finalize(OutputAggregator &Out) {
std::swap(Prev, Curr);
}
} else {
- Out.Report("Overlapping function ranges", [&](raw_ostream &OS) {
- // print warnings about overlaps
- OS << "warning: function ranges overlap:\n"
- << Prev << "\n"
- << Curr << "\n";
- });
+ // Equal ranges are invalid only in the case where merged functions
+ // are not expected.
+ if (!InputHasMergedFunctions) {
+ Out.Report("Overlapping function ranges", [&](raw_ostream &OS) {
+ // print warnings about overlaps
+ OS << "warning: function ranges overlap:\n"
+ << Prev << "\n"
+ << Curr << "\n";
+ });
+ }
FinalizedFuncs.emplace_back(std::move(Curr));
}
} else {
diff --git a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-merged-funcs-dwarf.yaml b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-merged-funcs-dwarf.yaml
index 6bf359cbe1ee15..1fe0127bee3412 100644
--- a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-merged-funcs-dwarf.yaml
+++ b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-merged-funcs-dwarf.yaml
@@ -1,16 +1,18 @@
# RUN: yaml2obj %s -o %t.dSYM
## Verify that we don't keep merged functions by default
-# RUN: llvm-gsymutil --num-threads=1 --convert %t.dSYM --out-file=%t.default.gSYM
+# RUN: llvm-gsymutil --num-threads=1 --convert %t.dSYM --out-file=%t.default.gSYM | FileCheck --check-prefix=CHECK-GSYM-CREATE-NOMERGE %s
# RUN: llvm-gsymutil --verify --verbose %t.default.gSYM | FileCheck --check-prefix=CHECK-GSYM-DEFAULT %s
## Verify that we keep merged functions when specyfing --merged-functions
-# RUN: llvm-gsymutil --num-threads=1 --convert %t.dSYM --out-file=%t.keep.gSYM --merged-functions
+# RUN: llvm-gsymutil --num-threads=1 --convert %t.dSYM --out-file=%t.keep.gSYM --merged-functions | FileCheck --check-prefix=CHECK-GSYM-CREATE-MERGE %s
# RUN: llvm-gsymutil --verify --verbose %t.keep.gSYM | FileCheck --check-prefix=CHECK-GSYM-KEEP %s
## Note: For identical functions, the dSYM / gSYM cannot be counted on to be deterministic.
## So we can only match the general structure, not exact function names / offsets
+# CHECK-GSYM-CREATE-NOMERGE: warning: same address range contains different debug info.
+# CHECK-GSYM-CREATE-MERGE-NOT: warning: same address range contains different debug info.
# CHECK-GSYM-DEFAULT-NOT: Merged FunctionInfos
# CHECK-GSYM-DEFAULT: FunctionInfo @ 0x{{[0-9a-fA-F]+}}: [0x{{[0-9a-fA-F]+}} - 0x{{[0-9a-fA-F]+}}) "my_func_03"
diff --git a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
index 654da68bb69600..6cafe68aaca18e 100644
--- a/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp
@@ -330,7 +330,7 @@ static llvm::Error handleObjectFile(ObjectFile &Obj, const std::string &OutFile,
auto ThreadCount =
NumThreads > 0 ? NumThreads : std::thread::hardware_concurrency();
- GsymCreator Gsym(Quiet);
+ GsymCreator Gsym(Quiet, UseMergedFunctions);
// See if we can figure out the base address for a given object file, and if
// we can, then set the base address to use to this value. This will ease
|
kyulee-com
reviewed
Jan 16, 2025
alx32
force-pushed
the
15_no_dup_dbg_warn
branch
from
January 21, 2025 19:43
2db4c32
to
456ca4a
Compare
typo Co-authored-by: Kyungwoo Lee <[email protected]>
Co-authored-by: Kyungwoo Lee <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the input has merged functions, it's expected for the same address range to contain duplicate (and different) debug information. Don't warn about this when merged functions are expected in the input.