mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
Add --quiet option to llvm-gsymutil to suppress output of warnings.
Differential Revision: https://reviews.llvm.org/D102829
This commit is contained in:
parent
ffafbe5131
commit
f35a5b956e
@ -144,10 +144,10 @@ class GsymCreator {
|
|||||||
AddressRanges Ranges;
|
AddressRanges Ranges;
|
||||||
llvm::Optional<uint64_t> BaseAddress;
|
llvm::Optional<uint64_t> BaseAddress;
|
||||||
bool Finalized = false;
|
bool Finalized = false;
|
||||||
|
bool Quiet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
GsymCreator(bool Quiet = false);
|
||||||
GsymCreator();
|
|
||||||
|
|
||||||
/// Save a GSYM file to a stand alone file.
|
/// Save a GSYM file to a stand alone file.
|
||||||
///
|
///
|
||||||
@ -289,6 +289,9 @@ public:
|
|||||||
void setBaseAddress(uint64_t Addr) {
|
void setBaseAddress(uint64_t Addr) {
|
||||||
BaseAddress = Addr;
|
BaseAddress = Addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether the transformation should be quiet, i.e. not output warnings.
|
||||||
|
bool isQuiet() const { return Quiet; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gsym
|
} // namespace gsym
|
||||||
|
@ -310,8 +310,10 @@ static void convertFunctionLineTable(raw_ostream &Log, CUInfo &CUI,
|
|||||||
// so break out after printing a warning.
|
// so break out after printing a warning.
|
||||||
auto FirstLE = FI.OptLineTable->first();
|
auto FirstLE = FI.OptLineTable->first();
|
||||||
if (FirstLE && *FirstLE == LE) {
|
if (FirstLE && *FirstLE == LE) {
|
||||||
Log << "warning: duplicate line table detected for DIE:\n";
|
if (!Gsym.isQuiet()) {
|
||||||
Die.dump(Log, 0, DIDumpOptions::getForSingleDIE());
|
Log << "warning: duplicate line table detected for DIE:\n";
|
||||||
|
Die.dump(Log, 0, DIDumpOptions::getForSingleDIE());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Print out (ignore if os == nulls as this is expensive)
|
// Print out (ignore if os == nulls as this is expensive)
|
||||||
Log << "error: line table has addresses that do not "
|
Log << "error: line table has addresses that do not "
|
||||||
@ -390,11 +392,14 @@ void DwarfTransformer::handleDie(raw_ostream &OS, CUInfo &CUI, DWARFDie Die) {
|
|||||||
// and the debug info wasn't able to be stripped from the DWARF. If
|
// and the debug info wasn't able to be stripped from the DWARF. If
|
||||||
// the LowPC isn't zero or -1, then we should emit an error.
|
// the LowPC isn't zero or -1, then we should emit an error.
|
||||||
if (Range.LowPC != 0) {
|
if (Range.LowPC != 0) {
|
||||||
// Unexpected invalid address, emit an error
|
if (!Gsym.isQuiet()) {
|
||||||
Log << "warning: DIE has an address range whose start address is "
|
// Unexpected invalid address, emit a warning
|
||||||
"not in any executable sections (" <<
|
Log << "warning: DIE has an address range whose start address is "
|
||||||
*Gsym.GetValidTextRanges() << ") and will not be processed:\n";
|
"not in any executable sections ("
|
||||||
Die.dump(Log, 0, DIDumpOptions::getForSingleDIE());
|
<< *Gsym.GetValidTextRanges()
|
||||||
|
<< ") and will not be processed:\n";
|
||||||
|
Die.dump(Log, 0, DIDumpOptions::getForSingleDIE());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace gsym;
|
using namespace gsym;
|
||||||
|
|
||||||
GsymCreator::GsymCreator() : StrTab(StringTableBuilder::ELF) {
|
GsymCreator::GsymCreator(bool Quiet)
|
||||||
|
: StrTab(StringTableBuilder::ELF), Quiet(Quiet) {
|
||||||
insertFile(StringRef());
|
insertFile(StringRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,25 +249,30 @@ llvm::Error GsymCreator::finalize(llvm::raw_ostream &OS) {
|
|||||||
// the latter.
|
// the latter.
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
OS << "warning: same address range contains "
|
if (!Quiet) {
|
||||||
"different debug "
|
OS << "warning: same address range contains "
|
||||||
<< "info. Removing:\n"
|
"different debug "
|
||||||
<< Prev << "\nIn favor of this one:\n"
|
<< "info. Removing:\n"
|
||||||
<< Curr << "\n";
|
<< Prev << "\nIn favor of this one:\n"
|
||||||
|
<< Curr << "\n";
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// print warnings about overlaps
|
if (!Quiet) { // print warnings about overlaps
|
||||||
OS << "warning: function ranges overlap:\n"
|
OS << "warning: function ranges overlap:\n"
|
||||||
<< Prev << "\n"
|
<< Prev << "\n"
|
||||||
<< Curr << "\n";
|
<< Curr << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (Prev.Range.size() == 0 &&
|
} else if (Prev.Range.size() == 0 &&
|
||||||
Curr.Range.contains(Prev.Range.Start)) {
|
Curr.Range.contains(Prev.Range.Start)) {
|
||||||
OS << "warning: removing symbol:\n"
|
if (!Quiet) {
|
||||||
<< Prev << "\nKeeping:\n"
|
OS << "warning: removing symbol:\n"
|
||||||
<< Curr << "\n";
|
<< Prev << "\nKeeping:\n"
|
||||||
|
<< Curr << "\n";
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ HELP: --arch=<arch>
|
|||||||
HELP: --convert=<path>
|
HELP: --convert=<path>
|
||||||
HELP: --num-threads=<n>
|
HELP: --num-threads=<n>
|
||||||
HELP: --out-file=<path>
|
HELP: --out-file=<path>
|
||||||
|
HELP: --quiet
|
||||||
HELP: --verify
|
HELP: --verify
|
||||||
HELP: Generic Options:
|
HELP: Generic Options:
|
||||||
HELP: --help
|
HELP: --help
|
||||||
|
@ -108,6 +108,10 @@ static opt<unsigned>
|
|||||||
"number of cores on the current machine."),
|
"number of cores on the current machine."),
|
||||||
cl::value_desc("n"), cat(ConversionOptions));
|
cl::value_desc("n"), cat(ConversionOptions));
|
||||||
|
|
||||||
|
static opt<bool>
|
||||||
|
Quiet("quiet", desc("Do not output warnings about the debug information"),
|
||||||
|
cat(ConversionOptions));
|
||||||
|
|
||||||
static list<uint64_t> LookupAddresses("address",
|
static list<uint64_t> LookupAddresses("address",
|
||||||
desc("Lookup an address in a GSYM file"),
|
desc("Lookup an address in a GSYM file"),
|
||||||
cl::value_desc("addr"),
|
cl::value_desc("addr"),
|
||||||
@ -281,7 +285,7 @@ static llvm::Error handleObjectFile(ObjectFile &Obj,
|
|||||||
NumThreads > 0 ? NumThreads : std::thread::hardware_concurrency();
|
NumThreads > 0 ? NumThreads : std::thread::hardware_concurrency();
|
||||||
auto &OS = outs();
|
auto &OS = outs();
|
||||||
|
|
||||||
GsymCreator Gsym;
|
GsymCreator Gsym(Quiet);
|
||||||
|
|
||||||
// See if we can figure out the base address for a given object file, and if
|
// 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
|
// we can, then set the base address to use to this value. This will ease
|
||||||
|
Loading…
Reference in New Issue
Block a user