mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
Add dump of Win64 EH unwind data.
The new command line option -unwind-info dumps the Win64 EH unwind data to the console. This is a nice feature if you need to debug generated EH data (e.g. from LLVM). Includes a test case. Initial patch by João Matos, extensions and rework by Kai Nacke. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169415 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -104,9 +104,16 @@ static cl::opt<bool>
|
||||
NoShowRawInsn("no-show-raw-insn", cl::desc("When disassembling instructions, "
|
||||
"do not print the instruction bytes."));
|
||||
|
||||
static cl::opt<bool>
|
||||
UnwindInfo("unwind-info", cl::desc("Display unwind information"));
|
||||
|
||||
static cl::alias
|
||||
UnwindInfoShort("u", cl::desc("Alias for --unwind-info"),
|
||||
cl::aliasopt(UnwindInfo));
|
||||
|
||||
static StringRef ToolName;
|
||||
|
||||
static bool error(error_code ec) {
|
||||
bool llvm::error(error_code ec) {
|
||||
if (!ec) return false;
|
||||
|
||||
outs() << ToolName << ": error reading file: " << ec.message() << ".\n";
|
||||
@ -165,7 +172,7 @@ void llvm::DumpBytes(StringRef bytes) {
|
||||
outs() << output;
|
||||
}
|
||||
|
||||
static bool RelocAddressLess(RelocationRef a, RelocationRef b) {
|
||||
bool llvm::RelocAddressLess(RelocationRef a, RelocationRef b) {
|
||||
uint64_t a_addr, b_addr;
|
||||
if (error(a.getAddress(a_addr))) return false;
|
||||
if (error(b.getAddress(b_addr))) return false;
|
||||
@ -573,6 +580,19 @@ static void PrintSymbolTable(const ObjectFile *o) {
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintUnwindInfo(const ObjectFile *o) {
|
||||
outs() << "Unwind info:\n\n";
|
||||
|
||||
if (const COFFObjectFile *coff = dyn_cast<COFFObjectFile>(o)) {
|
||||
printCOFFUnwindInfo(coff);
|
||||
} else {
|
||||
// TODO: Extract DWARF dump tool to objdump.
|
||||
errs() << "This operation is only currently supported "
|
||||
"for COFF object files.\n";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void DumpObject(const ObjectFile *o) {
|
||||
outs() << '\n';
|
||||
outs() << o->getFileName()
|
||||
@ -588,6 +608,8 @@ static void DumpObject(const ObjectFile *o) {
|
||||
PrintSectionContents(o);
|
||||
if (SymbolTable)
|
||||
PrintSymbolTable(o);
|
||||
if (UnwindInfo)
|
||||
PrintUnwindInfo(o);
|
||||
}
|
||||
|
||||
/// @brief Dump each object file in \a a;
|
||||
@ -666,7 +688,8 @@ int main(int argc, char **argv) {
|
||||
&& !Relocations
|
||||
&& !SectionHeaders
|
||||
&& !SectionContents
|
||||
&& !SymbolTable) {
|
||||
&& !SymbolTable
|
||||
&& !UnwindInfo) {
|
||||
cl::PrintHelpMessage();
|
||||
return 2;
|
||||
}
|
||||
|
Reference in New Issue
Block a user