llvm.org GIT mirror llvm / ea83f22
[llvm-rtdyld] Use report_fatal_error(). This is a first step towards saner/uniform error reporting in llvm-rtdyld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253759 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 3 years ago
1 changed file(s) with 13 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
462462 std::string SectionIDStr = Mapping.substr(0, EqualsIdx);
463463 size_t ComaIdx = Mapping.find_first_of(",");
464464
465 if (ComaIdx == StringRef::npos) {
466 errs() << "Invalid section specification '" << Mapping
467 << "'. Should be ',
='\n";
468 exit(1);
469 }
465 if (ComaIdx == StringRef::npos)
466 report_fatal_error("Invalid section specification '" + Mapping +
467 "'. Should be ',
='");
470468
471469 std::string FileName = SectionIDStr.substr(0, ComaIdx);
472470 std::string SectionName = SectionIDStr.substr(ComaIdx + 1);
476474 std::tie(OldAddrInt, ErrorMsg) =
477475 Checker.getSectionAddr(FileName, SectionName, true);
478476
479 if (ErrorMsg != "") {
480 errs() << ErrorMsg;
481 exit(1);
482 }
477 if (ErrorMsg != "")
478 report_fatal_error(ErrorMsg);
483479
484480 void* OldAddr = reinterpret_cast(static_cast(OldAddrInt));
485481
486482 std::string NewAddrStr = Mapping.substr(EqualsIdx + 1);
487483 uint64_t NewAddr;
488484
489 if (StringRef(NewAddrStr).getAsInteger(0, NewAddr)) {
490 errs() << "Invalid section address in mapping '" << Mapping << "'.\n";
491 exit(1);
492 }
485 if (StringRef(NewAddrStr).getAsInteger(0, NewAddr))
486 report_fatal_error("Invalid section address in mapping '" + Mapping +
487 "'.");
493488
494489 Checker.getRTDyld().mapSectionAddress(OldAddr, NewAddr);
495490 SpecificMappings[OldAddr] = NewAddr;
578573 for (const auto &Mapping : DummySymbolMappings) {
579574 size_t EqualsIdx = Mapping.find_first_of("=");
580575
581 if (EqualsIdx == StringRef::npos) {
582 errs() << "Invalid dummy symbol specification '" << Mapping
583 << "'. Should be '='\n";
584 exit(1);
585 }
576 if (EqualsIdx == StringRef::npos)
577 report_fatal_error("Invalid dummy symbol specification '" + Mapping +
578 "'. Should be '='");
586579
587580 std::string Symbol = Mapping.substr(0, EqualsIdx);
588581 std::string AddrStr = Mapping.substr(EqualsIdx + 1);
589582
590583 uint64_t Addr;
591 if (StringRef(AddrStr).getAsInteger(0, Addr)) {
592 errs() << "Invalid symbol mapping '" << Mapping << "'.\n";
593 exit(1);
594 }
584 if (StringRef(AddrStr).getAsInteger(0, Addr))
585 report_fatal_error("Invalid symbol mapping '" + Mapping + "'.");
595586
596587 MemMgr.addDummySymbol(Symbol, Addr);
597588 }