llvm.org GIT mirror llvm / b1347c6
llvm-objdump: Split printRuntimeFunction to two small functions. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202781 91177308-0d34-0410-b5e6-96231b3b80d8 Rui Ueyama 5 years ago
1 changed file(s) with 46 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
412412 return false;
413413 }
414414
415 static void printRuntimeFunction(const COFFObjectFile *Obj,
416 const RuntimeFunction &RF,
417 uint64_t SectionOffset,
418 const std::vector &Rels) {
419 outs() << "Function Table:\n";
420
421 outs() << " Start Address: ";
422 printCOFFSymbolAddress(outs(), Rels,
423 SectionOffset +
424 /*offsetof(RuntimeFunction, StartAddress)*/ 0,
425 RF.StartAddress);
426 outs() << "\n";
427
428 outs() << " End Address: ";
429 printCOFFSymbolAddress(outs(), Rels,
430 SectionOffset +
431 /*offsetof(RuntimeFunction, EndAddress)*/ 4,
432 RF.EndAddress);
433 outs() << "\n";
434
435 outs() << " Unwind Info Address: ";
436 printCOFFSymbolAddress(outs(), Rels,
437 SectionOffset +
438 /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
439 RF.UnwindInfoOffset);
440 outs() << "\n";
441
442 ArrayRef XContents;
443 uint64_t UnwindInfoOffset = 0;
444 if (error(getSectionContents(
445 Obj, Rels, SectionOffset +
446 /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
447 XContents, UnwindInfoOffset)))
448 return;
449 if (XContents.empty())
450 return;
451
452 UnwindInfoOffset += RF.UnwindInfoOffset;
453 if (UnwindInfoOffset > XContents.size())
454 return;
455
456 const Win64EH::UnwindInfo *UI = reinterpret_cast(
457 XContents.data() + UnwindInfoOffset);
458
415 static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) {
459416 // The casts to int are required in order to output the value as number.
460417 // Without the casts the value would be interpreted as char data (which
461418 // results in garbage output).
495452 outs().flush();
496453 }
497454
455 static void printRuntimeFunction(const COFFObjectFile *Obj,
456 const RuntimeFunction &RF,
457 uint64_t SectionOffset,
458 const std::vector &Rels) {
459 outs() << "Function Table:\n";
460 outs() << " Start Address: ";
461 printCOFFSymbolAddress(outs(), Rels,
462 SectionOffset +
463 /*offsetof(RuntimeFunction, StartAddress)*/ 0,
464 RF.StartAddress);
465 outs() << "\n";
466
467 outs() << " End Address: ";
468 printCOFFSymbolAddress(outs(), Rels,
469 SectionOffset +
470 /*offsetof(RuntimeFunction, EndAddress)*/ 4,
471 RF.EndAddress);
472 outs() << "\n";
473
474 outs() << " Unwind Info Address: ";
475 printCOFFSymbolAddress(outs(), Rels,
476 SectionOffset +
477 /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
478 RF.UnwindInfoOffset);
479 outs() << "\n";
480
481 ArrayRef XContents;
482 uint64_t UnwindInfoOffset = 0;
483 if (error(getSectionContents(
484 Obj, Rels, SectionOffset +
485 /*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
486 XContents, UnwindInfoOffset)))
487 return;
488 if (XContents.empty())
489 return;
490
491 UnwindInfoOffset += RF.UnwindInfoOffset;
492 if (UnwindInfoOffset > XContents.size())
493 return;
494
495 const Win64EH::UnwindInfo *UI = reinterpret_cast(
496 XContents.data() + UnwindInfoOffset);
497 printWin64EHUnwindInfo(UI);
498 }
499
498500 void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) {
499501 const coff_file_header *Header;
500502 if (error(Obj->getCOFFHeader(Header)))