LLVM  14.0.0git
FaultMapParser.cpp
Go to the documentation of this file.
1 //===----------------------- FaultMapParser.cpp ---------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
11 #include "llvm/Support/Format.h"
13 
14 using namespace llvm;
15 
17  switch (FT) {
18  default:
19  llvm_unreachable("unhandled fault type!");
21  OS << "FaultingLoad";
22  break;
24  OS << "FaultingLoadStore";
25  break;
27  OS << "FaultingStore";
28  break;
29  }
30 }
31 
35  OS << "Fault kind: ";
37  OS << ", faulting PC offset: " << FFI.getFaultingPCOffset()
38  << ", handling PC offset: " << FFI.getHandlerPCOffset();
39  return OS;
40 }
41 
44  OS << "FunctionAddress: " << format_hex(FI.getFunctionAddr(), 8)
45  << ", NumFaultingPCs: " << FI.getNumFaultingPCs() << "\n";
46  for (unsigned I = 0, E = FI.getNumFaultingPCs(); I != E; ++I)
47  OS << FI.getFunctionFaultInfoAt(I) << "\n";
48  return OS;
49 }
50 
52  OS << "Version: " << format_hex(FMP.getFaultMapVersion(), 2) << "\n";
53  OS << "NumFunctions: " << FMP.getNumFunctions() << "\n";
54 
55  if (FMP.getNumFunctions() == 0)
56  return OS;
57 
59 
60  for (unsigned I = 0, E = FMP.getNumFunctions(); I != E; ++I) {
61  FI = (I == 0) ? FMP.getFirstFunctionInfo() : FI.getNextFunctionInfo();
62  OS << FI;
63  }
64 
65  return OS;
66 }
llvm::FaultMapParser::FaultKind
FaultKind
Definition: FaultMapParser.h:49
llvm::FaultMapParser
A parser for the __llvm_faultmaps section generated by the FaultMaps class declared in llvm/CodeGen/F...
Definition: FaultMapParser.h:25
llvm::FaultMapParser::getFirstFunctionInfo
FunctionInfoAccessor getFirstFunctionInfo() const
Definition: FaultMapParser.h:151
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::FaultMapParser::FunctionInfoAccessor
Definition: FaultMapParser.h:90
ErrorHandling.h
printFaultType
void printFaultType(FaultMapParser::FaultKind FT, raw_ostream &OS)
Definition: FaultMapParser.cpp:16
llvm::FaultMapParser::FaultingStore
@ FaultingStore
Definition: FaultMapParser.h:52
Format.h
llvm::FaultMapParser::FunctionInfoAccessor::getFunctionAddr
FunctionAddrType getFunctionAddr() const
Definition: FaultMapParser.h:113
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition: APFixedPoint.h:230
llvm::FaultMapParser::FaultingLoad
@ FaultingLoad
Definition: FaultMapParser.h:50
llvm::FaultMapParser::FunctionFaultInfoAccessor::getFaultKind
FaultKindType getFaultKind() const
Definition: FaultMapParser.h:77
llvm::FaultMapParser::FaultingLoadStore
@ FaultingLoadStore
Definition: FaultMapParser.h:51
llvm::FaultMapParser::FunctionFaultInfoAccessor::getFaultingPCOffset
FaultingPCOffsetType getFaultingPCOffset() const
Definition: FaultMapParser.h:81
llvm::FaultMapParser::getNumFunctions
NumFunctionsType getNumFunctions() const
Definition: FaultMapParser.h:147
I
#define I(x, y, z)
Definition: MD5.cpp:59
FaultMapParser.h
llvm::FaultMapParser::FunctionFaultInfoAccessor::getHandlerPCOffset
HandlerPCOffsetType getHandlerPCOffset() const
Definition: FaultMapParser.h:85
llvm::FaultMapParser::FunctionInfoAccessor::getNextFunctionInfo
FunctionInfoAccessor getNextFunctionInfo() const
Definition: FaultMapParser.h:128
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
llvm::FaultMapParser::FunctionFaultInfoAccessor
Definition: FaultMapParser.h:56
llvm::FaultMapParser::getFaultMapVersion
FaultMapVersionType getFaultMapVersion() const
Definition: FaultMapParser.h:141
llvm::FaultMapParser::FunctionInfoAccessor::getFunctionFaultInfoAt
FunctionFaultInfoAccessor getFunctionFaultInfoAt(uint32_t Index) const
Definition: FaultMapParser.h:121
llvm::FaultMapParser::FunctionInfoAccessor::getNumFaultingPCs
NumFaultingPCsType getNumFaultingPCs() const
Definition: FaultMapParser.h:117
raw_ostream.h
llvm::format_hex
FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)
format_hex - Output N as a fixed width hexadecimal.
Definition: Format.h:186