99  return DWARFFormValue(
F, V);
 
 
  104  DWARFFormValue FormValue(
F);
 
  105  FormValue.
extractValue(U->getDebugInfoExtractor(), OffsetPtr,
 
  106                         U->getFormParams(), U);
 
 
  113  bool Indirect = 
false;
 
  118    case DW_FORM_exprloc:
 
  119    case DW_FORM_block: {
 
  124    case DW_FORM_block1: {
 
  129    case DW_FORM_block2: {
 
  134    case DW_FORM_block4: {
 
  142      DebugInfoData.
getCStr(OffsetPtr);
 
  146    case DW_FORM_ref_addr:
 
  147    case DW_FORM_flag_present:
 
  158    case DW_FORM_ref_sig8:
 
  159    case DW_FORM_ref_sup4:
 
  160    case DW_FORM_ref_sup8:
 
  169    case DW_FORM_sec_offset:
 
  171    case DW_FORM_strp_sup:
 
  172    case DW_FORM_line_strp:
 
  173    case DW_FORM_GNU_ref_alt:
 
  174    case DW_FORM_GNU_strp_alt:
 
  175    case DW_FORM_implicit_const:
 
  176      if (std::optional<uint8_t> FixedSize =
 
  178        *OffsetPtr += *FixedSize;
 
  189    case DW_FORM_ref_udata:
 
  192    case DW_FORM_loclistx:
 
  193    case DW_FORM_rnglistx:
 
  194    case DW_FORM_GNU_addr_index:
 
  195    case DW_FORM_GNU_str_index:
 
  199    case DW_FORM_LLVM_addrx_offset:
 
  204    case DW_FORM_indirect:
 
 
  225    Ctx = &
CU->getContext();
 
  229  bool Indirect = 
false;
 
  230  bool IsBlock = 
false;
 
  231  Value.data = 
nullptr;
 
  239    case DW_FORM_ref_addr: {
 
  241          (Form == DW_FORM_addr) ? 
FP.AddrSize : 
FP.getRefAddrByteSize();
 
  243          Data.getRelocatedValue(
Size, OffsetPtr, &Value.SectionIndex, &Err);
 
  246    case DW_FORM_exprloc:
 
  248      Value.uval = 
Data.getULEB128(OffsetPtr, &Err);
 
  252      Value.uval = 
Data.getU8(OffsetPtr, &Err);
 
  256      Value.uval = 
Data.getU16(OffsetPtr, &Err);
 
  260      Value.uval = 
Data.getU32(OffsetPtr, &Err);
 
  268      Value.uval = 
Data.getU8(OffsetPtr, &Err);
 
  274      Value.uval = 
Data.getU16(OffsetPtr, &Err);
 
  278      Value.uval = 
Data.getU24(OffsetPtr, &Err);
 
  282    case DW_FORM_ref_sup4:
 
  285      Value.uval = 
Data.getRelocatedValue(4, OffsetPtr, 
nullptr, &Err);
 
  289    case DW_FORM_ref_sup8:
 
  290      Value.uval = 
Data.getRelocatedValue(8, OffsetPtr, 
nullptr, &Err);
 
  298      Value.sval = 
Data.getSLEB128(OffsetPtr, &Err);
 
  301    case DW_FORM_ref_udata:
 
  302    case DW_FORM_rnglistx:
 
  303    case DW_FORM_loclistx:
 
  304    case DW_FORM_GNU_addr_index:
 
  305    case DW_FORM_GNU_str_index:
 
  308      Value.uval = 
Data.getULEB128(OffsetPtr, &Err);
 
  310    case DW_FORM_LLVM_addrx_offset:
 
  311      Value.uval = 
Data.getULEB128(OffsetPtr, &Err) << 32;
 
  312      Value.uval |= 
Data.getU32(OffsetPtr, &Err);
 
  315      Value.cstr = 
Data.getCStr(OffsetPtr, &Err);
 
  317    case DW_FORM_indirect:
 
  322    case DW_FORM_sec_offset:
 
  323    case DW_FORM_GNU_ref_alt:
 
  324    case DW_FORM_GNU_strp_alt:
 
  325    case DW_FORM_line_strp:
 
  326    case DW_FORM_strp_sup: {
 
  327      Value.uval = 
Data.getRelocatedValue(
FP.getDwarfOffsetByteSize(),
 
  328                                          OffsetPtr, 
nullptr, &Err);
 
  331    case DW_FORM_flag_present:
 
  334    case DW_FORM_ref_sig8:
 
  335      Value.uval = 
Data.getU64(OffsetPtr, &Err);
 
  337    case DW_FORM_implicit_const:
 
  345  } 
while (Indirect && !Err);
 
  348    Value.data = 
Data.getBytes(OffsetPtr, Value.uval, &Err).bytes_begin();
 
 
  355  uint8_t HexDigits = AddressSize * 2;
 
  356  OS << 
format(
"0x%*.*" PRIx64, HexDigits, HexDigits, 
Address);
 
 
  370  if (!DumpOpts.
Verbose || SectionIndex == -1ULL)
 
  375  OS << 
" \"" << SecRef.Name << 
'\"';
 
  378  if (!SecRef.IsNameUnique)
 
  379    OS << 
format(
" [%" PRIu64 
"]", SectionIndex);
 
 
  384  bool CURelativeOffset = 
false;
 
  398  case DW_FORM_GNU_addr_index:
 
  399  case DW_FORM_LLVM_addrx_offset: {
 
  401      OS << 
"<invalid dwarf unit>";
 
  406      if (Form == DW_FORM_LLVM_addrx_offset) {
 
  416      OS << 
"<unresolved>";
 
  419  case DW_FORM_flag_present:
 
  432  case DW_FORM_ref_sig8:
 
  433    AddrOS << 
format(
"0x%016" PRIx64, UValue);
 
  436    OS << 
format(
"0x%016" PRIx64, UValue);
 
  439    OS << format_bytes(ArrayRef<uint8_t>(Value.data, 16), std::nullopt, 16, 16);
 
  446  case DW_FORM_exprloc:
 
  453      case DW_FORM_exprloc:
 
  455        AddrOS << 
format(
"<0x%" PRIx64 
"> ", UValue);
 
  470      const uint8_t *DataPtr = Value.data;
 
  473        const uint8_t *EndDataPtr = DataPtr + UValue;
 
  474        while (DataPtr < EndDataPtr) {
 
  475          AddrOS << 
format(
"%2.2x ", *DataPtr);
 
  484  case DW_FORM_implicit_const:
 
  492      OS << 
format(
" .debug_str[0x%0*" PRIx64 
"] = ", OffsetDumpWidth, UValue);
 
  495  case DW_FORM_line_strp:
 
  497      OS << 
format(
" .debug_line_str[0x%0*" PRIx64 
"] = ", OffsetDumpWidth,
 
  506  case DW_FORM_GNU_str_index:
 
  511  case DW_FORM_GNU_strp_alt:
 
  513      OS << 
format(
"alt indirect string, offset: 0x%" PRIx64 
"", UValue);
 
  516  case DW_FORM_ref_addr:
 
  517    AddrOS << 
format(
"0x%016" PRIx64, UValue);
 
  520    CURelativeOffset = 
true;
 
  525    CURelativeOffset = 
true;
 
  530    CURelativeOffset = 
true;
 
  535    CURelativeOffset = 
true;
 
  537      AddrOS << 
format(
"cu + 0x%8.8" PRIx64, UValue);
 
  539  case DW_FORM_ref_udata:
 
  540    CURelativeOffset = 
true;
 
  542      AddrOS << 
format(
"cu + 0x%" PRIx64, UValue);
 
  544  case DW_FORM_GNU_ref_alt:
 
  545    AddrOS << 
format(
"<alt 0x%" PRIx64 
">", UValue);
 
  550  case DW_FORM_indirect:
 
  551    OS << 
"DW_FORM_indirect";
 
  554  case DW_FORM_rnglistx:
 
  558  case DW_FORM_loclistx:
 
  562  case DW_FORM_sec_offset:
 
  563    AddrOS << 
format(
"0x%0*" PRIx64, OffsetDumpWidth, UValue);
 
  567    OS << 
format(
"DW_FORM(0x%4.4x)", Form);
 
  571  if (CURelativeOffset) {
 
  576          << 
format(
"0x%8.8" PRIx64, UValue + (U ? U->getOffset() : 0));
 
 
  582void DWARFFormValue::dumpString(
raw_ostream &OS)
 const {
 
  586    COS.get().write_escaped(*DbgStr);
 
  595  if (Form == DW_FORM_string)
 
  598  if (Form == DW_FORM_GNU_strp_alt || C == 
nullptr)
 
  602  std::optional<uint32_t> 
Index;
 
  603  if (Form == DW_FORM_GNU_str_index || Form == DW_FORM_strx ||
 
  604      Form == DW_FORM_strx1 || Form == DW_FORM_strx2 || Form == DW_FORM_strx3 ||
 
  605      Form == DW_FORM_strx4) {
 
  608                                     "available without a DWARFUnit",
 
  618  bool IsDebugLineString = Form == DW_FORM_line_strp;
 
  620      IsDebugLineString ? C->getLineStringExtractor()
 
  621                        : U ? U->getStringExtractor() : C->getStringExtractor();
 
  626    Msg += (
" uses index " + 
Twine(*
Index) + 
", but the referenced string").str();
 
  627  Msg += (
" offset " + 
Twine(
Offset) + 
" is beyond " +
 
  628          (IsDebugLineString ? 
".debug_line_str" : 
".debug_str") + 
" bounds")
 
 
  644  bool AddrOffset = Form == dwarf::DW_FORM_LLVM_addrx_offset;
 
  645  if (Form == DW_FORM_GNU_addr_index || Form == DW_FORM_addrx ||
 
  646      Form == DW_FORM_addrx1 || Form == DW_FORM_addrx2 ||
 
  647      Form == DW_FORM_addrx3 || Form == DW_FORM_addrx4 || AddrOffset) {
 
  649    uint32_t Index = AddrOffset ? (Value.uval >> 32) : Value.uval;
 
  652    std::optional<object::SectionedAddress> SA =
 
  653        U->getAddrOffsetSectionItem(
Index);
 
  657      SA->Address += (Value.uval & 0xffffffff);
 
  660  return {{Value.uval, Value.SectionIndex}};
 
 
  663std::optional<object::SectionedAddress>
 
  674  case DW_FORM_ref_udata:
 
 
  684  if (Form == DW_FORM_ref_addr)
 
 
  690  if (Form == DW_FORM_ref_sig8)
 
 
  697  case DW_FORM_GNU_ref_alt:
 
  698  case DW_FORM_ref_sup4:
 
  699  case DW_FORM_ref_sup8:
 
 
  714      Form == DW_FORM_sdata)
 
 
  721      (Form == DW_FORM_udata &&
 
  722       uint64_t(std::numeric_limits<int64_t>::max()) < Value.uval))
 
  726    return int32_t(Value.uval);
 
  728    return int16_t(Value.uval);
 
  730    return int8_t(Value.uval);
 
 
  740      Form != DW_FORM_data16)
 
  742  return ArrayRef(Value.data, Value.uval);
 
 
  757std::optional<std::string>
 
  763    std::string FileName;
 
 
  778  case DW_FORM_GNU_ref_alt:
 
  780  case DW_FORM_GNU_addr_index:
 
  782  case DW_FORM_GNU_str_index:
 
  783  case DW_FORM_GNU_strp_alt:
 
  785  case DW_FORM_LLVM_addrx_offset:
 
  788  case DW_FORM_line_strp:
 
 
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
 
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
 
This file contains constants used for implementing Dwarf debug support.
 
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
 
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
 
const DWARFDebugLine::LineTable * getLineTableForUnit(DWARFUnit *U)
Get a pointer to a parsed line table corresponding to a compile unit.
 
virtual ArrayRef< SectionName > getSectionNames() const
 
DWARFContext & getContext() const
 
const char * getCompilationDir()
 
Lightweight error class with error context and mandatory checking.
 
static ErrorSuccess success()
Create a success value.
 
Tagged union holding either a T or a Error.
 
Error takeError()
Take ownership of the stored error.
 
std::string str() const
str - Get the contents as an std::string.
 
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
 
An RAII object that temporarily switches an output stream to a specific color.
 
This class implements an extremely fast bulk output stream that can only output to a stream.
 
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '\t', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an esca...
 
LLVM_ABI StringRef FormEncodingString(unsigned Encoding)
 
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
 
static constexpr StringLiteral SectionNames[SectionKindsNum]
 
Calculates the starting offsets for various sections within the .debug_names section.
 
std::optional< const char * > toString(const std::optional< DWARFFormValue > &V)
Take an optional DWARFFormValue and try to extract a string value from it.
 
LLVM_ABI bool doesFormBelongToClass(dwarf::Form Form, DWARFFormValue::FormClass FC, uint16_t DwarfVersion)
Check whether specified Form belongs to the FC class.
 
LLVM_ABI std::optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
 
uint8_t getDwarfOffsetByteSize(DwarfFormat Format)
The size of a reference determined by the DWARF 32/64-bit format.
 
This is an optimization pass for GlobalISel generic memory operations.
 
bool errorToBool(Error Err)
Helper for converting an Error to a bool.
 
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
 
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
 
LLVM_ABI raw_ostream & nulls()
This returns a reference to a raw_ostream which simply discards output.
 
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
 
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
 
FunctionAddr VTableAddr uintptr_t uintptr_t Data
 
ArrayRef(const T &OneElt) -> ArrayRef< T >
 
PointerUnion< const Value *, const PseudoSourceValue * > ValueType
 
Container for dump options that control which debug information will be dumped.