xref: /freebsd/contrib/llvm-project/llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp (revision 480093f4440d54b30b3025afeac24b48f2ba7a2e)
10b57cec5SDimitry Andric //===- DWARFDebugAranges.cpp ------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
10*480093f4SDimitry Andric #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
110b57cec5SDimitry Andric #include "llvm/Support/Format.h"
120b57cec5SDimitry Andric #include "llvm/Support/raw_ostream.h"
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric using namespace llvm;
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric void DWARFAddressRange::dump(raw_ostream &OS, uint32_t AddressSize,
17*480093f4SDimitry Andric                              DIDumpOptions DumpOpts,
18*480093f4SDimitry Andric                              const DWARFObject *Obj) const {
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric   OS << (DumpOpts.DisplayRawContents ? " " : "[");
210b57cec5SDimitry Andric   OS << format("0x%*.*" PRIx64 ", ", AddressSize * 2, AddressSize * 2, LowPC)
220b57cec5SDimitry Andric      << format("0x%*.*" PRIx64, AddressSize * 2, AddressSize * 2, HighPC);
230b57cec5SDimitry Andric   OS << (DumpOpts.DisplayRawContents ? "" : ")");
24*480093f4SDimitry Andric 
25*480093f4SDimitry Andric   if (Obj)
26*480093f4SDimitry Andric     DWARFFormValue::dumpAddressSection(*Obj, OS, DumpOpts, SectionIndex);
270b57cec5SDimitry Andric }
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric raw_ostream &llvm::operator<<(raw_ostream &OS, const DWARFAddressRange &R) {
300b57cec5SDimitry Andric   R.dump(OS, /* AddressSize */ 8);
310b57cec5SDimitry Andric   return OS;
320b57cec5SDimitry Andric }
33