1*5ffd83dbSDimitry Andric //===-- MemoryRegionInfo.cpp ----------------------------------------------===// 2480093f4SDimitry Andric // 3480093f4SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4480093f4SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5480093f4SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6480093f4SDimitry Andric // 7480093f4SDimitry Andric //===----------------------------------------------------------------------===// 8480093f4SDimitry Andric 9480093f4SDimitry Andric #include "lldb/Target/MemoryRegionInfo.h" 10480093f4SDimitry Andric 11480093f4SDimitry Andric using namespace lldb_private; 12480093f4SDimitry Andric 13480093f4SDimitry Andric llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS, 14480093f4SDimitry Andric const MemoryRegionInfo &Info) { 15480093f4SDimitry Andric return OS << llvm::formatv("MemoryRegionInfo([{0}, {1}), {2:r}{3:w}{4:x}, " 16480093f4SDimitry Andric "{5}, `{6}`, {7}, {8})", 17480093f4SDimitry Andric Info.GetRange().GetRangeBase(), 18480093f4SDimitry Andric Info.GetRange().GetRangeEnd(), Info.GetReadable(), 19480093f4SDimitry Andric Info.GetWritable(), Info.GetExecutable(), 20480093f4SDimitry Andric Info.GetMapped(), Info.GetName(), Info.GetFlash(), 21480093f4SDimitry Andric Info.GetBlocksize()); 22480093f4SDimitry Andric } 23480093f4SDimitry Andric 24480093f4SDimitry Andric void llvm::format_provider<MemoryRegionInfo::OptionalBool>::format( 25480093f4SDimitry Andric const MemoryRegionInfo::OptionalBool &B, raw_ostream &OS, 26480093f4SDimitry Andric StringRef Options) { 27480093f4SDimitry Andric assert(Options.size() <= 1); 28480093f4SDimitry Andric bool Empty = Options.empty(); 29480093f4SDimitry Andric switch (B) { 30480093f4SDimitry Andric case lldb_private::MemoryRegionInfo::eNo: 31480093f4SDimitry Andric OS << (Empty ? "no" : "-"); 32480093f4SDimitry Andric return; 33480093f4SDimitry Andric case lldb_private::MemoryRegionInfo::eYes: 34480093f4SDimitry Andric OS << (Empty ? "yes" : Options); 35480093f4SDimitry Andric return; 36480093f4SDimitry Andric case lldb_private::MemoryRegionInfo::eDontKnow: 37480093f4SDimitry Andric OS << (Empty ? "don't know" : "?"); 38480093f4SDimitry Andric return; 39480093f4SDimitry Andric } 40480093f4SDimitry Andric } 41