summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/FaultMaps.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/FaultMaps.cpp')
-rw-r--r--lib/CodeGen/FaultMaps.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/CodeGen/FaultMaps.cpp b/lib/CodeGen/FaultMaps.cpp
index 0512ff9..2acafaf 100644
--- a/lib/CodeGen/FaultMaps.cpp
+++ b/lib/CodeGen/FaultMaps.cpp
@@ -112,3 +112,39 @@ const char *FaultMaps::faultTypeToString(FaultMaps::FaultKind FT) {
return "FaultingLoad";
}
}
+
+raw_ostream &llvm::
+operator<<(raw_ostream &OS,
+ const FaultMapParser::FunctionFaultInfoAccessor &FFI) {
+ OS << "Fault kind: "
+ << FaultMaps::faultTypeToString((FaultMaps::FaultKind)FFI.getFaultKind())
+ << ", faulting PC offset: " << FFI.getFaultingPCOffset()
+ << ", handling PC offset: " << FFI.getHandlerPCOffset();
+ return OS;
+}
+
+raw_ostream &llvm::
+operator<<(raw_ostream &OS, const FaultMapParser::FunctionInfoAccessor &FI) {
+ OS << "FunctionAddress: " << format_hex(FI.getFunctionAddr(), 8)
+ << ", NumFaultingPCs: " << FI.getNumFaultingPCs() << "\n";
+ for (unsigned i = 0, e = FI.getNumFaultingPCs(); i != e; ++i)
+ OS << FI.getFunctionFaultInfoAt(i) << "\n";
+ return OS;
+}
+
+raw_ostream &llvm::operator<<(raw_ostream &OS, const FaultMapParser &FMP) {
+ OS << "Version: " << format_hex(FMP.getFaultMapVersion(), 2) << "\n";
+ OS << "NumFunctions: " << FMP.getNumFunctions() << "\n";
+
+ if (FMP.getNumFunctions() == 0)
+ return OS;
+
+ FaultMapParser::FunctionInfoAccessor FI;
+
+ for (unsigned i = 0, e = FMP.getNumFunctions(); i != e; ++i) {
+ FI = (i == 0) ? FMP.getFirstFunctionInfo() : FI.getNextFunctionInfo();
+ OS << FI;
+ }
+
+ return OS;
+}
OpenPOWER on IntegriCloud