#include "llvm-objdump.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Triple.h"
errs().flush();
}
-void warn(Twine Message) {
- WithColor::warning(errs(), ToolName) << Message << "\n";
-}
-
LLVM_ATTRIBUTE_NORETURN void report_error(StringRef File, Twine Message) {
WithColor::error(errs(), ToolName)
<< "'" << File << "': " << Message << ".\n";
// Sort all the symbols, this allows us to use a simple binary search to find
// a symbol near an address.
- StringSet<> FoundDisasmFuncsSet;
for (std::pair<const SectionRef, SectionSymbolsTy> &SecSyms : AllSymbols)
array_pod_sort(SecSyms.second.begin(), SecSyms.second.end());
array_pod_sort(AbsoluteSymbols.begin(), AbsoluteSymbols.end());
uint64_t Start = std::get<0>(Symbols[SI]);
if (Start < SectionAddr || StopAddress <= Start)
continue;
- else
- FoundDisasmFuncsSet.insert(std::get<1>(Symbols[SI]));
// The end is the section end, the beginning of the next symbol, or
// --stop-address.
}
}
}
- StringSet<> MissingDisasmFuncsSet =
- set_difference(DisasmFuncsSet, FoundDisasmFuncsSet);
- for (StringRef MissingDisasmFunc : MissingDisasmFuncsSet.keys())
- warn("failed to disassemble missing function " + MissingDisasmFunc);
}
static void disassembleObject(const ObjectFile *Obj, bool InlineRelocs) {