[dwarfdump] Pretty print location expressions and location lists

Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771

I can't seem to commandeer the old review, so I'm creating a new one.

With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:

    DW_AT_location [DW_FORM_data4]        (0x00000000
       0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
       0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
       0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
       0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)

And like this for debug_loc.dwo entries:
    DW_AT_location [DW_FORM_sec_offset]   (0x00000000
      Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
      Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)

Simple locations without ranges are printed inline:

   DW_AT_location [DW_FORM_block1]       (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)

The debug_loc(.dwo) dumping in changed accordingly to factor the code.

Reviewers: dblaikie, aprantl, friss

Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere

Differential Revision: https://reviews.llvm.org/D37123

llvm-svn: 312042
This commit is contained in:
Reid Kleckner 2017-08-29 21:41:21 +00:00
parent 2d69c924f7
commit a058736c9c
90 changed files with 1059 additions and 596 deletions

View File

@ -43,6 +43,7 @@
namespace llvm { namespace llvm {
class DataExtractor; class DataExtractor;
class MCRegisterInfo;
class MemoryBuffer; class MemoryBuffer;
class raw_ostream; class raw_ostream;
@ -85,6 +86,8 @@ class DWARFContext : public DIContext {
bool CheckedForDWP = false; bool CheckedForDWP = false;
std::string DWPName; std::string DWPName;
std::unique_ptr<MCRegisterInfo> RegInfo;
/// Read compile units from the debug_info section (if necessary) /// Read compile units from the debug_info section (if necessary)
/// and store them in CUs. /// and store them in CUs.
void parseCompileUnits(); void parseCompileUnits();
@ -106,9 +109,9 @@ protected:
public: public:
DWARFContext(std::unique_ptr<const DWARFObject> DObj, DWARFContext(std::unique_ptr<const DWARFObject> DObj,
std::string DWPName = "") std::string DWPName = "");
: DIContext(CK_DWARF), DWPName(std::move(DWPName)), ~DWARFContext();
DObj(std::move(DObj)) {}
DWARFContext(DWARFContext &) = delete; DWARFContext(DWARFContext &) = delete;
DWARFContext &operator=(DWARFContext &) = delete; DWARFContext &operator=(DWARFContext &) = delete;
@ -243,6 +246,8 @@ public:
std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath); std::shared_ptr<DWARFContext> getDWOContext(StringRef AbsolutePath);
const MCRegisterInfo *getRegisterInfo() const { return RegInfo.get(); }
/// Function used to handle default error reporting policy. Prints a error /// Function used to handle default error reporting policy. Prints a error
/// message and returns Continue, so DWARF context ignores the error. /// message and returns Continue, so DWARF context ignores the error.
static ErrorPolicy defaultErrorHandler(Error E); static ErrorPolicy defaultErrorHandler(Error E);
@ -255,6 +260,11 @@ public:
create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections, create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost); uint8_t AddrSize, bool isLittleEndian = sys::IsLittleEndianHost);
/// Loads register info for the architecture of the provided object file.
/// Improves readability of dumped DWARF expressions. Requires the caller to
/// have initialized the relevant target descriptions.
Error loadRegisterInfo(const object::ObjectFile &Obj);
private: private:
/// Return the compile unit that includes an offset (relative to .debug_info). /// Return the compile unit that includes an offset (relative to .debug_info).
DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset); DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset);

View File

@ -10,16 +10,19 @@
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h" #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include <cstdint> #include <cstdint>
namespace llvm { namespace llvm {
class DWARFUnit;
class MCRegisterInfo;
class raw_ostream; class raw_ostream;
class DWARFDebugLoc { class DWARFDebugLoc {
public:
/// A single location within a location list. /// A single location within a location list.
struct Entry { struct Entry {
/// The beginning address of the instruction range. /// The beginning address of the instruction range.
@ -27,7 +30,7 @@ class DWARFDebugLoc {
/// The ending address of the instruction range. /// The ending address of the instruction range.
uint64_t End; uint64_t End;
/// The location of the variable within the specified range. /// The location of the variable within the specified range.
SmallVector<unsigned char, 4> Loc; SmallVector<char, 4> Loc;
}; };
/// A list of locations that contain one variable. /// A list of locations that contain one variable.
@ -37,42 +40,64 @@ class DWARFDebugLoc {
unsigned Offset; unsigned Offset;
/// All the locations in which the variable is stored. /// All the locations in which the variable is stored.
SmallVector<Entry, 2> Entries; SmallVector<Entry, 2> Entries;
/// Dump this list on OS.
void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
const MCRegisterInfo *MRI, unsigned Indent) const;
}; };
private:
using LocationLists = SmallVector<LocationList, 4>; using LocationLists = SmallVector<LocationList, 4>;
/// A list of all the variables in the debug_loc section, each one describing /// A list of all the variables in the debug_loc section, each one describing
/// the locations in which the variable is stored. /// the locations in which the variable is stored.
LocationLists Locations; LocationLists Locations;
unsigned AddressSize;
bool IsLittleEndian;
public: public:
/// Print the location lists found within the debug_loc section. /// Print the location lists found within the debug_loc section.
void dump(raw_ostream &OS) const; void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo) const;
/// Parse the debug_loc section accessible via the 'data' parameter using the /// Parse the debug_loc section accessible via the 'data' parameter using the
/// address size also given in 'data' to interpret the address ranges. /// address size also given in 'data' to interpret the address ranges.
void parse(const DWARFDataExtractor &data); void parse(const DWARFDataExtractor &data);
Optional<LocationList> parseOneLocationList(DWARFDataExtractor Data,
uint32_t *Offset);
}; };
class DWARFDebugLocDWO { class DWARFDebugLocDWO {
public:
struct Entry { struct Entry {
uint64_t Start; uint64_t Start;
uint32_t Length; uint32_t Length;
SmallVector<unsigned char, 4> Loc; SmallVector<char, 4> Loc;
}; };
struct LocationList { struct LocationList {
unsigned Offset; unsigned Offset;
SmallVector<Entry, 2> Entries; SmallVector<Entry, 2> Entries;
void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
const MCRegisterInfo *RegInfo, unsigned Indent) const;
}; };
private:
using LocationLists = SmallVector<LocationList, 4>; using LocationLists = SmallVector<LocationList, 4>;
LocationLists Locations; LocationLists Locations;
unsigned AddressSize;
bool IsLittleEndian;
public: public:
void parse(DataExtractor data); void parse(DataExtractor data);
void dump(raw_ostream &OS) const; void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo) const;
static Optional<LocationList> parseOneLocationList(DataExtractor Data,
uint32_t *Offset);
}; };
} // end namespace llvm } // end namespace llvm

View File

@ -0,0 +1,151 @@
//===--- DWARFExpression.h - DWARF Expression handling ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_DEBUGINFO_DWARFEXPRESSION_H
#define LLVM_DEBUGINFO_DWARFEXPRESSION_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/DataExtractor.h"
namespace llvm {
class DWARFUnit;
class MCRegisterInfo;
class raw_ostream;
class DWARFExpression {
public:
class iterator;
/// This class represents an Operation in the Expression. Each operation can
/// have up to 2 oprerands.
///
/// An Operation can be in Error state (check with isError()). This
/// means that it couldn't be decoded successfully and if it is the
/// case, all others fields contain undefined values.
class Operation {
public:
/// Size and signedness of expression operations' operands.
enum Encoding : uint8_t {
Size1 = 0,
Size2 = 1,
Size4 = 2,
Size8 = 3,
SizeLEB = 4,
SizeAddr = 5,
SizeRefAddr = 6,
SizeBlock = 7, ///< Preceding operand contains block size
SignBit = 0x8,
SignedSize1 = SignBit | Size1,
SignedSize2 = SignBit | Size2,
SignedSize4 = SignBit | Size4,
SignedSize8 = SignBit | Size8,
SignedSizeLEB = SignBit | SizeLEB,
SizeNA = 0xFF ///< Unused operands get this encoding.
};
enum DwarfVersion : uint8_t {
DwarfNA, ///< Serves as a marker for unused entries
Dwarf2 = 2,
Dwarf3,
Dwarf4
};
/// Description of the encoding of one expression Op.
struct Description {
DwarfVersion Version; ///< Dwarf version where the Op was introduced.
Encoding Op[2]; ///< Encoding for Op operands, or SizeNA.
Description(DwarfVersion Version = DwarfNA, Encoding Op1 = SizeNA,
Encoding Op2 = SizeNA)
: Version(Version) {
Op[0] = Op1;
Op[1] = Op2;
}
};
private:
friend class DWARFExpression::iterator;
uint8_t Opcode; ///< The Op Opcode, DW_OP_<something>.
Description Desc;
bool Error;
uint32_t EndOffset;
uint64_t Operands[2];
public:
Description &getDescription() { return Desc; }
uint8_t getCode() { return Opcode; }
uint64_t getRawOperand(unsigned Idx) { return Operands[Idx]; }
uint32_t getEndOffset() { return EndOffset; }
bool extract(DataExtractor Data, uint16_t Version, uint8_t AddressSize,
uint32_t Offset);
bool isError() { return Error; }
bool print(raw_ostream &OS, const DWARFExpression *U,
const MCRegisterInfo *RegInfo, bool isEH);
};
/// An iterator to go through the expression operations.
class iterator
: public iterator_facade_base<iterator, std::forward_iterator_tag, Operation> {
friend class DWARFExpression;
DWARFExpression *Expr;
uint32_t Offset;
Operation Op;
iterator(DWARFExpression *Expr, uint32_t Offset)
: Expr(Expr), Offset(Offset) {
Op.Error =
Offset >= Expr->Data.getData().size() ||
!Op.extract(Expr->Data, Expr->Version, Expr->AddressSize, Offset);
}
public:
class Operation &operator++() {
Offset = Op.isError() ? Expr->Data.getData().size() : Op.EndOffset;
Op.Error =
Offset >= Expr->Data.getData().size() ||
!Op.extract(Expr->Data, Expr->Version, Expr->AddressSize, Offset);
return Op;
}
class Operation &operator*() {
return Op;
}
// Comparison operators are provided out of line.
friend bool operator==(const iterator &, const iterator &);
};
DWARFExpression(DataExtractor Data, uint16_t Version, uint8_t AddressSize)
: Data(Data), Version(Version), AddressSize(AddressSize) {
assert(AddressSize == 8 || AddressSize == 4);
}
iterator begin() { return iterator(this, 0); }
iterator end() { return iterator(this, Data.getData().size()); }
void print(raw_ostream &OS, const MCRegisterInfo *RegInfo);
private:
DataExtractor Data;
uint16_t Version;
uint8_t AddressSize;
};
inline bool operator==(const DWARFExpression::iterator &LHS,
const DWARFExpression::iterator &RHS) {
return LHS.Expr == RHS.Expr && LHS.Offset == RHS.Offset;
}
inline bool operator!=(const DWARFExpression::iterator &LHS,
const DWARFExpression::iterator &RHS) {
return !(LHS == RHS);
}
}
#endif

View File

@ -15,6 +15,7 @@ add_llvm_library(LLVMDebugInfoDWARF
DWARFDebugPubTable.cpp DWARFDebugPubTable.cpp
DWARFDebugRangeList.cpp DWARFDebugRangeList.cpp
DWARFDie.cpp DWARFDie.cpp
DWARFExpression.cpp
DWARFFormValue.cpp DWARFFormValue.cpp
DWARFGdbIndex.cpp DWARFGdbIndex.cpp
DWARFTypeUnit.cpp DWARFTypeUnit.cpp

View File

@ -31,6 +31,7 @@
#include "llvm/DebugInfo/DWARF/DWARFSection.h" #include "llvm/DebugInfo/DWARF/DWARFSection.h"
#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h" #include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
#include "llvm/DebugInfo/DWARF/DWARFVerifier.h" #include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Object/Decompressor.h" #include "llvm/Object/Decompressor.h"
#include "llvm/Object/MachO.h" #include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h" #include "llvm/Object/ObjectFile.h"
@ -40,6 +41,7 @@
#include "llvm/Support/Error.h" #include "llvm/Support/Error.h"
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
#include <cstdint> #include <cstdint>
@ -59,6 +61,12 @@ using DWARFLineTable = DWARFDebugLine::LineTable;
using FileLineInfoKind = DILineInfoSpecifier::FileLineInfoKind; using FileLineInfoKind = DILineInfoSpecifier::FileLineInfoKind;
using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind; using FunctionNameKind = DILineInfoSpecifier::FunctionNameKind;
DWARFContext::DWARFContext(std::unique_ptr<const DWARFObject> DObj,
std::string DWPName)
: DIContext(CK_DWARF), DWPName(std::move(DWPName)), DObj(std::move(DObj)) {}
DWARFContext::~DWARFContext() = default;
static void dumpAccelSection(raw_ostream &OS, StringRef Name, static void dumpAccelSection(raw_ostream &OS, StringRef Name,
const DWARFObject &Obj, const DWARFObject &Obj,
const DWARFSection &Section, const DWARFSection &Section,
@ -237,12 +245,12 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
if (DumpType == DIDT_All || DumpType == DIDT_Loc) { if (DumpType == DIDT_All || DumpType == DIDT_Loc) {
OS << "\n.debug_loc contents:\n"; OS << "\n.debug_loc contents:\n";
getDebugLoc()->dump(OS); getDebugLoc()->dump(OS, getRegisterInfo());
} }
if (DumpType == DIDT_All || DumpType == DIDT_LocDwo) { if (DumpType == DIDT_All || DumpType == DIDT_LocDwo) {
OS << "\n.debug_loc.dwo contents:\n"; OS << "\n.debug_loc.dwo contents:\n";
getDebugLocDWO()->dump(OS); getDebugLocDWO()->dump(OS, getRegisterInfo());
} }
if (DumpType == DIDT_All || DumpType == DIDT_Frames) { if (DumpType == DIDT_All || DumpType == DIDT_Frames) {
@ -1295,3 +1303,19 @@ DWARFContext::create(const StringMap<std::unique_ptr<MemoryBuffer>> &Sections,
llvm::make_unique<DWARFObjInMemory>(Sections, AddrSize, isLittleEndian); llvm::make_unique<DWARFObjInMemory>(Sections, AddrSize, isLittleEndian);
return llvm::make_unique<DWARFContext>(std::move(DObj), ""); return llvm::make_unique<DWARFContext>(std::move(DObj), "");
} }
Error DWARFContext::loadRegisterInfo(const object::ObjectFile &Obj) {
// Detect the architecture from the object file. We usually don't need OS
// info to lookup a target and create register info.
Triple TT;
TT.setArch(Triple::ArchType(Obj.getArch()));
TT.setVendor(Triple::UnknownVendor);
TT.setOS(Triple::UnknownOS);
std::string TargetLookupError;
const Target *TheTarget =
TargetRegistry::lookupTarget(TT.str(), TargetLookupError);
if (!TargetLookupError.empty())
return make_error<StringError>(TargetLookupError, inconvertibleErrorCode());
RegInfo.reset(TheTarget->createMCRegInfo(TT.str()));
return Error::success();
}

View File

@ -11,7 +11,10 @@
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Dwarf.h" #include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Format.h" #include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
@ -20,104 +23,160 @@
using namespace llvm; using namespace llvm;
void DWARFDebugLoc::dump(raw_ostream &OS) const { // When directly dumping the .debug_loc without a compile unit, we have to guess
// at the DWARF version. This only affects DW_OP_call_ref, which is a rare
// expression that LLVM doesn't produce. Guessing the wrong version means we
// won't be able to pretty print expressions in DWARF2 binaries produced by
// non-LLVM tools.
static void dumpExpression(raw_ostream &OS, ArrayRef<char> Data,
bool IsLittleEndian, unsigned AddressSize,
const MCRegisterInfo *MRI) {
DWARFDataExtractor Extractor(StringRef(Data.data(), Data.size()),
IsLittleEndian, AddressSize);
DWARFExpression(Extractor, AddressSize, dwarf::DWARF_VERSION).print(OS, MRI);
}
void DWARFDebugLoc::LocationList::dump(raw_ostream &OS, bool IsLittleEndian,
unsigned AddressSize,
const MCRegisterInfo *MRI,
unsigned Indent) const {
for (const Entry &E : Entries) {
OS << '\n';
OS.indent(Indent);
OS << format("0x%016" PRIx64, E.Begin) << " - "
<< format("0x%016" PRIx64, E.End) << ": ";
dumpExpression(OS, E.Loc, IsLittleEndian, AddressSize, MRI);
}
}
void DWARFDebugLoc::dump(raw_ostream &OS, const MCRegisterInfo *MRI) const {
for (const LocationList &L : Locations) { for (const LocationList &L : Locations) {
OS << format("0x%8.8x: ", L.Offset); OS << format("0x%8.8x: ", L.Offset);
const unsigned Indent = 12; L.dump(OS, IsLittleEndian, AddressSize, MRI, 12);
for (const Entry &E : L.Entries) { OS << "\n\n";
if (&E != L.Entries.begin()) }
OS.indent(Indent); }
OS << "Beginning address offset: " << format("0x%016" PRIx64, E.Begin)
<< '\n'; Optional<DWARFDebugLoc::LocationList>
OS.indent(Indent) << " Ending address offset: " DWARFDebugLoc::parseOneLocationList(DWARFDataExtractor Data, unsigned *Offset) {
<< format("0x%016" PRIx64, E.End) << '\n'; LocationList LL;
OS.indent(Indent) << " Location description: "; LL.Offset = *Offset;
for (unsigned char Loc : E.Loc) {
OS << format("%2.2x ", Loc); // 2.6.2 Location Lists
} // A location list entry consists of:
OS << "\n\n"; while (true) {
Entry E;
if (!Data.isValidOffsetForDataOfSize(*Offset, 2 * Data.getAddressSize())) {
llvm::errs() << "Location list overflows the debug_loc section.\n";
return None;
} }
// 1. A beginning address offset. ...
E.Begin = Data.getRelocatedAddress(Offset);
// 2. An ending address offset. ...
E.End = Data.getRelocatedAddress(Offset);
// The end of any given location list is marked by an end of list entry,
// which consists of a 0 for the beginning address offset and a 0 for the
// ending address offset.
if (E.Begin == 0 && E.End == 0)
return LL;
if (!Data.isValidOffsetForDataOfSize(*Offset, 2)) {
llvm::errs() << "Location list overflows the debug_loc section.\n";
return None;
}
unsigned Bytes = Data.getU16(Offset);
if (!Data.isValidOffsetForDataOfSize(*Offset, Bytes)) {
llvm::errs() << "Location list overflows the debug_loc section.\n";
return None;
}
// A single location description describing the location of the object...
StringRef str = Data.getData().substr(*Offset, Bytes);
*Offset += Bytes;
E.Loc.reserve(str.size());
std::copy(str.begin(), str.end(), std::back_inserter(E.Loc));
LL.Entries.push_back(std::move(E));
} }
} }
void DWARFDebugLoc::parse(const DWARFDataExtractor &data) { void DWARFDebugLoc::parse(const DWARFDataExtractor &data) {
IsLittleEndian = data.isLittleEndian();
AddressSize = data.getAddressSize();
uint32_t Offset = 0; uint32_t Offset = 0;
while (data.isValidOffset(Offset+data.getAddressSize()-1)) { while (data.isValidOffset(Offset + data.getAddressSize() - 1)) {
Locations.resize(Locations.size() + 1); if (auto LL = parseOneLocationList(data, &Offset))
LocationList &Loc = Locations.back(); Locations.push_back(std::move(*LL));
Loc.Offset = Offset; else
// 2.6.2 Location Lists break;
// A location list entry consists of:
while (true) {
// A beginning and ending address offsets.
Entry E;
E.Begin = data.getRelocatedAddress(&Offset);
E.End = data.getRelocatedAddress(&Offset);
// The end of any given location list is marked by an end of list entry,
// which consists of a 0 for the beginning address offset and a 0 for the
// ending address offset.
if (E.Begin == 0 && E.End == 0)
break;
unsigned Bytes = data.getU16(&Offset);
// A single location description describing the location of the object...
StringRef str = data.getData().substr(Offset, Bytes);
Offset += Bytes;
E.Loc.append(str.begin(), str.end());
Loc.Entries.push_back(std::move(E));
}
} }
if (data.isValidOffset(Offset)) if (data.isValidOffset(Offset))
errs() << "error: failed to consume entire .debug_loc section\n"; errs() << "error: failed to consume entire .debug_loc section\n";
} }
Optional<DWARFDebugLocDWO::LocationList>
DWARFDebugLocDWO::parseOneLocationList(DataExtractor Data, unsigned *Offset) {
LocationList LL;
LL.Offset = *Offset;
// dwarf::DW_LLE_end_of_list_entry is 0 and indicates the end of the list.
while (auto Kind =
static_cast<dwarf::LocationListEntry>(Data.getU8(Offset))) {
if (Kind != dwarf::DW_LLE_startx_length) {
llvm::errs() << "error: dumping support for LLE of kind " << (int)Kind
<< " not implemented\n";
return None;
}
Entry E;
E.Start = Data.getULEB128(Offset);
E.Length = Data.getU32(Offset);
unsigned Bytes = Data.getU16(Offset);
// A single location description describing the location of the object...
StringRef str = Data.getData().substr(*Offset, Bytes);
*Offset += Bytes;
E.Loc.resize(str.size());
std::copy(str.begin(), str.end(), E.Loc.begin());
LL.Entries.push_back(std::move(E));
}
return LL;
}
void DWARFDebugLocDWO::parse(DataExtractor data) { void DWARFDebugLocDWO::parse(DataExtractor data) {
IsLittleEndian = data.isLittleEndian();
AddressSize = data.getAddressSize();
uint32_t Offset = 0; uint32_t Offset = 0;
while (data.isValidOffset(Offset)) { while (data.isValidOffset(Offset)) {
Locations.resize(Locations.size() + 1); if (auto LL = parseOneLocationList(data, &Offset))
LocationList &Loc = Locations.back(); Locations.push_back(std::move(*LL));
Loc.Offset = Offset; else
dwarf::LocationListEntry Kind; return;
while ((Kind = static_cast<dwarf::LocationListEntry>(
data.getU8(&Offset))) != dwarf::DW_LLE_end_of_list) {
if (Kind != dwarf::DW_LLE_startx_length) {
errs() << "error: dumping support for LLE of kind " << (int)Kind
<< " not implemented\n";
return;
}
Entry E;
E.Start = data.getULEB128(&Offset);
E.Length = data.getU32(&Offset);
unsigned Bytes = data.getU16(&Offset);
// A single location description describing the location of the object...
StringRef str = data.getData().substr(Offset, Bytes);
Offset += Bytes;
E.Loc.resize(str.size());
std::copy(str.begin(), str.end(), E.Loc.begin());
Loc.Entries.push_back(std::move(E));
}
} }
} }
void DWARFDebugLocDWO::dump(raw_ostream &OS) const { void DWARFDebugLocDWO::LocationList::dump(raw_ostream &OS, bool IsLittleEndian,
unsigned AddressSize,
const MCRegisterInfo *MRI,
unsigned Indent) const {
for (const Entry &E : Entries) {
OS << '\n';
OS.indent(Indent);
OS << "Addr idx " << E.Start << " (w/ length " << E.Length << "): ";
dumpExpression(OS, E.Loc, IsLittleEndian, AddressSize, MRI);
}
}
void DWARFDebugLocDWO::dump(raw_ostream &OS, const MCRegisterInfo *MRI) const {
for (const LocationList &L : Locations) { for (const LocationList &L : Locations) {
OS << format("0x%8.8x: ", L.Offset); OS << format("0x%8.8x: ", L.Offset);
const unsigned Indent = 12; L.dump(OS, IsLittleEndian, AddressSize, MRI, /*Indent=*/12);
for (const Entry &E : L.Entries) { OS << "\n\n";
if (&E != L.Entries.begin())
OS.indent(Indent);
OS << "Beginning address index: " << E.Start << '\n';
OS.indent(Indent) << " Length: " << E.Length << '\n';
OS.indent(Indent) << " Location description: ";
for (unsigned char Loc : E.Loc)
OS << format("%2.2x ", Loc);
OS << "\n\n";
}
} }
} }

View File

@ -16,6 +16,7 @@
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h" #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h" #include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h" #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h" #include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/Object/ObjectFile.h" #include "llvm/Object/ObjectFile.h"
@ -81,6 +82,47 @@ static void dumpRanges(const DWARFObject &Obj, raw_ostream &OS,
} }
} }
static void dumpLocation(raw_ostream &OS, DWARFFormValue &FormValue,
DWARFUnit *U, unsigned Indent) {
DWARFContext &Ctx = U->getContext();
const DWARFObject &Obj = Ctx.getDWARFObj();
const MCRegisterInfo *MRI = Ctx.getRegisterInfo();
if (FormValue.isFormClass(DWARFFormValue::FC_Block) ||
FormValue.isFormClass(DWARFFormValue::FC_Exprloc)) {
ArrayRef<uint8_t> Expr = *FormValue.getAsBlock();
DataExtractor Data(StringRef((const char *)Expr.data(), Expr.size()),
Ctx.isLittleEndian(), 0);
DWARFExpression(Data, U->getVersion(), U->getAddressByteSize())
.print(OS, MRI);
return;
}
FormValue.dump(OS);
if (FormValue.isFormClass(DWARFFormValue::FC_SectionOffset)) {
const DWARFSection &LocSection = Obj.getLocSection();
const DWARFSection &LocDWOSection = Obj.getLocDWOSection();
uint32_t Offset = *FormValue.getAsSectionOffset();
if (!LocSection.Data.empty()) {
DWARFDebugLoc DebugLoc;
DWARFDataExtractor Data(Obj, LocSection, Ctx.isLittleEndian(),
Obj.getAddressSize());
auto LL = DebugLoc.parseOneLocationList(Data, &Offset);
if (LL)
LL->dump(OS, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, Indent);
else
OS << "error extracting location list.";
} else if (!LocDWOSection.Data.empty()) {
DataExtractor Data(LocDWOSection.Data, Ctx.isLittleEndian(), 0);
auto LL = DWARFDebugLocDWO::parseOneLocationList(Data, &Offset);
if (LL)
LL->dump(OS, Ctx.isLittleEndian(), Obj.getAddressSize(), MRI, Indent);
else
OS << "error extracting location list.";
}
}
}
static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
uint32_t *OffsetPtr, dwarf::Attribute Attr, uint32_t *OffsetPtr, dwarf::Attribute Attr,
dwarf::Form Form, unsigned Indent, dwarf::Form Form, unsigned Indent,
@ -129,6 +171,9 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
WithColor(OS, Color) << Name; WithColor(OS, Color) << Name;
else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line)
OS << *formValue.getAsUnsignedConstant(); OS << *formValue.getAsUnsignedConstant();
else if (Attr == DW_AT_location || Attr == DW_AT_frame_base ||
Attr == DW_AT_data_member_location)
dumpLocation(OS, formValue, U, sizeof(BaseIndent) + Indent + 4);
else else
formValue.dump(OS, DumpOpts); formValue.dump(OS, DumpOpts);

View File

@ -0,0 +1,272 @@
//===-- DWARFExpression.cpp -----------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/Format.h"
#include <cassert>
#include <cstdint>
#include <vector>
using namespace llvm;
using namespace dwarf;
namespace llvm {
typedef std::vector<DWARFExpression::Operation::Description> DescVector;
static DescVector getDescriptions() {
DescVector Descriptions;
typedef DWARFExpression::Operation Op;
typedef Op::Description Desc;
Descriptions.resize(0xff);
Descriptions[DW_OP_addr] = Desc(Op::Dwarf2, Op::SizeAddr);
Descriptions[DW_OP_deref] = Desc(Op::Dwarf2);
Descriptions[DW_OP_const1u] = Desc(Op::Dwarf2, Op::Size1);
Descriptions[DW_OP_const1s] = Desc(Op::Dwarf2, Op::SignedSize1);
Descriptions[DW_OP_const2u] = Desc(Op::Dwarf2, Op::Size2);
Descriptions[DW_OP_const2s] = Desc(Op::Dwarf2, Op::SignedSize2);
Descriptions[DW_OP_const4u] = Desc(Op::Dwarf2, Op::Size4);
Descriptions[DW_OP_const4s] = Desc(Op::Dwarf2, Op::SignedSize4);
Descriptions[DW_OP_const8u] = Desc(Op::Dwarf2, Op::Size8);
Descriptions[DW_OP_const8s] = Desc(Op::Dwarf2, Op::SignedSize8);
Descriptions[DW_OP_constu] = Desc(Op::Dwarf2, Op::SizeLEB);
Descriptions[DW_OP_consts] = Desc(Op::Dwarf2, Op::SignedSizeLEB);
Descriptions[DW_OP_dup] = Desc(Op::Dwarf2);
Descriptions[DW_OP_drop] = Desc(Op::Dwarf2);
Descriptions[DW_OP_over] = Desc(Op::Dwarf2);
Descriptions[DW_OP_pick] = Desc(Op::Dwarf2, Op::Size1);
Descriptions[DW_OP_swap] = Desc(Op::Dwarf2);
Descriptions[DW_OP_rot] = Desc(Op::Dwarf2);
Descriptions[DW_OP_xderef] = Desc(Op::Dwarf2);
Descriptions[DW_OP_abs] = Desc(Op::Dwarf2);
Descriptions[DW_OP_and] = Desc(Op::Dwarf2);
Descriptions[DW_OP_div] = Desc(Op::Dwarf2);
Descriptions[DW_OP_minus] = Desc(Op::Dwarf2);
Descriptions[DW_OP_mod] = Desc(Op::Dwarf2);
Descriptions[DW_OP_mul] = Desc(Op::Dwarf2);
Descriptions[DW_OP_neg] = Desc(Op::Dwarf2);
Descriptions[DW_OP_not] = Desc(Op::Dwarf2);
Descriptions[DW_OP_or] = Desc(Op::Dwarf2);
Descriptions[DW_OP_plus] = Desc(Op::Dwarf2);
Descriptions[DW_OP_plus_uconst] = Desc(Op::Dwarf2, Op::SizeLEB);
Descriptions[DW_OP_shl] = Desc(Op::Dwarf2);
Descriptions[DW_OP_shr] = Desc(Op::Dwarf2);
Descriptions[DW_OP_shra] = Desc(Op::Dwarf2);
Descriptions[DW_OP_xor] = Desc(Op::Dwarf2);
Descriptions[DW_OP_skip] = Desc(Op::Dwarf2, Op::SignedSize2);
Descriptions[DW_OP_bra] = Desc(Op::Dwarf2, Op::SignedSize2);
Descriptions[DW_OP_eq] = Desc(Op::Dwarf2);
Descriptions[DW_OP_ge] = Desc(Op::Dwarf2);
Descriptions[DW_OP_gt] = Desc(Op::Dwarf2);
Descriptions[DW_OP_le] = Desc(Op::Dwarf2);
Descriptions[DW_OP_lt] = Desc(Op::Dwarf2);
Descriptions[DW_OP_ne] = Desc(Op::Dwarf2);
for (uint16_t LA = DW_OP_lit0; LA <= DW_OP_lit31; ++LA)
Descriptions[LA] = Desc(Op::Dwarf2);
for (uint16_t LA = DW_OP_reg0; LA <= DW_OP_reg31; ++LA)
Descriptions[LA] = Desc(Op::Dwarf2);
for (uint16_t LA = DW_OP_breg0; LA <= DW_OP_breg31; ++LA)
Descriptions[LA] = Desc(Op::Dwarf2, Op::SignedSizeLEB);
Descriptions[DW_OP_regx] = Desc(Op::Dwarf2, Op::SizeLEB);
Descriptions[DW_OP_fbreg] = Desc(Op::Dwarf2, Op::SignedSizeLEB);
Descriptions[DW_OP_bregx] = Desc(Op::Dwarf2, Op::SizeLEB, Op::SignedSizeLEB);
Descriptions[DW_OP_piece] = Desc(Op::Dwarf2, Op::SizeLEB);
Descriptions[DW_OP_deref_size] = Desc(Op::Dwarf2, Op::Size1);
Descriptions[DW_OP_xderef_size] = Desc(Op::Dwarf2, Op::Size1);
Descriptions[DW_OP_nop] = Desc(Op::Dwarf2);
Descriptions[DW_OP_push_object_address] = Desc(Op::Dwarf3);
Descriptions[DW_OP_call2] = Desc(Op::Dwarf3, Op::Size2);
Descriptions[DW_OP_call4] = Desc(Op::Dwarf3, Op::Size4);
Descriptions[DW_OP_call_ref] = Desc(Op::Dwarf3, Op::SizeRefAddr);
Descriptions[DW_OP_form_tls_address] = Desc(Op::Dwarf3);
Descriptions[DW_OP_call_frame_cfa] = Desc(Op::Dwarf3);
Descriptions[DW_OP_bit_piece] = Desc(Op::Dwarf3, Op::SizeLEB, Op::SizeLEB);
Descriptions[DW_OP_implicit_value] =
Desc(Op::Dwarf3, Op::SizeLEB, Op::SizeBlock);
Descriptions[DW_OP_stack_value] = Desc(Op::Dwarf3);
Descriptions[DW_OP_GNU_push_tls_address] = Desc(Op::Dwarf3);
Descriptions[DW_OP_GNU_addr_index] = Desc(Op::Dwarf4, Op::SizeLEB);
Descriptions[DW_OP_GNU_const_index] = Desc(Op::Dwarf4, Op::SizeLEB);
return Descriptions;
}
static DWARFExpression::Operation::Description getOpDesc(unsigned OpCode) {
// FIXME: Make this constexpr once all compilers are smart enough to do it.
static DescVector Descriptions = getDescriptions();
assert(OpCode < Descriptions.size());
return Descriptions[OpCode];
}
static uint8_t getRefAddrSize(uint8_t AddrSize, uint16_t Version) {
return (Version == 2) ? AddrSize : 4;
}
bool DWARFExpression::Operation::extract(DataExtractor Data, uint16_t Version,
uint8_t AddressSize, uint32_t Offset) {
Opcode = Data.getU8(&Offset);
Desc = getOpDesc(Opcode);
if (Desc.Version == Operation::DwarfNA)
return false;
for (unsigned Operand = 0; Operand < 2; ++Operand) {
unsigned Size = Desc.Op[Operand];
unsigned Signed = Size & Operation::SignBit;
if (Size == Operation::SizeNA)
break;
switch (Size & ~Operation::SignBit) {
case Operation::Size1:
Operands[Operand] = Data.getU8(&Offset);
if (Signed)
Operands[Operand] = (int8_t)Operands[Operand];
break;
case Operation::Size2:
Operands[Operand] = Data.getU16(&Offset);
if (Signed)
Operands[Operand] = (int16_t)Operands[Operand];
break;
case Operation::Size4:
Operands[Operand] = Data.getU32(&Offset);
if (Signed)
Operands[Operand] = (int32_t)Operands[Operand];
break;
case Operation::Size8:
Operands[Operand] = Data.getU64(&Offset);
break;
case Operation::SizeAddr:
if (AddressSize == 8) {
Operands[Operand] = Data.getU64(&Offset);
} else {
assert(AddressSize == 4);
Operands[Operand] = Data.getU32(&Offset);
}
break;
case Operation::SizeRefAddr:
if (getRefAddrSize(AddressSize, Version) == 8) {
Operands[Operand] = Data.getU64(&Offset);
} else {
assert(getRefAddrSize(AddressSize, Version) == 4);
Operands[Operand] = Data.getU32(&Offset);
}
break;
case Operation::SizeLEB:
if (Signed)
Operands[Operand] = Data.getSLEB128(&Offset);
else
Operands[Operand] = Data.getULEB128(&Offset);
break;
case Operation::SizeBlock:
// We need a size, so this cannot be the first operand
if (Operand == 0)
return false;
// Store the offset of the block as the value.
Operands[Operand] = Offset;
Offset += Operands[Operand - 1];
break;
default:
llvm_unreachable("Unknown DWARFExpression Op size");
}
}
EndOffset = Offset;
return true;
}
static bool prettyPrintRegisterOp(raw_ostream &OS, uint8_t Opcode,
uint64_t Operands[2],
const MCRegisterInfo *MRI, bool isEH) {
if (!MRI)
return false;
uint64_t DwarfRegNum;
unsigned OpNum = 0;
if (Opcode == DW_OP_bregx || Opcode == DW_OP_regx)
DwarfRegNum = Operands[OpNum++];
else if (Opcode >= DW_OP_breg0 && Opcode < DW_OP_bregx)
DwarfRegNum = Opcode - DW_OP_breg0;
else
DwarfRegNum = Opcode - DW_OP_reg0;
int LLVMRegNum = MRI->getLLVMRegNum(DwarfRegNum, isEH);
if (LLVMRegNum >= 0) {
if (const char *RegName = MRI->getName(LLVMRegNum)) {
if ((Opcode >= DW_OP_breg0 && Opcode <= DW_OP_breg31) ||
Opcode == DW_OP_bregx)
OS << format(" %s%+" PRId64, RegName, Operands[OpNum]);
else
OS << ' ' << RegName;
return true;
}
}
return false;
}
bool DWARFExpression::Operation::print(raw_ostream &OS,
const DWARFExpression *Expr,
const MCRegisterInfo *RegInfo,
bool isEH) {
if (Error) {
OS << "decoding error.";
return false;
}
StringRef Name = OperationEncodingString(Opcode);
assert(!Name.empty() && "DW_OP has no name!");
OS << Name;
if ((Opcode >= DW_OP_breg0 && Opcode <= DW_OP_breg31) ||
(Opcode >= DW_OP_reg0 && Opcode <= DW_OP_reg31) ||
Opcode == DW_OP_bregx || Opcode == DW_OP_regx)
if (prettyPrintRegisterOp(OS, Opcode, Operands, RegInfo, isEH))
return true;
for (unsigned Operand = 0; Operand < 2; ++Operand) {
unsigned Size = Desc.Op[Operand];
unsigned Signed = Size & Operation::SignBit;
if (Size == Operation::SizeNA)
break;
if (Size == Operation::SizeBlock) {
uint32_t Offset = Operands[Operand];
for (unsigned i = 0; i < Operands[Operand - 1]; ++i)
OS << format(" 0x%02x", Expr->Data.getU8(&Offset));
} else {
if (Signed)
OS << format(" %+" PRId64, (int64_t)Operands[Operand]);
else
OS << format(" 0x%" PRIx64, Operands[Operand]);
}
}
return true;
}
void DWARFExpression::print(raw_ostream &OS, const MCRegisterInfo *RegInfo) {
for (auto &Op : *this) {
if (!Op.print(OS, this, RegInfo, /* isEH */ false)) {
uint32_t FailOffset = Op.getEndOffset();
while (FailOffset < Data.getData().size())
OS << format(" %02x", Data.getU8(&FailOffset));
return;
}
if (Op.getEndOffset() < Data.getData().size())
OS << ", ";
}
}
} // namespace llvm

View File

@ -19,4 +19,4 @@
type = Library type = Library
name = DebugInfoDWARF name = DebugInfoDWARF
parent = DebugInfo parent = DebugInfo
required_libraries = BinaryFormat Object Support required_libraries = BinaryFormat Object MC Support

View File

@ -9,24 +9,17 @@ target triple = "thumbv7-apple-darwin10"
@x3 = internal global i8 1, align 1, !dbg !6 @x3 = internal global i8 1, align 1, !dbg !6
@x4 = internal global i8 1, align 1, !dbg !8 @x4 = internal global i8 1, align 1, !dbg !8
@x5 = global i8 1, align 1, !dbg !10 @x5 = global i8 1, align 1, !dbg !10
; Check debug info output for merged global.
; DW_AT_location
; 0x03 DW_OP_addr
; 0x.. .long __MergedGlobals
; 0x10 DW_OP_constu
; 0x.. offset
; 0x22 DW_OP_plus
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name {{.*}} "x1" ; CHECK: DW_AT_name {{.*}} "x1"
; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x5> 03 [[ADDR:.. .. .. ..]] ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]])
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name {{.*}} "x2" ; CHECK: DW_AT_name {{.*}} "x2"
; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x7> 03 [[ADDR]] 23 01 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x1)
; Function Attrs: nounwind optsize ; Function Attrs: nounwind optsize
define zeroext i8 @get1(i8 zeroext %a) #0 !dbg !16 { define zeroext i8 @get1(i8 zeroext %a) #0 !dbg !16 {

View File

@ -1,23 +1,15 @@
; RUN: llc -arm-global-merge -global-merge-group-by-use=false -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s ; RUN: llc -arm-global-merge -global-merge-group-by-use=false -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
; Check debug info output for merged global.
; DW_AT_location
; 0x03 DW_OP_addr
; 0x.. .long __MergedGlobals
; 0x10 DW_OP_constu
; 0x.. offset
; 0x22 DW_OP_plus
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name {{.*}} "x1" ; CHECK: DW_AT_name {{.*}} "x1"
; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x5> 03 [[ADDR:.. .. .. ..]] ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR:0x[0-9a-fA-F]+]])
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name {{.*}} "x2" ; CHECK: DW_AT_name {{.*}} "x2"
; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x7> 03 [[ADDR]] 23 04 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr [[ADDR]], DW_OP_plus_uconst 0x4)
source_filename = "test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll" source_filename = "test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll"
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32" target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"

View File

@ -5,17 +5,11 @@
; CHECK-NOT: DW_TAG_subprogram ; CHECK-NOT: DW_TAG_subprogram
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[MYDATA_LOC:0x[0-9a-f]*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: {{.*}} DW_OP_plus_uconst 0x4, DW_OP_deref, DW_OP_plus_uconst 0x18
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: {{.*}} DW_OP_plus_uconst 0x4, DW_OP_deref, DW_OP_plus_uconst 0x18
; CHECK-NEXT: DW_AT_name {{.*}} "mydata" ; CHECK-NEXT: DW_AT_name {{.*}} "mydata"
; debug_loc content
; CHECK: .debug_loc contents:
; CHECK: [[MYDATA_LOC]]: Beginning address offset: {{.*}}
; CHECK-NOT: {{0x[0-9a-f]*}}: Beginning address offset
; CHECK: Location description: {{.*}} 23 04 06 23 18
; CHECK-NOT: {{0x[0-9a-f]*}}: Beginning address offset
; CHECK: Location description: {{.*}} 23 04 06 23 18
; Radar 9331779 ; Radar 9331779
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32" target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
target triple = "thumbv7-apple-ios" target triple = "thumbv7-apple-ios"

View File

@ -5,12 +5,9 @@ target triple = "thumbv7-apple-macosx10.6.7"
; Just making sure the first part of the location isn't a repetition ; Just making sure the first part of the location isn't a repetition
; of the size of the location description. ; of the size of the location description.
;
; 0x90 DW_OP_regx of super-register
; CHECK: 0x00000000: Beginning address offset: ; CHECK: 0x00000000:
; CHECK-NEXT: Ending address offset: ; CHECK-NEXT: 0x{{[0-9]*[a-f]*}} - 0x{{[0-9]*[a-f]*}}: DW_OP_regx D8
; CHECK-NEXT: Location description: 90 {{.. .. $}}
define void @_Z3foov() optsize ssp !dbg !1 { define void @_Z3foov() optsize ssp !dbg !1 {
entry: entry:

View File

@ -5,8 +5,7 @@
; CHECK-LABEL: DW_TAG_subprogram ; CHECK-LABEL: DW_TAG_subprogram
; CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}}"foo") ; CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}}"foo")
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 {{..}} ) ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg {{[^ ]*}})
; DW_OP_fbreg ??
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"my_r0") ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"my_r0")
%struct.Pt = type { double, double } %struct.Pt = type { double, double }

View File

@ -9,7 +9,8 @@ target triple = "x86_64-apple-darwin10.0.0"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location ; CHECK-NEXT: DW_AT_location
; CHECK-NEXT: DW_AT_name {{.*}} "z_s" ; CHECK-NOT: DW_{{TAG|AT}}
; CHECK: DW_AT_name {{.*}} "z_s"
; CHECK-NEXT: DW_AT_decl_file ; CHECK-NEXT: DW_AT_decl_file
; CHECK-NEXT: DW_AT_decl_line ; CHECK-NEXT: DW_AT_decl_line
; CHECK-NEXT: DW_AT_type{{.*}}{[[TYPE:.*]]} ; CHECK-NEXT: DW_AT_type{{.*}}{[[TYPE:.*]]}

View File

@ -22,12 +22,10 @@ define i32 @f0(%struct.s* byval align 8 %input) !dbg !8 {
; DWARF-LABEL: .debug_info contents: ; DWARF-LABEL: .debug_info contents:
; DWARF-LABEL: DW_TAG_subprogram ; DWARF-LABEL: DW_TAG_subprogram
; DWARF: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 57 ) ; DWARF: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg7 RSP)
; 0x57 -> RSP
; DWARF: DW_AT_name [DW_FORM_strp] ( {{.*}}"f0") ; DWARF: DW_AT_name [DW_FORM_strp] ( {{.*}}"f0")
; DWARF: DW_TAG_formal_parameter ; DWARF: DW_TAG_formal_parameter
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 08 ) ; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +8)
; DW_OP_fbreg (0x91) 0x08
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"input") ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"input")
@ -48,12 +46,10 @@ define i32 @f1(%struct.s* byval align 8 %input) !dbg !19 {
} }
; DWARF-LABEL: DW_TAG_subprogram ; DWARF-LABEL: DW_TAG_subprogram
; DWARF: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) ; DWARF: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg6 RBP)
; 0x56 -> RBP
; DWARF: DW_AT_name [DW_FORM_strp] ( {{.*}}"f1") ; DWARF: DW_AT_name [DW_FORM_strp] ( {{.*}}"f1")
; DWARF: DW_TAG_formal_parameter ; DWARF: DW_TAG_formal_parameter
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 10 ) ; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +16)
; DW_OP_fbreg (0x91) 0x10
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"input") ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"input")
; CHECK-LABEL: f2: ; CHECK-LABEL: f2:
@ -75,12 +71,10 @@ define i32 @f2(%struct.s* byval align 8 %input) !dbg !22 {
; "input" should still be referred to through RBP. ; "input" should still be referred to through RBP.
; DWARF-LABEL: DW_TAG_subprogram ; DWARF-LABEL: DW_TAG_subprogram
; DWARF: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) ; DWARF: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg6 RBP)
; 0x56 -> RBP
; DWARF: DW_AT_name [DW_FORM_strp] ( {{.*}}"f2") ; DWARF: DW_AT_name [DW_FORM_strp] ( {{.*}}"f2")
; DWARF: DW_TAG_formal_parameter ; DWARF: DW_TAG_formal_parameter
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 10 ) ; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +16)
; DW_OP_fbreg (0x91) 0x10
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"input") ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}}"input")
declare void @llvm.dbg.declare(metadata, metadata, metadata) declare void @llvm.dbg.declare(metadata, metadata, metadata)

View File

@ -27,13 +27,11 @@
; CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] ([[FN_END:.*]]) ; CHECK-NEXT: DW_AT_high_pc [DW_FORM_addr] ([[FN_END:.*]])
; CHECK: "_cmd" ; CHECK: "_cmd"
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location {{.*}} ([[OFS:.*]]) ; CHECK-NEXT: DW_AT_location
; CHECK-NEXT: 0x{{0*}} - 0x{{.*}}:
; CHECK-NOT: DW_AT_
; CHECK: 0x{{.*}} - [[FN_END]]:
; CHECK-NEXT: DW_AT_name {{.*}}"imageSize" ; CHECK-NEXT: DW_AT_name {{.*}}"imageSize"
;
; CHECK: .debug_loc contents:
; CHECK: [[OFS]]: Beginning address offset: 0x0000000000000000
; CHECK_NOT: 0x{{.*}}: Beginning
; CHECK: Ending address offset: [[FN_END]]
; ModuleID = 'm.m' ; ModuleID = 'm.m'
source_filename = "m.m" source_filename = "m.m"

View File

@ -19,12 +19,12 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x02) ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x02)
; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00) ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00)
; CHECK-NEXT: DW_AT_data_member_location {{.*}} 00 ; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"b" ; CHECK-NEXT: DW_AT_name{{.*}}"b"
; CHECK-NOT: DW_TAG_member ; CHECK-NOT: DW_TAG_member
; CHECK: DW_AT_data_member_location {{.*}} 04 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"c" ; CHECK-NEXT: DW_AT_name{{.*}}"c"
@ -32,7 +32,7 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x01) ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x01)
; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00) ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x00)
; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"d" ; CHECK-NEXT: DW_AT_name{{.*}}"d"
@ -40,7 +40,7 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x1c) ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x1c)
; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x01) ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x01)
; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08 ; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; ModuleID = 'bitfields.c' ; ModuleID = 'bitfields.c'
source_filename = "test/DebugInfo/AArch64/bitfields.ll" source_filename = "test/DebugInfo/AArch64/bitfields.ll"

View File

@ -23,10 +23,8 @@ entry:
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location ; CHECK-NEXT: DW_AT_location
; CHECK-NEXT: DW_OP_breg31 WSP+12, DW_OP_deref
; CHECK-NEXT: DW_AT_name {{.*}}"size" ; CHECK-NEXT: DW_AT_name {{.*}}"size"
; CHECK: .debug_loc contents:
; Expecting the encoding for sp+12: DW_OP_breg31 0c
; CHECK: Location description: 8f 0c
ret void, !dbg !18 ret void, !dbg !18
} }

View File

@ -5,8 +5,7 @@
; CHECK: DW_TAG_inlined_subroutine ; CHECK: DW_TAG_inlined_subroutine
; CHECK: "_Z3f111A" ; CHECK: "_Z3f111A"
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK: DW_AT_location [DW_FORM_block1] (<0x0c> 93 01 91 51 93 0f 93 01 91 4a 93 07 ) ; CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_piece 0x1, DW_OP_fbreg -47, DW_OP_piece 0xf, DW_OP_piece 0x1, DW_OP_fbreg -54, DW_OP_piece 0x7)
; -- piece 0x00000001, fbreg -47, piece 0x0000000f, piece 0x00000001, fbreg -54, piece 0x00000007 ------^
; CHECK: DW_AT_abstract_origin {{.*}} "p1" ; CHECK: DW_AT_abstract_origin {{.*}} "p1"
; ;
; long a; ; long a;

View File

@ -19,7 +19,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
; CHECK-NEXT: DW_AT_external ; CHECK-NEXT: DW_AT_external
; CHECK-NEXT: DW_AT_decl_file ; CHECK-NEXT: DW_AT_decl_file
; CHECK-NEXT: DW_AT_decl_line ; CHECK-NEXT: DW_AT_decl_line
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 00 00 00 00 00 00 00 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x0)
@GlobA = common addrspace(1) global i32 0, align 4, !dbg !0 @GlobA = common addrspace(1) global i32 0, align 4, !dbg !0
; CHECK: {{.*}}DW_TAG_variable ; CHECK: {{.*}}DW_TAG_variable
@ -28,20 +28,20 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
; CHECK-NEXT: DW_AT_external ; CHECK-NEXT: DW_AT_external
; CHECK-NEXT: DW_AT_decl_file ; CHECK-NEXT: DW_AT_decl_file
; CHECK-NEXT: DW_AT_decl_line ; CHECK-NEXT: DW_AT_decl_line
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 00 00 00 00 00 00 00 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x0)
@GlobB = common addrspace(1) global i32 0, align 4, !dbg !6 @GlobB = common addrspace(1) global i32 0, align 4, !dbg !6
define amdgpu_kernel void @kernel1( define amdgpu_kernel void @kernel1(
; CHECK: {{.*}}DW_TAG_formal_parameter ; CHECK: {{.*}}DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x06> 91 04 10 01 16 18 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +4, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef)
; CHECK-NEXT: DW_AT_name {{.*}}"ArgN" ; CHECK-NEXT: DW_AT_name {{.*}}"ArgN"
i32 %ArgN, i32 %ArgN,
; CHECK: {{.*}}DW_TAG_formal_parameter ; CHECK: {{.*}}DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x06> 91 08 10 01 16 18 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef)
; CHECK-NEXT: DW_AT_name {{.*}}"ArgA" ; CHECK-NEXT: DW_AT_name {{.*}}"ArgA"
i32 addrspace(1)* %ArgA, i32 addrspace(1)* %ArgA,
; CHECK: {{.*}}DW_TAG_formal_parameter ; CHECK: {{.*}}DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x06> 91 10 10 01 16 18 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +16, DW_OP_constu 0x1, DW_OP_swap, DW_OP_xderef)
; CHECK-NEXT: DW_AT_name {{.*}}"ArgB" ; CHECK-NEXT: DW_AT_name {{.*}}"ArgB"
i32 addrspace(1)* %ArgB) !dbg !13 { i32 addrspace(1)* %ArgB) !dbg !13 {
entry: entry:

View File

@ -1,10 +1,23 @@
; RUN: llc -filetype=asm < %s | FileCheck %s ; RUN: llc -filetype=asm < %s | FileCheck %s
; RUN: llc -filetype=obj < %s \ ; RUN: llc -filetype=obj < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF ; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck %s --check-prefix=DWARF
; ;
; CHECK: @DEBUG_VALUE: h:x <- [DW_OP_plus_uconst {{.*}}] [%R{{.*}}+0] ; CHECK: @DEBUG_VALUE: h:x <- [DW_OP_plus_uconst {{.*}}] [%R{{.*}}+0]
; DWARF: Location description: {{7[0-9] [0-9]+ $}} ; DWARF: DW_TAG_formal_parameter
; DW_OP_breg. +.. ; DWARF: DW_AT_location
; DWARF-NEXT: DW_OP_reg0 R0
; DWARF: DW_TAG_formal_parameter
; DWARF: DW_AT_location
; DWARF-NEXT: DW_OP_reg1 R1
; DWARF: DW_TAG_formal_parameter
; DWARF: DW_AT_location
; DWARF-NEXT: DW_OP_reg2 R2
; DWARF: DW_TAG_formal_parameter
; DWARF: DW_AT_location
; DWARF-NEXT: DW_OP_reg3 R3
; DWARF: DW_TAG_formal_parameter
; DWARF: DW_AT_location
; DWARF-NEXT: DW_OP_breg7 R7+8
; generated from: ; generated from:
; clang -cc1 -triple thumbv7 -S -O1 arm.cpp -g ; clang -cc1 -triple thumbv7 -S -O1 arm.cpp -g
; ;

View File

@ -1,4 +1,4 @@
; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s ; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
; ;
; Checks that we're creating two ranges, one that terminates immediately ; Checks that we're creating two ranges, one that terminates immediately
; and one that spans the rest of the function. This isn't necessarily the ; and one that spans the rest of the function. This isn't necessarily the
@ -6,13 +6,11 @@
; one has a bit_piece), but it is what is currently being emitted, any ; one has a bit_piece), but it is what is currently being emitted, any
; change here needs to be intentional, so the test is very specific. ; change here needs to be intentional, so the test is very specific.
; ;
; CHECK: .debug_loc contents: ; CHECK: DW_TAG_inlined_subroutine
; CHECK: 0x00000000: Beginning address offset: 0x0000000000000004 ; CHECK: DW_TAG_variable
; CHECK: Ending address offset: 0x0000000000000004 ; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK: Location description: 10 00 9f ; CHECK: 0x0000000000000004 - 0x0000000000000004: DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x8
; CHECK: Beginning address offset: 0x0000000000000004 ; CHECK: 0x0000000000000004 - 0x0000000000000014: DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
; CHECK: Ending address offset: 0x0000000000000014
; CHECK: Location description: 10 00 9f
; Created form the following test case (PR26163) with ; Created form the following test case (PR26163) with
; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c ; clang -cc1 -triple armv4t--freebsd11.0-gnueabi -emit-obj -debug-info-kind=standalone -O2 -x c test.c

View File

@ -14,7 +14,7 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK: DW_AT_bit_size {{.*}} (0x1c) ; CHECK: DW_AT_bit_size {{.*}} (0x1c)
; CHECK: DW_AT_bit_offset {{.*}} (0xfffffffffffffff8) ; CHECK: DW_AT_bit_offset {{.*}} (0xfffffffffffffff8)
; CHECK: DW_AT_data_member_location {{.*}}00 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
source_filename = "test/DebugInfo/ARM/bitfield.ll" source_filename = "test/DebugInfo/ARM/bitfield.ll"
target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
target triple = "thumbv7-apple-ios" target triple = "thumbv7-apple-ios"

View File

@ -8,12 +8,9 @@
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}}"subscript.get" ; CHECK: DW_AT_name {{.*}}"subscript.get"
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000) ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK: .debug_loc ; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_regx D16, DW_OP_piece 0x8, DW_OP_regx D17, DW_OP_piece 0x4, DW_OP_regx D16, DW_OP_piece 0x8, DW_OP_regx D17, DW_OP_piece 0x4
; CHECK: 0x00000000: Beginning address offset
; CHECK-NEXT: Ending address offset
; CHECK-NEXT: Location description: 90 90 02 93 08 90 91 02 93 04
; d16, piece 0x00000008, d17, piece 0x00000004
source_filename = "simd.ll" source_filename = "simd.ll"
target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
target triple = "armv7-apple-ios7.0" target triple = "armv7-apple-ios7.0"

View File

@ -4,8 +4,7 @@ target triple = "thumbv7-apple-macosx10.6.7"
; The S registers on ARM are expressed as pieces of their super-registers in DWARF. ; The S registers on ARM are expressed as pieces of their super-registers in DWARF.
; ;
; 0x90 DW_OP_regx of super-register ; CHECK: DW_OP_regx
; CHECK: Location description: 90
define void @_Z3foov() optsize ssp !dbg !1 { define void @_Z3foov() optsize ssp !dbg !1 {
entry: entry:

View File

@ -14,8 +14,7 @@ entry:
; The target has no native double type. ; The target has no native double type.
; SROA split the complex value into two i64 values. ; SROA split the complex value into two i64 values.
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x04> 10 00 93 08 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_constu 0x0, DW_OP_piece 0x8)
; DW_AT_location ( constu 0x00000000, piece 0x00000008 )
; CHECK-NEXT: DW_AT_name {{.*}} "c" ; CHECK-NEXT: DW_AT_name {{.*}} "c"
tail call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !17), !dbg !16 tail call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !17), !dbg !16
; Manually removed to disable location list emission: ; Manually removed to disable location list emission:

View File

@ -23,8 +23,11 @@
; return c; ; return c;
; } ; }
; DWARF23: Location description: 10 0d {{$}} ; CHECK: DW_TAG_variable
; DWARF4: Location description: 10 0d 9f ; CHECK: DW_AT_location
; CHECK-NOT: DW_AT
; DWARF23: DW_OP_constu 0xd{{$}}
; DWARF4: DW_OP_constu 0xd, DW_OP_stack_value{{$}}
; Function Attrs: uwtable ; Function Attrs: uwtable
define i32 @main() #0 !dbg !4 { define i32 @main() #0 !dbg !4 {

View File

@ -3,20 +3,11 @@
# CHECK: .debug_info contents: # CHECK: .debug_info contents:
# CHECK: DW_TAG_formal_parameter # CHECK: DW_TAG_formal_parameter
# CHECK: DW_TAG_formal_parameter # CHECK: DW_TAG_formal_parameter
# CHECK-NEXT: DW_AT_location [DW_FORM_data4] ([[LOC:.*]]) # CHECK-NEXT: DW_AT_location
# CHECK-NEXT: 0x0000000000000000 - 0x0000000000000014: DW_OP_reg1 W1
# CHECK-NEXT: 0x0000000000000014 - 0x0000000000000038: DW_OP_breg31 WSP+8
# CHECK-NEXT: DW_AT_name {{.*}}"y" # CHECK-NEXT: DW_AT_name {{.*}}"y"
# CHECK: .debug_loc contents:
# CHECK: [[LOC]]:
# CHECK-SAME: Beginning address offset: 0x0000000000000000
# CHECK-NEXT: Ending address offset: 0x0000000000000014
# CHECK-NEXT: Location description: 51
# reg1
#
# The range of y's [SP+8] location must not be interrupted by the call to h.
# CHECK: Beginning address offset: 0x0000000000000014
# CHECK-NEXT: Ending address offset: 0x0000000000000038
# CHECK-NEXT: Location description: 8f 08
# breg31 +8
--- | --- |
; Generated at -Os from: ; Generated at -Os from:
; struct Rect { ; struct Rect {

View File

@ -1,14 +1,11 @@
# RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s | \ # RUN: llc -start-before=livedebugvalues -filetype=obj -o - %s | \
# RUN: llvm-dwarfdump - | FileCheck %s # RUN: llvm-dwarfdump -debug-dump=info - | FileCheck %s
# CHECK: .debug_info contents: # CHECK: .debug_info contents:
# CHECK: DW_TAG_variable # CHECK: DW_TAG_variable
# CHECK-NEXT: DW_AT_location [DW_FORM_data4] ([[OFS:.*]]) # CHECK-NEXT: DW_AT_location
# CHECK-NEXT: 0x0000000000000010 - 0x0000000000000018: DW_OP_piece 0x10, DW_OP_regx D0, DW_OP_piece 0x8, DW_OP_regx D1, DW_OP_piece 0x8)
# CHECK-NEXT: DW_AT_name {{.*}}"vec" # CHECK-NEXT: DW_AT_name {{.*}}"vec"
# CHECK: .debug_loc contents:
# CHECK: [[OFS]]: Beginning address offset: 0x0000000000000010
# CHECK: Ending address offset: 0x0000000000000018
# CHECK: Location description: 93 10 90 80 02 93 08 90 81 02 93 08
# piece 0x00000010, d0, piece 0x00000008, d1, piece 0x00000008
--- | --- |
; Generate from (and then manually modified to incorporate a DW_OP_LLVM_fragment): ; Generate from (and then manually modified to incorporate a DW_OP_LLVM_fragment):
; typedef float vec2 __attribute__((vector_size(16))); ; typedef float vec2 __attribute__((vector_size(16)));

View File

@ -2,13 +2,10 @@
# RUN: llvm-dwarfdump - | FileCheck %s # RUN: llvm-dwarfdump - | FileCheck %s
# CHECK: .debug_info contents: # CHECK: .debug_info contents:
# CHECK: DW_TAG_variable # CHECK: DW_TAG_variable
# CHECK-NEXT: DW_AT_location [DW_FORM_data4] ([[OFS:.*]]) # CHECK-NEXT: DW_AT_location
# CHECK-NEXT: 0x0000000000000010 - 0x0000000000000018: DW_OP_regx D0, DW_OP_piece 0x8, DW_OP_regx D1, DW_OP_piece 0x8)
# CHECK-NEXT: DW_AT_name {{.*}}"vec" # CHECK-NEXT: DW_AT_name {{.*}}"vec"
# CHECK: .debug_loc contents:
# CHECK: [[OFS]]: Beginning address offset: 0x0000000000000010
# CHECK: Ending address offset: 0x0000000000000018
# CHECK: Location description: 90 80 02 93 08 90 81 02 93 08
# d0, piece 0x00000008, d1, piece 0x00000008
--- | --- |
; Generated from: ; Generated from:
; typedef float vec2 __attribute__((vector_size(16))); ; typedef float vec2 __attribute__((vector_size(16)));

View File

@ -1,8 +1,7 @@
# RUN: llc -filetype=obj -o - %s | llvm-dwarfdump --debug-dump=info - | FileCheck %s # RUN: llc -filetype=obj -o - %s | llvm-dwarfdump --debug-dump=info - | FileCheck %s
# CHECK: .debug_info contents: # CHECK: .debug_info contents:
# CHECK: DW_TAG_variable # CHECK: DW_TAG_variable
# rdx, bit-piece 8 8 # CHECK-NEXT: DW_AT_location {{.*}} (DW_OP_reg1 RDX, DW_OP_bit_piece 0x8 0x8)
# CHECK-NEXT: DW_AT_location {{.*}} 51 9d 08 08
# CHECK-NEXT: DW_AT_name {{.*}}"dh" # CHECK-NEXT: DW_AT_name {{.*}}"dh"
--- | --- |
; Manually created after: ; Manually created after:

View File

@ -1,7 +1,5 @@
; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \ ; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \
; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F0 ; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s
; RUN: llc -march=mips -mcpu=mips32r2 -O1 -filetype=obj -relocation-model=pic <%s | \
; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F1
; void foo(int *); ; void foo(int *);
; ;
@ -22,15 +20,12 @@ declare void @llvm.lifetime.end(i64, i8* nocapture)
declare void @foo(i32*) declare void @foo(i32*)
; F0: DW_AT_name {{.*}}"e" ; CHECK: DW_AT_name {{.*}}"e"
; F0: DW_TAG_variable ; CHECK: DW_TAG_variable
; F0-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[LOC:.*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
; F0-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x") ; CHECK-NEXT: 0x0000000000000028 - 0x000000000000002c: DW_OP_reg1 AT_64
; ; CHECK-NEXT: 0x000000000000002c - 0x0000000000000048: DW_OP_breg29 SP_64+16, DW_OP_deref)
; x -> DW_OP_reg1(51) ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x")
; F0: [[LOC]]: Beginning address offset: 0x0000000000000028
; F0: Ending address offset: 0x000000000000002c
; F0: Location description: 51
define i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 { define i32 @f0(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !4 {
entry: entry:
@ -57,16 +52,11 @@ entry:
} }
; F1: DW_AT_name {{.*}}"x" ; CHECK: DW_TAG_variable
; F1: DW_AT_name {{.*}}"e" ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
; F1: DW_TAG_variable ; CHECK-NEXT: 0x0000000000000080 - 0x0000000000000084: DW_OP_reg1 AT_64
; F1-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[LOC:.*]]) ; CHECK-NEXT: 0x0000000000000084 - 0x0000000000000098: DW_OP_breg29 SP_64+16, DW_OP_deref)
; F1-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x") ; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006b] = "x")
; x -> DW_OP_reg1(51)
; F1: [[LOC]]: Beginning address offset: 0x0000000000000080
; F1: Ending address offset: 0x0000000000000084
; F1: Location description: 51
define i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 { define i32 @f1(i32 signext %a, i32 signext %b, i32 signext %c, i32 signext %d, i32 signext %e) !dbg !15 {
entry: entry:

View File

@ -1,7 +1,5 @@
; RUN: llc -march=mips -mcpu=mips32r2 -O0 -filetype=obj -fast-isel=0 <%s | \ ; RUN: llc -march=mips -mcpu=mips32r2 -O0 -filetype=obj -fast-isel=0 <%s | \
; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F2 ; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s
; RUN: llc -march=mips -mcpu=mips32r2 -O0 -filetype=obj -fast-isel=0 <%s | \
; RUN: llvm-dwarfdump -debug-dump=all - | FileCheck %s -check-prefix=F3
declare void @llvm.dbg.declare(metadata, metadata, metadata) declare void @llvm.dbg.declare(metadata, metadata, metadata)
@ -22,9 +20,9 @@ declare void @foo(i32*)
; return w; ; return w;
; } ; }
; c -> DW_OP_breg29(r29): 16 ; CHECK: DW_TAG_subprogram
; F2: DW_AT_location [DW_FORM_exprloc] (<0x2> 8d 10 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_breg29 SP_64+36)
; F2: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "c") ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "c")
; Function Attrs: nounwind ; Function Attrs: nounwind
define i32 @f2(i32 signext %a, i32 signext %b) !dbg !4 { define i32 @f2(i32 signext %a, i32 signext %b) !dbg !4 {
@ -46,9 +44,9 @@ entry:
ret i32 %2, !dbg !27 ret i32 %2, !dbg !27
} }
; c -> DW_OP_breg23(r23): 16 ; CHECK: DW_TAG_subprogram
; F3: DW_AT_location [DW_FORM_exprloc] (<0x2> 87 10 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_breg23 S7_64+32)
; F3: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "c") ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000065] = "c")
define i32* @f3(i32 signext %a, i32 signext %b) !dbg !8 { define i32* @f3(i32 signext %a, i32 signext %b) !dbg !8 {
entry: entry:

View File

@ -1,7 +1,6 @@
; RUN: llc -filetype=obj -O0 < %s -mtriple sparc64-unknown-linux-gnu | llvm-dwarfdump - | FileCheck %s ; RUN: llc -filetype=obj -O0 < %s -mtriple sparc64-unknown-linux-gnu | llvm-dwarfdump - -debug-dump=loc | FileCheck %s
; The undescribable 128-bit register should be split into two 64-bit registers. ; The undescribable 128-bit register should be split into two 64-bit registers.
; CHECK: Location description: 90 48 93 08 90 49 93 08 ; CHECK: {{.*}} - {{.*}}: DW_OP_regx D0, DW_OP_piece 0x8, DW_OP_regx D1, DW_OP_piece 0x8
; DW_OP_reg74 DW_OP_piece 8 DW_OP_reg75 DW_OP_piece 8 ...
target datalayout = "E-m:e-i64:64-n32:64-S128" target datalayout = "E-m:e-i64:64-n32:64-S128"
target triple = "sparc64" target triple = "sparc64"

View File

@ -14,9 +14,8 @@
; CHECK: brasl %r14, populate_array@PLT ; CHECK: brasl %r14, populate_array@PLT
; DEBUG: DW_TAG_variable ; DEBUG: DW_TAG_variable
; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xa401 is SLEB128 encoded 164.
; DEBUG-NOT: DW_TAG ; DEBUG-NOT: DW_TAG
; DEBUG: DW_AT_location {{.*}}(<0x3> 91 a4 01 ) ; DEBUG: DW_AT_location {{.*}}(DW_OP_fbreg +164)
; DEBUG-NOT: DW_TAG ; DEBUG-NOT: DW_TAG
; DEBUG: DW_AT_name {{.*}} "main_arr" ; DEBUG: DW_AT_name {{.*}} "main_arr"

View File

@ -31,22 +31,18 @@
; // The 'x' variable and its symbol reference location ; // The 'x' variable and its symbol reference location
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000) ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000
; Check that the location contains only 4 ranges - this verifies that the 4th
; and 5th ranges were successfully merged into a single range.
; CHECK-NEXT: 0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}:
; CHECK-NEXT: 0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}:
; CHECK-NEXT: 0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}:
; CHECK-NEXT: 0x{{[0-9a-f]*}} - 0x{{[0-9a-f]*}}: {{.*}})
; CHECK-NEXT: DW_AT_name {{.*}} "x" ; CHECK-NEXT: DW_AT_name {{.*}} "x"
; CHECK-NEXT: DW_AT_decl_file ; CHECK-NEXT: DW_AT_decl_file
; CHECK-NEXT: DW_AT_decl_line ; CHECK-NEXT: DW_AT_decl_line
; CHECK-NEXT: DW_AT_type ; CHECK-NEXT: DW_AT_type
; Check that the location contains only 4 ranges - this verifies that the 4th
; and 5th ranges were successfully merged into a single range.
; CHECK: .debug_loc contents:
; CHECK: 0x00000000:
; CHECK: Beginning address offset:
; CHECK: Beginning address offset:
; CHECK: Beginning address offset:
; CHECK: Beginning address offset:
; CHECK-NOT: Beginning address offset:
; Check that we have no relocations in Darwin's output. ; Check that we have no relocations in Darwin's output.
; DARWIN-NOT: X86_64_RELOC{{.*}} __debug_loc ; DARWIN-NOT: X86_64_RELOC{{.*}} __debug_loc

View File

@ -3,8 +3,7 @@
; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s ; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (<0xa> 91 78 93 03 93 06 91 7d 93 03 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -8, DW_OP_piece 0x3, DW_OP_piece 0x6, DW_OP_fbreg -3, DW_OP_piece 0x3)
; fbreg -8, piece 0x00000003, piece 0x00000006, fbreg -3, piece 0x00000003
; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"p" ; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"p"
source_filename = "bugpoint-reduced-simplified.ll" source_filename = "bugpoint-reduced-simplified.ll"
target triple = "x86_64-apple-darwin" target triple = "x86_64-apple-darwin"

View File

@ -1,4 +1,4 @@
; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - | FileCheck %s ; RUN: llc -filetype=obj -o - < %s | llvm-dwarfdump - -debug-dump=loc | FileCheck %s
; ;
; Created using clang -g -O3 from: ; Created using clang -g -O3 from:
; struct S0 { ; struct S0 {
@ -19,14 +19,8 @@
; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized ; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized
; ;
; ;
; CHECK: Beginning address offset: 0x0000000000000004 ; CHECK: 0x0000000000000004 - 0x0000000000000004: DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_reg5 RDI, DW_OP_piece 0x2
; CHECK: Ending address offset: 0x0000000000000004 ; CHECK: 0x0000000000000004 - 0x0000000000000014: DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_piece 0x4
; CHECK: Location description: 10 03 93 04 55 93 02
; constu 0x00000003, piece 0x00000004, rdi, piece 0x00000002
; CHECK: Beginning address offset: 0x0000000000000004
; CHECK: Ending address offset: 0x0000000000000014
; CHECK: Location description: 10 03 93 04 10 00
; constu 0x00000003, piece 0x00000004, constu 0x00000000, piece 0x00000004
source_filename = "test/DebugInfo/X86/PR26148.ll" source_filename = "test/DebugInfo/X86/PR26148.ll"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -21,8 +21,7 @@
; CHECK: callq _f ; CHECK: callq _f
; DWARF: DW_TAG_variable ; DWARF: DW_TAG_variable
; "<0x2> 91 00" means fbreg 0, i.e. offset RSP+0. ; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +0)
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 00 )
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "array") ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "array")
; ModuleID = '/tmp/array.c' ; ModuleID = '/tmp/array.c'

View File

@ -19,12 +19,12 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x02) ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x02)
; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x1e) ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x1e)
; CHECK-NEXT: DW_AT_data_member_location {{.*}} 00 ; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"b" ; CHECK-NEXT: DW_AT_name{{.*}}"b"
; CHECK-NOT: DW_TAG_member ; CHECK-NOT: DW_TAG_member
; CHECK: DW_AT_data_member_location {{.*}} 04 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"c" ; CHECK-NEXT: DW_AT_name{{.*}}"c"
@ -32,7 +32,7 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x01) ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x01)
; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x1f) ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x1f)
; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK-NEXT: DW_AT_name{{.*}}"d" ; CHECK-NEXT: DW_AT_name{{.*}}"d"
@ -40,7 +40,7 @@
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x1c) ; CHECK-NEXT: DW_AT_bit_size {{.*}} (0x1c)
; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x03) ; CHECK-NEXT: DW_AT_bit_offset {{.*}} (0x03)
; CHECK-NEXT: DW_AT_data_member_location {{.*}} 08 ; CHECK-NEXT: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; ModuleID = 'bitfields.c' ; ModuleID = 'bitfields.c'
source_filename = "test/DebugInfo/X86/bitfields.ll" source_filename = "test/DebugInfo/X86/bitfields.ll"

View File

@ -4,8 +4,7 @@
; Checks that we emit debug info for the block variable declare. ; Checks that we emit debug info for the block variable declare.
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; fbreg +8, deref, +32 ; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg +8, DW_OP_deref, DW_OP_plus_uconst 0x20)
; CHECK-NEXT: DW_AT_location [DW_FORM_block1] (<0x05> 91 08 06 23 20 )
; CHECK-NEXT: DW_AT_name {{.*}} "block" ; CHECK-NEXT: DW_AT_name {{.*}} "block"
; Extracted from the clang output for: ; Extracted from the clang output for:

View File

@ -1,24 +1,22 @@
; RUN: %llc_dwarf -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s ; RUN: %llc_dwarf -filetype=obj %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
; A hand-written testcase to check 64-bit constant handling in location lists. ; A hand-written testcase to check 64-bit constant handling in location lists.
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x[[D:.*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_constu 0x4000000000000000)
; CHECK-NEXT: DW_AT_name {{.*}}"d" ; CHECK-NEXT: DW_AT_name {{.*}}"d"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x[[I:.*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_consts +0
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_consts +4611686018427387904)
; CHECK-NEXT: DW_AT_name {{.*}}"i" ; CHECK-NEXT: DW_AT_name {{.*}}"i"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x[[U:.*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_constu 0x0
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_constu 0x4000000000000000)
; CHECK-NEXT: DW_AT_name {{.*}}"u" ; CHECK-NEXT: DW_AT_name {{.*}}"u"
; CHECK: .debug_loc contents:
; CHECK: [[D]]:
; CHECK: Location description: 10 80 80 80 80 80 80 80 80 40
; CHECK: [[I]]:
; CHECK: Location description: 11 80 80 80 80 80 80 80 80 c0 00
; CHECK: [[U]]:
; CHECK: Location description: 10 80 80 80 80 80 80 80 80 40
source_filename = "test.c" source_filename = "test.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -20,11 +20,11 @@
; DWARF2: DW_AT_name {{.*}} "c" ; DWARF2: DW_AT_name {{.*}} "c"
; DWARF2-NOT: DW_TAG ; DWARF2-NOT: DW_TAG
; DWARF2: DW_AT_data_member_location {{.*}} (<0x02> 23 00 ) ; DWARF2: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; DWARF2: DW_AT_name {{.*}} "i" ; DWARF2: DW_AT_name {{.*}} "i"
; DWARF2-NOT: DW_TAG ; DWARF2-NOT: DW_TAG
; DWARF2: DW_AT_data_member_location {{.*}} (<0x02> 23 04 ) ; DWARF2: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
source_filename = "test/DebugInfo/X86/data_member_location.ll" source_filename = "test/DebugInfo/X86/data_member_location.ll"

View File

@ -8,9 +8,8 @@
; CHECK-LABEL: use_dbg_declare: ; CHECK-LABEL: use_dbg_declare:
; CHECK-NOT: #DEBUG_VALUE ; CHECK-NOT: #DEBUG_VALUE
; "<0x2> 91 00" means "fbreg uleb(0)", i.e. RSP+0.
; DWARF: DW_TAG_variable ; DWARF: DW_TAG_variable
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 00 ) ; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +0)
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "o") ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "o")

View File

@ -5,13 +5,9 @@ target triple = "x86_64-apple-macosx10.6.7"
; ;
; CHECK: DW_AT_name {{.*}}"j" ; CHECK: DW_AT_name {{.*}}"j"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000) ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (
; CHECK-NEXT: 0x{{.*}} - 0x{{.*}}: DW_OP_breg7 RSP+8)
; CHECK-NEXT: DW_AT_name {{.*}}"my_a" ; CHECK-NEXT: DW_AT_name {{.*}}"my_a"
; CHECK: .debug_loc contents:
; CHECK: 0x00000000: Beginning address offset:
; CHECK-NEXT: Ending address offset:
; CHECK-NEXT: Location description: 77 08
; rsp+8
%class.A = type { i32, i32, i32, i32 } %class.A = type { i32, i32, i32, i32 }

View File

@ -8,7 +8,7 @@
; "[DW_FORM_exprloc] <0x2> 91 XX" means fbreg uleb(XX) ; "[DW_FORM_exprloc] <0x2> 91 XX" means fbreg uleb(XX)
; DWARF-LABEL: DW_TAG_formal_parameter ; DWARF-LABEL: DW_TAG_formal_parameter
; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 70 ) ; DWARF-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -16)
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "x") ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] ( {{.*}} = "x")
; FIXME: There is no debug info to describe "a". ; FIXME: There is no debug info to describe "a".

View File

@ -7,7 +7,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-apple-darwin8" target triple = "x86_64-apple-darwin8"
; Test that consecutive, identical DBG_VALUEs are merged. ; Test that consecutive, identical DBG_VALUEs are merged.
;CHECK: DW_AT_location{{.*}}(<0x1> 55 ) ; CHECK: DW_AT_location{{.*}}(DW_OP_reg5 RDI)
%0 = type { i64, i1 } %0 = type { i64, i1 }

View File

@ -21,29 +21,14 @@
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_data4] ([[LOC:.*]]) ; CHECK: DW_AT_location {{.*}}({{.*}}
; CHECK-NEXT: 0x{{0*.*}} - [[C1:0x.*]]: DW_OP_consts +3
; CHECK-NEXT: [[C1]] - [[C2:0x.*]]: DW_OP_consts +7
; CHECK-NEXT: [[C2]] - [[R1:0x.*]]: DW_OP_reg0 RAX
; CHECK-NEXT: [[R1]] - [[R2:0x.*]]: DW_OP_breg7 RSP+4, DW_OP_deref)
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name{{.*}}"i" ; CHECK: DW_AT_name{{.*}}"i"
; CHECK: .debug_loc contents:
; CHECK: [[LOC]]:
; consts 0x00000003
; CHECK: Beginning address offset: 0x0000000000000{{.*}}
; CHECK: Ending address offset: [[C1:.*]]
; CHECK: Location description: 11 03
; consts 0x00000007
; CHECK: Beginning address offset: [[C1]]
; CHECK: Ending address offset: [[C2:.*]]
; CHECK: Location description: 11 07
; rax
; CHECK: Beginning address offset: [[C2]]
; CHECK: Ending address offset: [[R1:.*]]
; CHECK: Location description: 50
; rdi+0
; CHECK: Beginning address offset: [[R1]]
; CHECK: Ending address offset: [[R2:.*]]
; CHECK: Location description: 77 04
; rsp+4
;
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0" target triple = "x86_64-apple-macosx10.9.0"

View File

@ -21,8 +21,8 @@ while.end:
; CHECK-LABEL: test ; CHECK-LABEL: test
; CHECK: #DEBUG_VALUE: test:w <- [DW_OP_plus_uconst 8] [%RSP+0] ; CHECK: #DEBUG_VALUE: test:w <- [DW_OP_plus_uconst 8] [%RSP+0]
; DWARF: Location description: 77 08 ; DWARF: DW_AT_location [DW_FORM_sec_offset] (
; DW_OP_breg7 +8 ; DWARF-NEXT: {{.*}} - {{.*}}: DW_OP_breg7 RSP+8)
declare i1 @fn(i64*, i64*, i64*, i8*, i64, i64*, i32*, i8*) declare i1 @fn(i64*, i64*, i64*, i8*, i64, i64*, i32*, i8*)
declare void @llvm.dbg.value(metadata, metadata, metadata) declare void @llvm.dbg.value(metadata, metadata, metadata)

View File

@ -22,14 +22,10 @@
; argc is the first formal parameter. ; argc is the first formal parameter.
; DWARF: .debug_info contents: ; DWARF: .debug_info contents:
; DWARF: DW_TAG_formal_parameter ; DWARF: DW_TAG_formal_parameter
; DWARF-NEXT: DW_AT_location [DW_FORM_sec_offset] ([[argc_loc_offset:0x.*]]) ; DWARF-NEXT: DW_AT_location [DW_FORM_sec_offset] ({{0x.*}}
; DWARF-NEXT: 0x0000000000000000 - 0x0000000000000013: DW_OP_reg2 RCX)
; DWARF-NEXT: DW_AT_name [DW_FORM_strp] {{.*}} "argc" ; DWARF-NEXT: DW_AT_name [DW_FORM_strp] {{.*}} "argc"
; DWARF: .debug_loc contents:
; DWARF: [[argc_loc_offset]]: Beginning address offset: 0x0000000000000000
; DWARF-NEXT: Ending address offset: 0x0000000000000013
; DWARF-NEXT: Location description: 52
; ModuleID = 't.cpp' ; ModuleID = 't.cpp'
source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll" source_filename = "test/DebugInfo/X86/dbg-value-regmask-clobber.ll"
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -27,10 +27,7 @@
; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; 0x06 = DW_OP_deref ; CHECK: DW_AT_location{{.*}}(DW_OP_fbreg -24, DW_OP_deref, DW_OP_plus_uconst 0x20)
; 0x23 = DW_OP_uconst
; 0x91 = DW_OP_fbreg
; CHECK: DW_AT_location{{.*}}91 {{[0-9]+}} 06 23 {{[0-9]+}} )
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name{{.*}}"self" ; CHECK: DW_AT_name{{.*}}"self"
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG

View File

@ -29,15 +29,15 @@ target triple = "x86_64-apple-darwin"
; CHECK: DW_AT_byte_size {{.*}} (0x18) ; CHECK: DW_AT_byte_size {{.*}} (0x18)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l0_ofs0" ; CHECK: DW_AT_name {{.*}} "l0_ofs0"
; CHECK: DW_AT_data_member_location {{.*}}00 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l0_ofs8" ; CHECK: DW_AT_name {{.*}} "l0_ofs8"
; CHECK: DW_AT_data_member_location {{.*}}08 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l0_ofs16" ; CHECK: DW_AT_name {{.*}} "l0_ofs16"
; CHECK: DW_AT_bit_size {{.*}} (0x01) ; CHECK: DW_AT_bit_size {{.*}} (0x01)
; CHECK: DW_AT_bit_offset {{.*}} (0x1f) ; CHECK: DW_AT_bit_offset {{.*}} (0x1f)
; CHECK: DW_AT_data_member_location {{.*}}10 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x10)
; // --------------------------------------------------------------------- ; // ---------------------------------------------------------------------
; // Implicitly packed. ; // Implicitly packed.
@ -62,16 +62,16 @@ target triple = "x86_64-apple-darwin"
; CHECK: DW_AT_byte_size {{.*}} (0x0c) ; CHECK: DW_AT_byte_size {{.*}} (0x0c)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l1_ofs0" ; CHECK: DW_AT_name {{.*}} "l1_ofs0"
; CHECK: DW_AT_data_member_location {{.*}}00 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l1_ofs1" ; CHECK: DW_AT_name {{.*}} "l1_ofs1"
; CHECK: DW_AT_data_member_location {{.*}}01 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x1)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l1_ofs9" ; CHECK: DW_AT_name {{.*}} "l1_ofs9"
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK: DW_AT_bit_size {{.*}} (0x01) ; CHECK: DW_AT_bit_size {{.*}} (0x01)
; CHECK: DW_AT_bit_offset {{.*}} (0x17) ; CHECK: DW_AT_bit_offset {{.*}} (0x17)
; CHECK: DW_AT_data_member_location {{.*}}08 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; // --------------------------------------------------------------------- ; // ---------------------------------------------------------------------
; // Explicitly packed. ; // Explicitly packed.
@ -95,16 +95,16 @@ target triple = "x86_64-apple-darwin"
; CHECK: DW_AT_byte_size {{.*}} (0x0a) ; CHECK: DW_AT_byte_size {{.*}} (0x0a)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l2_ofs0" ; CHECK: DW_AT_name {{.*}} "l2_ofs0"
; CHECK: DW_AT_data_member_location {{.*}}00 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l2_ofs1" ; CHECK: DW_AT_name {{.*}} "l2_ofs1"
; CHECK: DW_AT_data_member_location {{.*}}01 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x1)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l2_ofs9" ; CHECK: DW_AT_name {{.*}} "l2_ofs9"
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK: DW_AT_bit_size {{.*}} (0x01) ; CHECK: DW_AT_bit_size {{.*}} (0x01)
; CHECK: DW_AT_bit_offset {{.*}} (0x17) ; CHECK: DW_AT_bit_offset {{.*}} (0x17)
; CHECK: DW_AT_data_member_location {{.*}}08 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x8)
; // --------------------------------------------------------------------- ; // ---------------------------------------------------------------------
; // Explicitly packed with different alignment. ; // Explicitly packed with different alignment.
@ -128,16 +128,16 @@ target triple = "x86_64-apple-darwin"
; CHECK: DW_AT_byte_size {{.*}} (0x10) ; CHECK: DW_AT_byte_size {{.*}} (0x10)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l3_ofs0" ; CHECK: DW_AT_name {{.*}} "l3_ofs0"
; CHECK: DW_AT_data_member_location {{.*}}00 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x0)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l3_ofs4" ; CHECK: DW_AT_name {{.*}} "l3_ofs4"
; CHECK: DW_AT_data_member_location {{.*}}04 ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0x4)
; CHECK: DW_TAG_member ; CHECK: DW_TAG_member
; CHECK: DW_AT_name {{.*}} "l3_ofs12" ; CHECK: DW_AT_name {{.*}} "l3_ofs12"
; CHECK: DW_AT_byte_size {{.*}} (0x04) ; CHECK: DW_AT_byte_size {{.*}} (0x04)
; CHECK: DW_AT_bit_size {{.*}} (0x01) ; CHECK: DW_AT_bit_size {{.*}} (0x01)
; CHECK: DW_AT_bit_offset {{.*}} (0x1f) ; CHECK: DW_AT_bit_offset {{.*}} (0x1f)
; CHECK: DW_AT_data_member_location {{.*}}0c ; CHECK: DW_AT_data_member_location {{.*}} (DW_OP_plus_uconst 0xc)
!llvm.dbg.cu = !{!2} !llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!49, !50} !llvm.module.flags = !{!49, !50}

View File

@ -1,6 +1,6 @@
; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s ; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj < %s \ ; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj < %s \
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF ; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck %s --check-prefix=DWARF
; Verify that we have correct debug info for local variables in code ; Verify that we have correct debug info for local variables in code
; instrumented with AddressSanitizer. ; instrumented with AddressSanitizer.
@ -30,8 +30,9 @@
; CHECK: .quad .Lfunc_begin0-.Lfunc_begin0 ; CHECK: .quad .Lfunc_begin0-.Lfunc_begin0
; CHECK-NEXT: .quad [[START_LABEL]]-.Lfunc_begin0 ; CHECK-NEXT: .quad [[START_LABEL]]-.Lfunc_begin0
; CHECK: DW_OP_breg5 ; CHECK: DW_OP_breg5
; DWARF: Location description: 75 00 06 ; DWARF: DW_TAG_formal_parameter
; DW_OP_breg5+0 DW_OP_deref ; DWARF: DW_AT_location
; DWARF-NEXT: {{.*}} - {{.*}}: DW_OP_breg5 RDI+0, DW_OP_deref
; Then it's addressed via %rsp: ; Then it's addressed via %rsp:
; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0 ; CHECK: .quad [[START_LABEL]]-.Lfunc_begin0
@ -39,8 +40,7 @@
; CHECK: DW_OP_breg7 ; CHECK: DW_OP_breg7
; CHECK-NEXT: [[OFFSET]] ; CHECK-NEXT: [[OFFSET]]
; CHECK: DW_OP_deref ; CHECK: DW_OP_deref
; DWARF: Location description: {{77 .. 06 06}} ; DWARF-NEXT: {{.*}} - {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_deref, DW_OP_deref)
; DW_OP_breg7+OFFSET DW_OP_deref DW_OP_deref
; ModuleID = 'test.cc' ; ModuleID = 'test.cc'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -26,18 +26,10 @@
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
; CHECK-NOT: NULL ; CHECK-NOT: NULL
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[DEBUGLOCOFFSET:0x[0-9a-f]+]]){{[[:space:]].*}}"val" ; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK-NEXT: {{0x.*}} - {{0x.*}}: DW_OP_reg0 RAX
; See that 'val' has at least one location entry with a DW_op_breg? operand. ; CHECK-NEXT: {{0x.*}} - {{0x.*}}: DW_OP_breg7 RSP+4, DW_OP_deref)
; The DWARF DW_op_breg* ops are encoded from 0x70 to 0x8f, but checking for an ; CHECK-NEXT: DW_AT_name {{.*}}"val"
; op in the range from 0x70 to 0x7f should suffice because that range covers
; all integer GPRs.
;
; CHECK: .debug_loc contents:
; CHECK-NOT: .debug{{.*}} contents
; CHECK: [[DEBUGLOCOFFSET]]: Beginning
; CHECK-NOT: {{0x[0-9a-f]+}}: Beginning
; CHECK: Location description: 7{{[0-9a-f] .*}}
; ModuleID = 'frame.c' ; ModuleID = 'frame.c'
source_filename = "frame.c" source_filename = "frame.c"

View File

@ -23,7 +23,8 @@
; } ; }
; Compiled separately for i386-pc-linux-gnu and linked together. ; Compiled separately for i386-pc-linux-gnu and linked together.
; This ensures that we have multiple compile units so that we can verify that ; This ensures that we have multiple compile units and multiple location lists
; so that we can verify that
; debug_loc entries are relative to the low_pc of the CU. The loc entry for ; debug_loc entries are relative to the low_pc of the CU. The loc entry for
; the byval argument in foo.cpp is in the second CU and so should have ; the byval argument in foo.cpp is in the second CU and so should have
; an offset relative to that CU rather than from the beginning of the text ; an offset relative to that CU rather than from the beginning of the text
@ -32,7 +33,7 @@
; Checking that we have two compile units with two sets of high/lo_pc. ; Checking that we have two compile units with two sets of high/lo_pc.
; CHECK: .debug_info contents ; CHECK: .debug_info contents
; CHECK: DW_TAG_compile_unit ; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_low_pc ; CHECK: DW_AT_low_pc {{.*}} (0x0000000000000020)
; CHECK: DW_AT_high_pc ; CHECK: DW_AT_high_pc
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
@ -41,21 +42,37 @@
; CHECK-NOT: {{DW_TAG|NULL}} ; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000) ; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK-NOT: DW_TAG ; CHECK-NEXT: 0x0000000000000000 - 0x0000000000000017: DW_OP_breg0 EAX+0, DW_OP_deref
; CHECK: DW_AT_name [DW_FORM_strp]{{.*}}"a" ; CHECK-NEXT: 0x0000000000000017 - 0x0000000000000043: DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"a"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK: DW_AT_location [DW_FORM_exprloc] ; CHECK: DW_AT_location [DW_FORM_exprloc]
; CHECK-NOT: DW_AT_location ; CHECK-NOT: DW_AT_location
; CHECK: DW_TAG_compile_unit ; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_low_pc ; CHECK: DW_AT_low_pc {{.*}} (0x0000000000000000)
; CHECK: DW_AT_high_pc ; CHECK: DW_AT_high_pc
; CHECK: DW_TAG_subprogram
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3bari"
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK: DW_TAG_formal_parameter
; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_sec_offset] ({{.*}}
; CHECK-NEXT: 0x0000000000000000 - 0x000000000000000a: DW_OP_consts +0, DW_OP_stack_value
; CHECK-NEXT: 0x000000000000000a - 0x0000000000000017: DW_OP_consts +1, DW_OP_stack_value)
; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}}"b"
; CHECK: .debug_loc contents: ; CHECK: .debug_loc contents:
; CHECK: 0x00000000: Beginning address offset: 0x0000000000000000 ; CHECK: 0x00000000:
; CHECK: Ending address offset: 0x0000000000000017 ; CHECK-NEXT: 0x0000000000000000 - 0x000000000000000a: DW_OP_consts +0, DW_OP_stack_value
; CHECK-NEXT: 0x000000000000000a - 0x0000000000000017: DW_OP_consts +1, DW_OP_stack_value
; CHECK: 0x00000022:
; CHECK-NEXT: 0x0000000000000000 - 0x0000000000000017: DW_OP_breg0 EAX+0, DW_OP_deref
; CHECK-NEXT: 0x0000000000000017 - 0x0000000000000043: DW_OP_breg5 EBP-8, DW_OP_deref, DW_OP_deref
%struct.A = type { i32 (...)**, i32 } %struct.A = type { i32 (...)**, i32 }
@ -64,8 +81,9 @@ define i32 @_Z3bari(i32 %b) #0 !dbg !4 {
entry: entry:
%b.addr = alloca i32, align 4 %b.addr = alloca i32, align 4
store i32 %b, i32* %b.addr, align 4 store i32 %b, i32* %b.addr, align 4
call void @llvm.dbg.declare(metadata i32* %b.addr, metadata !21, metadata !DIExpression()), !dbg !22 call void @llvm.dbg.value(metadata i32 0, metadata !21, metadata !DIExpression()), !dbg !22
%0 = load i32, i32* %b.addr, align 4, !dbg !23 %0 = load i32, i32* %b.addr, align 4, !dbg !23
call void @llvm.dbg.value(metadata i32 1, metadata !21, metadata !DIExpression()), !dbg !22
%add = add nsw i32 %0, 4, !dbg !23 %add = add nsw i32 %0, 4, !dbg !23
ret i32 %add, !dbg !23 ret i32 %add, !dbg !23
} }
@ -73,6 +91,8 @@ entry:
; Function Attrs: nounwind readnone ; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare void @llvm.dbg.value(metadata, metadata, metadata) #1
define void @_Z3baz1A(%struct.A* %a) #2 !dbg !14 { define void @_Z3baz1A(%struct.A* %a) #2 !dbg !14 {
entry: entry:
%z = alloca i32, align 4 %z = alloca i32, align 4

View File

@ -13,12 +13,13 @@
; DWARF2: .debug_info ; DWARF2: .debug_info
; DWARF2: DW_TAG_formal_parameter ; DWARF2: DW_TAG_formal_parameter
; DWARF2-NEXT: DW_AT_name {{.*}}"i" ; DWARF2-NEXT: DW_AT_name {{.*}}"i"
; DWARF2-NOT: DW_AT_location ; DWARF2-NOT: DW_AT_location
; CHECK: Beginning address offset: 0x0000000000000000 ; CHECK: .debug_loc contents:
; CHECK: Ending address offset: 0x0000000000000004 ; CHECK: 0x00000000:
; CHECK: Location description: 70 00 10 ff ff ff ff 0f 1a 10 01 1c 9f ; CHECK-NEXT: 0x0000000000000000 - 0x0000000000000004: DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_constu 0x1, DW_OP_minus, DW_OP_stack_value
; rax+0, constu 0xffffffff, and, constu 0x00000001, minus, stack-value ; rax+0, constu 0xffffffff, and, constu 0x00000001, minus, stack-value
source_filename = "minus.c" source_filename = "minus.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0" target triple = "x86_64-apple-macosx10.12.0"

View File

@ -3,8 +3,9 @@
; A hand-crafted FrameIndex location with a DW_OP_deref. ; A hand-crafted FrameIndex location with a DW_OP_deref.
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; fbreg -8, deref ; fbreg -8, deref
; CHECK-NEXT: DW_AT_location {{.*}} (<0x3> 91 78 06 ) ; CHECK-NEXT: DW_AT_location {{.*}} (DW_OP_fbreg -8, DW_OP_deref)
; CHECK-NEXT: DW_AT_name {{.*}} "foo" ; CHECK-NEXT: DW_AT_name {{.*}} "foo"
define void @f(i8* %bar) !dbg !6 { define void @f(i8* %bar) !dbg !6 {
entry: entry:
%foo.addr = alloca i8* %foo.addr = alloca i8*

View File

@ -5,8 +5,7 @@
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_abstract_origin ; CHECK: DW_AT_abstract_origin
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x8> 91 7c 93 02 91 78 93 02 ) ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg -4, DW_OP_piece 0x2, DW_OP_fbreg -8, DW_OP_piece 0x2)
; fbreg -8, piece 0x00000002, fbreg -4, piece 0x00000002
; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"a" ; CHECK-NEXT: DW_AT_abstract_origin {{.*}}"a"
; Inlined variable, not to be merged. ; Inlined variable, not to be merged.
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG

View File

@ -79,7 +79,7 @@ source_filename = "test/DebugInfo/X86/fission-cu.ll"
; CHECK: DW_AT_external [DW_FORM_flag_present] (true) ; CHECK: DW_AT_external [DW_FORM_flag_present] (true)
; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01) ; CHECK: DW_AT_decl_file [DW_FORM_data1] (0x01)
; CHECK: DW_AT_decl_line [DW_FORM_data1] (1) ; CHECK: DW_AT_decl_line [DW_FORM_data1] (1)
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x2> fb 00 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_GNU_addr_index 0x0)
; CHECK: [[TYPE]]: DW_TAG_base_type ; CHECK: [[TYPE]]: DW_TAG_base_type
; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "int") ; CHECK: DW_AT_name [DW_FORM_GNU_str_index] ( indexed (00000004) string = "int")

View File

@ -12,10 +12,10 @@
; CHECK: .debug_info.dwo contents: ; CHECK: .debug_info.dwo contents:
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[A:0x[0-9a-z]*]]) ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[A:0x[0-9a-z]*]]
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[E:0x[0-9a-z]*]]) ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[E:0x[0-9a-z]*]]
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[B:0x[0-9a-z]*]]) ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[B:0x[0-9a-z]*]]
; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[D:0x[0-9a-z]*]]) ; CHECK: DW_AT_location [DW_FORM_sec_offset] ([[D:0x[0-9a-z]*]]
; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000 ; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
; CHECK: .debug_loc contents: ; CHECK: .debug_loc contents:
; CHECK-NOT: Beginning address offset ; CHECK-NOT: Beginning address offset
@ -24,22 +24,16 @@
; Don't assume these locations are entirely correct - feel free to update them ; Don't assume these locations are entirely correct - feel free to update them
; if they've changed due to a bugfix, change in register allocation, etc. ; if they've changed due to a bugfix, change in register allocation, etc.
; CHECK: [[A]]: Beginning address index: 2 ; CHECK: [[A]]:
; CHECK-NEXT: Length: 169 ; CHECK-NEXT: Addr idx 2 (w/ length 169): DW_OP_consts +0, DW_OP_stack_value
; CHECK-NEXT: Location description: 11 00 ; CHECK-NEXT: Addr idx 3 (w/ length 25): DW_OP_reg0 RAX
; CHECK-NEXT: {{^$}} ; CHECK: [[E]]:
; CHECK-NEXT: Beginning address index: 3 ; CHECK-NEXT: Addr idx 4 (w/ length 19): DW_OP_reg0 RAX
; CHECK-NEXT: Length: 25 ; CHECK: [[B]]:
; CHECK-NEXT: Location description: 50 ; CHECK-NEXT: Addr idx 5 (w/ length 17): DW_OP_reg0 RAX
; CHECK: [[E]]: Beginning address index: 4 ; CHECK: [[D]]:
; CHECK-NEXT: Length: 19 ; CHECK-NEXT: Addr idx 6 (w/ length 17): DW_OP_reg0 RAX
; CHECK-NEXT: Location description: 50
; CHECK: [[B]]: Beginning address index: 5
; CHECK-NEXT: Length: 17
; CHECK-NEXT: Location description: 50
; CHECK: [[D]]: Beginning address index: 6
; CHECK-NEXT: Length: 17
; CHECK-NEXT: Location description: 50
; Make sure we don't produce any relocations in any .dwo section (though in particular, debug_info.dwo) ; Make sure we don't produce any relocations in any .dwo section (though in particular, debug_info.dwo)
; HDR-NOT: .rela.{{.*}}.dwo ; HDR-NOT: .rela.{{.*}}.dwo

View File

@ -20,21 +20,14 @@
; ;
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} (0x[[LD:.*]]) ; CHECK-NEXT: DW_AT_location {{.*}} (
; CHECK-NEXT: [[START:0x.*]] - [[END:0x.*]]: DW_OP_constu 0xc8f5c28f5c28f800, DW_OP_piece 0x8, DW_OP_constu 0x4000, DW_OP_bit_piece 0x10 0x40)
; CHECK-NEXT: DW_AT_name {{.*}}"ld" ; CHECK-NEXT: DW_AT_name {{.*}}"ld"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} (0x[[F:.*]]) ; CHECK-NEXT: DW_AT_location {{.*}} (
; CHECK-NEXT: [[START]] - [[END]]: DW_OP_constu 0x4048f5c3)
; CHECK-NEXT: DW_AT_name {{.*}}"f" ; CHECK-NEXT: DW_AT_name {{.*}}"f"
;
; CHECK: .debug_loc contents:
; CHECK: [[LD]]: Beginning address offset: [[START:.*]]
; CHECK: Ending address offset: [[END:.*]]
; CHECK: Location description: 10 80 f0 a3 e1 f5 d1 f0 fa c8 01 93 08 10 80 80 01 9d 10 40
; constu 0xc8f5c28f5c28f800, piece 8, constu 0x00004000, bit-piece 16 64
; CHECK: [[F]]: Beginning address offset: [[START]]
; CHECK: Ending address offset: [[END]]
; CHECK: Location description: 10 c3 eb a3 82 04
; constu ...
source_filename = "test.c" source_filename = "test.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0" target triple = "x86_64-apple-macosx10.11.0"

View File

@ -1,7 +1,6 @@
; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump --debug-dump=info - | FileCheck %s ; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump --debug-dump=info - | FileCheck %s
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; DW_OP_fbreg ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (DW_OP_fbreg +0)
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc] (<0x2> 91 00 )
; CHECK-NEXT: DW_AT_name {{.*}}"i" ; CHECK-NEXT: DW_AT_name {{.*}}"i"
target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -19,11 +19,10 @@
; CHECK: DW_TAG_inlined_subroutine ; CHECK: DW_TAG_inlined_subroutine
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar" ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "bar"
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x00000000) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_consts +0)
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a" ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a"
;
; CHECK: .debug_loc
; CHECK: Location description: 11 00
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin" target triple = "x86_64-apple-darwin"

View File

@ -22,8 +22,11 @@
; F(a,b,c,d,e); ; F(a,b,c,d,e);
; } ; }
; CHECK: Beginning address offset ; CHECK: .debug_loc contents:
; CHECK-NOT: Beginning address offset ; CHECK-NEXT: 0x00000000:
; CHECK-NEXT: 0x000000000000001f - 0x000000000000003c: DW_OP_reg3 RBX
; We should only have one entry
; CHECK-NOT: :
declare i32 @foobar(i32, i32, i32, i32, i32) declare i32 @foobar(i32, i32, i32, i32, i32)

View File

@ -5,19 +5,16 @@
; RUN: | llvm-dwarfdump -debug-dump=info - \ ; RUN: | llvm-dwarfdump -debug-dump=info - \
; RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=DWARF3 ; RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=DWARF3
; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle ; DWARF4: DW_AT_location [DW_FORM_sec_offset] (0x00000000
; DW_AT_location lists yet. ; DWARF4-NEXT: {{.*}}: DW_OP_breg2 RCX+0, DW_OP_deref
; DWARF4: DW_AT_location [DW_FORM_sec_offset] (0x00000000)
; FIXME: The location here needs to be fixed, but llvm-dwarfdump doesn't handle ; DWARF3: DW_AT_location [DW_FORM_data4] (0x00000000
; DW_AT_location lists yet. ; DWARF3-NEXT: {{.*}}: DW_OP_breg2 RCX+0, DW_OP_deref
; DWARF3: DW_AT_location [DW_FORM_data4] (0x00000000)
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla") ; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000067] = "vla")
; Unfortunately llvm-dwarfdump can't unparse a list of DW_AT_locations ; Check the DEBUG_VALUE comments for good measure.
; right now, so we check the asm output:
; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK ; RUN: llc -O0 -mtriple=x86_64-apple-darwin %s -o - -filetype=asm | FileCheck %s -check-prefix=ASM-CHECK
; vla should have a register-indirect address at one point. ; vla should have a register-indirect address at one point.
; ASM-CHECK: DEBUG_VALUE: vla <- [DW_OP_deref] [%RCX+0] ; ASM-CHECK: DEBUG_VALUE: vla <- [DW_OP_deref] [%RCX+0]

View File

@ -1,7 +1,7 @@
; REQUIRES: object-emission ; REQUIRES: object-emission
; ;
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -O0 -filetype=obj < %s > %t ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -O0 -filetype=obj < %s > %t
; RUN: llvm-dwarfdump %t | FileCheck %s ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
; Test case derived from compiling the following source with clang -g: ; Test case derived from compiling the following source with clang -g:
; ;
@ -23,21 +23,25 @@
; } ; }
; CHECK: debug_info contents ; CHECK: debug_info contents
; 0x74 is DW_OP_breg4, showing that the parameter is accessed indirectly ; The parameter is accessed indirectly (with a zero offset) from the second
; (with a zero offset) from the register parameter. ; register parameter. RDI is consumed by 'sret'.
; CHECK: DW_AT_location {{.*}} 74 00 06 ; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name{{.*}} = "func"
; CHECK: DW_TAG_formal_parameter
; CHECK: DW_AT_location {{.*}} (DW_OP_breg4 RSI+0, DW_OP_deref)
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name{{.*}} = "f" ; CHECK: DW_AT_name{{.*}} = "f"
;
; CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9]*]]) ; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name{{.*}} = "func2"
; CHECK: DW_TAG_formal_parameter
; CHECK: DW_AT_location{{.*}}(DW_OP_fbreg +23)
; CHECK: DW_TAG_formal_parameter
; CHECK: DW_AT_location{{.*}}(
; CHECK-NEXT: {{.*}}: DW_OP_breg4 RSI+0, DW_OP_deref
; CHECK-NEXT: {{.*}}: DW_OP_breg7 RSP+8, DW_OP_deref, DW_OP_deref)
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_name{{.*}} = "g" ; CHECK: DW_AT_name{{.*}} = "g"
;
; CHECK: debug_loc contents
; CHECK: [[G_LOC]]: Beginning
; CHECK-NEXT: Ending
; CHECK-NEXT: Location description: 74 00
%"struct.pr14763::foo" = type { i8 } %"struct.pr14763::foo" = type { i8 }

View File

@ -16,9 +16,10 @@
; ;
; The constant should NOT be available for the entire function. ; The constant should NOT be available for the entire function.
; CHECK-NOT: DW_AT_const_value ; CHECK-NOT: DW_AT_const_value
; CHECK: .debug_loc ; CHECK: .debug_loc contents:
; CHECK: Location description: 10 01 9f ; CHECK-NEXT: 0x00000000:
; constu 0x00000001, stack-value ; CHECK-NEXT: {{.*}}: DW_OP_constu 0x1, DW_OP_stack_value
source_filename = "test.ii" source_filename = "test.ii"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0" target triple = "x86_64-apple-macosx10.12.0"

View File

@ -17,14 +17,9 @@
; CHECK: .debug_loc contents: ; CHECK: .debug_loc contents:
; ;
; 0x0000000000000000 - 0x0000000000000006: rdi, piece 0x00000008, rsi, piece 0x00000004 ; CHECK: 0x0000000000000000 - [[LTMP3:.*]]: DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_reg4 RSI, DW_OP_piece 0x4
; CHECK: Beginning address offset: 0x0000000000000000 ; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x8, rax, piece 0x4 )
; CHECK: Ending address offset: [[LTMP3:.*]] ; CHECK: [[LTMP3]] - {{.*}}: DW_OP_breg6 RBP-8, DW_OP_piece 0x8, DW_OP_reg4 RSI, DW_OP_piece 0x4
; CHECK: Location description: 55 93 08 54 93 04
; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x00000008, rax, piece 0x00000004 )
; CHECK: Beginning address offset: [[LTMP3]]
; CHECK: Ending address offset: [[END:.*]]
; CHECK: Location description: 76 78 93 08 54 93 04
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0" target triple = "x86_64-apple-macosx10.9.0"

View File

@ -17,15 +17,10 @@
; ;
; ;
; CHECK: DW_TAG_variable [4] ; CHECK: DW_TAG_variable [4]
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] ([[LOC:.*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: 0x0000000000000004 - 0x0000000000000005: DW_OP_reg0 RAX, DW_OP_piece 0x4)
; CHECK-NEXT: DW_AT_name {{.*}}"i1" ; CHECK-NEXT: DW_AT_name {{.*}}"i1"
;
; CHECK: .debug_loc
; CHECK: [[LOC]]: Beginning address offset: 0x0000000000000004
; CHECK-NEXT: Ending address offset: 0x0000000000000005
; rax, piece 0x00000004
; CHECK-NEXT: Location description: 50 93 04
;
; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-1.ll' ; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-1.ll'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0" target triple = "x86_64-apple-macosx10.9.0"

View File

@ -16,26 +16,14 @@
; } ; }
; ;
; CHECK: DW_TAG_formal_parameter [3] ; CHECK: DW_TAG_formal_parameter [3]
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] ([[LOC1:.*]]) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: 0x0000000000000000 - 0x0000000000000004: DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_piece 0x4, DW_OP_reg4 RSI, DW_OP_piece 0x4
; CHECK-NEXT: 0x0000000000000004 - 0x0000000000000008: DW_OP_reg5 RDI, DW_OP_piece 0x8, DW_OP_piece 0x4, DW_OP_reg4 RSI, DW_OP_piece 0x4)
; CHECK-NEXT: DW_AT_name {{.*}}"outer" ; CHECK-NEXT: DW_AT_name {{.*}}"outer"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location ; CHECK-NEXT: DW_AT_location {{.*}}(DW_OP_reg4 RSI, DW_OP_piece 0x4)
; rsi, piece 0x00000004
; CHECK-SAME: 54 93 04
; CHECK-NEXT: "i1" ; CHECK-NEXT: "i1"
;
; CHECK: .debug_loc
; CHECK: [[LOC1]]: Beginning address offset: 0x0000000000000000
; CHECK-NEXT: Ending address offset: 0x0000000000000004
; rdi, piece 0x00000008, piece 0x00000004, rsi, piece 0x00000004
; CHECK-NEXT: Location description: 55 93 08 93 04 54 93 04
; This location is split into two ranges with identical locations
; because it comes from a DBG_VALUE %RSI followed by a DBG_VALUE %ESI.
; CHECK: Beginning address offset: 0x0000000000000004
; CHECK-NEXT: Ending address offset: 0x0000000000000008
; CHECK-NEXT: Location description: 55 93 08 93 04 54 93 04
;
; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-2.ll' ; ModuleID = '/Volumes/Data/llvm/test/DebugInfo/X86/sroasplit-2.ll'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0" target triple = "x86_64-apple-macosx10.9.0"

View File

@ -1,5 +1,5 @@
; RUN: llc < %s | FileCheck %s ; RUN: llc < %s | FileCheck %s
; RUN: llc -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF ; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-dump=loc - | FileCheck %s --check-prefix=DWARF
; Compile the following with -O1: ; Compile the following with -O1:
@ -22,8 +22,10 @@
; CHECK: #NO_APP ; CHECK: #NO_APP
; CHECK: movl [[offs]](%rsp), %eax # 4-byte Reload ; CHECK: movl [[offs]](%rsp), %eax # 4-byte Reload
; CHECK: retq ; CHECK: retq
; DWARF: Location description: {{77 .. 93 04 10 00 9f 93 04}}
; DW_OP_breg7+offs DW_OP_piece 4 DW_OP_constu 0 DW_OP_stack_value DW_OP_piece 4 ; DWARF: .debug_loc contents:
; DWARF-NEXT: 0x00000000:
; DWARF-NEXT: {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
; ModuleID = 't.c' ; ModuleID = 't.c'
source_filename = "t.c" source_filename = "t.c"

View File

@ -12,9 +12,7 @@
; CHECK: DW_AT_name {{.*}} "this" ; CHECK: DW_AT_name {{.*}} "this"
; CHECK-NOT: DW_TAG_subprogram ; CHECK-NOT: DW_TAG_subprogram
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; CHECK-NEXT: DW_AT_location ; CHECK-NEXT: DW_AT_location {{.*}}(DW_OP_breg4 RSI+0)
; rsi+0
; CHECK-SAME: 74 00
; CHECK-NEXT: DW_AT_name {{.*}} "v" ; CHECK-NEXT: DW_AT_name {{.*}} "v"
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"

View File

@ -5,14 +5,13 @@
; ;
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: {{.*}}: DW_OP_reg0 RAX)
; CHECK-NEXT: DW_AT_name{{.*}}"a" ; CHECK-NEXT: DW_AT_name{{.*}}"a"
; CHECK: .debug_loc contents:
; rax
; CHECK: Location description: 50
; SANITY: DBG_VALUE ; SANITY: DBG_VALUE
; SANITY-NOT: DBG_VALUE ; SANITY-NOT: DBG_VALUE
; ModuleID = 'test.ll'
; Compiled with -O: ; Compiled with -O:
; void h(int); ; void h(int);
; int g(); ; int g();
@ -21,6 +20,8 @@
; int a = g(); ; int a = g();
; h(a); ; h(a);
; } ; }
; ModuleID = 'test.ll'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx" target triple = "x86_64-apple-macosx"

View File

@ -3,7 +3,7 @@
; A single FI location. This used to trigger an assertion in debug libstdc++. ; A single FI location. This used to trigger an assertion in debug libstdc++.
; CHECK: DW_TAG_formal_parameter ; CHECK: DW_TAG_formal_parameter
; fbreg -8 ; fbreg -8
; CHECK-NEXT: DW_AT_location {{.*}} (<0x2> 91 78 ) ; CHECK-NEXT: DW_AT_location {{.*}} (DW_OP_fbreg -8)
; CHECK-NEXT: DW_AT_name {{.*}} "dipsy" ; CHECK-NEXT: DW_AT_name {{.*}} "dipsy"
define void @tinkywinky(i8* %dipsy) !dbg !6 { define void @tinkywinky(i8* %dipsy) !dbg !6 {
entry: entry:

View File

@ -11,21 +11,19 @@ target triple = "x86_64-apple-macosx10.12.0"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_name {{.*}}"point" ; CHECK-NEXT: DW_AT_name {{.*}}"point"
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x16> 03 04 00 00 00 00 00 00 00 93 04 03 00 00 00 00 00 00 00 00 93 04 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x4, DW_OP_piece 0x4, DW_OP_addr 0x0, DW_OP_piece 0x4)
; [0x0000000000000004], piece 0x00000004, [0x0000000000000000], piece 0x00000004
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_TAG ; CHECK: DW_TAG
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_name {{.*}}"part_const" ; CHECK-NEXT: DW_AT_name {{.*}}"part_const"
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x10> 03 08 00 00 00 00 00 00 00 93 04 10 02 9f 93 04 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4)
; [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004 ; [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_name {{.*}}"full_const" ; CHECK-NEXT: DW_AT_name {{.*}}"full_const"
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
; CHECK: DW_AT_location [DW_FORM_exprloc] (<0xa> 10 01 9f 93 04 10 02 9f 93 04 ) ; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_constu 0x1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4)
; constu 0x00000001, stack-value, piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004
; CHECK-NOT: DW_TAG ; CHECK-NOT: DW_TAG
@point.y = global i32 2, align 4, !dbg !13 @point.y = global i32 2, align 4, !dbg !13
@point.x = global i32 1, align 4, !dbg !12 @point.x = global i32 1, align 4, !dbg !12

View File

@ -10,13 +10,10 @@
; RUN: llc -O0 -fast-isel=false -mtriple=x86_64-apple-darwin -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s ; RUN: llc -O0 -fast-isel=false -mtriple=x86_64-apple-darwin -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
; CHECK: _ZN1B9AInstanceEv ; CHECK: _ZN1B9AInstanceEv
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000) ; CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x00000000
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_breg5 RDI+0
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_breg6 RBP-24, DW_OP_deref)
; CHECK-NEXT: DW_AT_name {{.*}}"a" ; CHECK-NEXT: DW_AT_name {{.*}}"a"
; CHECK: .debug_loc contents:
; CHECK: 0x00000000: Beginning address offset:
; CHECK-NEXT: Ending address offset:
; CHECK-NEXT: Location description: 75 00
; rdi+0
%class.A = type { i32 (...)**, i32 } %class.A = type { i32 (...)**, i32 }
%class.B = type { i8 } %class.B = type { i8 }

View File

@ -1,7 +1,8 @@
; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s ; RUN: llc -filetype=obj -o - %s | llvm-dwarfdump -debug-dump=loc - | FileCheck %s
; Note that it would be even better to avoid emitting the empty piece. ; Note that it would be even better to avoid emitting the empty piece.
; CHECK: Location description: 93 08 ; CHECK: {{.*}}: DW_OP_piece 0x8{{$}}
; piece 0x00000008
source_filename = "bugpoint-reduced-simplified.ll" source_filename = "bugpoint-reduced-simplified.ll"
target triple = "i386-apple-ios7.0.0" target triple = "i386-apple-ios7.0.0"

View File

@ -18,25 +18,22 @@
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}} "i" ; CHECK: DW_AT_name {{.*}} "i"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} ([[I:.*]]) ; CHECK-NEXT: DW_AT_location {{.*}} ([[I:.*]]
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
; CHECK-NEXT: DW_AT_name {{.*}} "r" ; CHECK-NEXT: DW_AT_name {{.*}} "r"
; ;
; CHECK: DW_TAG_subprogram ; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}} "f" ; CHECK: DW_AT_name {{.*}} "f"
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} ([[F:.*]]) ; CHECK-NEXT: DW_AT_location {{.*}} ([[F:.*]]
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
; CHECK-NEXT: DW_AT_name {{.*}} "r" ; CHECK-NEXT: DW_AT_name {{.*}} "r"
; ;
; CHECK: .debug_loc contents: ; CHECK: .debug_loc contents:
; CHECK: [[I]]: Beginning address offset: ; CHECK: [[I]]:
; CHECK-NEXT: Ending address offset: ; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
; CHECK-NEXT: Location description: 55 93 04 10 00 9f 93 04 ; CHECK: [[F]]:
; rdi, piece 0x00000004, constu 0x00000000, stack-value, piece 0x00000004 ; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
;
; CHECK: [[F]]: Beginning address offset:
; CHECK-NEXT: Ending address offset:
; CHECK-NEXT: Location description: 61 93 04 10 00 9f 93 04
; reg17, piece 0x00000004, constu 0x00000000, stack-value, piece 0x00000004
source_filename = "stack-value-piece.c" source_filename = "stack-value-piece.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -8,11 +8,9 @@
; ;
; CHECK: .debug_info contents: ; CHECK: .debug_info contents:
; CHECK: DW_TAG_variable ; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (0x00000000) ; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
; CHECK-NEXT: {{.*}} - {{.*}}: DW_OP_reg4 RSI)
; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}} "a" ; CHECK-NEXT: DW_AT_name [DW_FORM_strp]{{.*}} "a"
; CHECK: .debug_loc contents:
; rsi
; CHECK: Location description: 54
; ;
; struct bar { ; struct bar {
; int a; ; int a;

View File

@ -29,7 +29,7 @@
; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use ; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use
; the value immediately, rather than indirecting through the address. ; the value immediately, rather than indirecting through the address.
; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]{{ *}}(<0xa> 03 00 00 00 00 00 00 00 00 9f ) ; CHECK-NEXT: DW_AT_location [DW_FORM_exprloc]{{ *}}(DW_OP_addr 0x0, DW_OP_stack_value)
; CHECK-NOT: NULL ; CHECK-NOT: NULL
; CHECK: DW_TAG_GNU_template_template_param ; CHECK: DW_TAG_GNU_template_template_param

View File

@ -18,8 +18,8 @@
; modified by the debugger. ; modified by the debugger.
; ;
; ASM: [DW_OP_stack_value] ; ASM: [DW_OP_stack_value]
; CHECK: DW_AT_location {{.*}} 70 00 9f ; CHECK: DW_AT_location {{.*}} (DW_OP_breg0 RAX+0, DW_OP_stack_value)
; rax+0, stack-value
source_filename = "ab.cpp" source_filename = "ab.cpp"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0" target triple = "x86_64-apple-macosx10.12.0"

View File

@ -3,24 +3,20 @@ Note: the input file was generated from Inputs/dwarfdump-test-loc-list-32bit.elf
CHECK: .debug_info CHECK: .debug_info
CHECK: DW_AT_name{{.*}}"f" CHECK: DW_AT_name{{.*}}"f"
CHECK: DW_AT_location{{.*}}([[F_LOC:0x[0-9a-f]*]]) CHECK: DW_AT_location{{.*}}([[F_LOC:0x[0-9a-f]*]]
CHECK-NEXT: 0x0000000000000000 - 0x0000000000000023: DW_OP_reg1 ECX
CHECK-NEXT: 0x0000000000000023 - 0x000000000000005d: DW_OP_breg5 EBP-16)
CHECK: DW_AT_name{{.*}}"g" CHECK: DW_AT_name{{.*}}"g"
CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9a-f]*]]) CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9a-f]*]]
CHECK-NEXT: 0x0000000000000000 - 0x0000000000000020: DW_OP_reg0 EAX
CHECK-NEXT: 0x0000000000000020 - 0x000000000000005d: DW_OP_breg5 EBP-12)
CHECK: .debug_loc contents: CHECK: .debug_loc contents:
CHECK-NEXT: [[F_LOC]]: Beginning address offset: 0x0000000000000000 CHECK-NEXT: [[F_LOC]]:
CHECK-NEXT: Ending address offset: 0x0000000000000023
this is actually the wrong location due to PR14763, but that doesn't matter for this is actually the wrong location due to PR14763, but that doesn't matter for
the purposes of testing dwarfdump the purposes of testing dwarfdump
CHECK-NEXT: Location description: 51 CHECK-NEXT: 0x0000000000000000 - 0x0000000000000023: DW_OP_reg1 ECX
CHECK-NEXT: {{^$}} CHECK-NEXT: 0x0000000000000023 - 0x000000000000005d: DW_OP_breg5 EBP-16
CHECK-NEXT: Beginning address offset: 0x0000000000000023 CHECK: [[G_LOC]]:
CHECK-NEXT: Ending address offset: 0x000000000000005d CHECK-NEXT: 0x0000000000000000 - 0x0000000000000020: DW_OP_reg0 EAX
CHECK-NEXT: Location description: 75 70 CHECK-NEXT: 0x0000000000000020 - 0x000000000000005d: DW_OP_breg5 EBP-12
CHECK-NEXT: {{^$}}
CHECK-NEXT: [[G_LOC]]: Beginning address offset: 0x0000000000000000
CHECK-NEXT: Ending address offset: 0x0000000000000020
CHECK-NEXT: Location description: 50
CHECK-NEXT: {{^$}}
CHECK-NEXT: Beginning address offset: 0x0000000000000020
CHECK-NEXT: Ending address offset: 0x000000000000005d
CHECK-NEXT: Location description: 75 74

View File

@ -6,7 +6,6 @@ int bar = 42;
CHECK: DW_TAG_variable CHECK: DW_TAG_variable
CHECK-NOT: DW_TAG CHECK-NOT: DW_TAG
CHECK: DW_AT_name{{.*}}"bar" CHECK: DW_AT_name{{.*}}
CHECK-NOT: DW_TAG "bar" CHECK - NOT : DW_TAG
CHECK: DW_AT_location{{.*}}<0x05> 03 10 00 01 00 CHECK : DW_AT_location{{.*}}(DW_OP_addr 0x10010)

View File

@ -31,19 +31,19 @@ CHECK: DW_AT_external [DW_FORM_flag] (0x01)
CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ea0) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ea0)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000ec4) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000ec4)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000056] = "argc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000056] = "argc")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
CHECK: DW_AT_decl_line [DW_FORM_data1] (23) CHECK: DW_AT_decl_line [DW_FORM_data1] (23)
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0063 => {0x00000063}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0063 => {0x00000063})
CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 78 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg -8)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005b] = "argv") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005b] = "argv")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
CHECK: DW_AT_decl_line [DW_FORM_data1] (23) CHECK: DW_AT_decl_line [DW_FORM_data1] (23)
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006a => {0x0000006a}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006a => {0x0000006a})
CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 70 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg -16)
CHECK: NULL CHECK: NULL
CHECK: DW_TAG_base_type [4] CHECK: DW_TAG_base_type [4]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int")
@ -75,31 +75,31 @@ CHECK: DW_TAG_variable [7]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000072] = "private_int") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000072] = "private_int")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7})
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
BASIC: DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 ) BASIC: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001008)
ARCHIVE: DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 ) ARCHIVE: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001004)
CHECK: DW_TAG_variable [7] CHECK: DW_TAG_variable [7]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "baz") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "baz")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7})
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
CHECK: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001000)
CHECK: DW_TAG_subprogram [2] * CHECK: DW_TAG_subprogram [2] *
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000082] = "foo") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000082] = "foo")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7})
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ed0) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000ed0)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f19) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f19)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7})
CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 7c ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg -4)
CHECK: NULL CHECK: NULL
CHECK: DW_TAG_subprogram [8] CHECK: DW_TAG_subprogram [8]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0026 => {0x000000a7})
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f20) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f20)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f37) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f37)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: NULL CHECK: NULL
CHECK: Compile Unit: CHECK: Compile Unit:
@ -114,8 +114,8 @@ CHECK: DW_TAG_variable [9]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000097] = "val") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000097] = "val")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x003c => {0x00000162}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x003c => {0x00000162})
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
BASIC: DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 ) BASIC: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001004)
ARCHIVE: DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 ) ARCHIVE: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001008)
CHECK: DW_TAG_volatile_type [10] CHECK: DW_TAG_volatile_type [10]
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167})
CHECK: DW_TAG_base_type [4] CHECK: DW_TAG_base_type [4]
@ -125,18 +125,18 @@ CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000009b] = "bar")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167})
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f84) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f84)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167})
CHECK: DW_AT_location [DW_FORM_block1] (<0x02> 91 78 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_fbreg -8)
CHECK: NULL CHECK: NULL
CHECK: DW_TAG_subprogram [8] CHECK: DW_TAG_subprogram [8]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0041 => {0x00000167})
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fa9) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fa9)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: NULL CHECK: NULL

View File

@ -16,19 +16,19 @@ CHECK: DW_AT_high_pc [DW_FORM_data4] (0x0000000b)
CHECK: DW_TAG_subprogram [2] * CHECK: DW_TAG_subprogram [2] *
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40)
CHECK: DW_AT_high_pc [DW_FORM_data4] (0x0000000b) CHECK: DW_AT_high_pc [DW_FORM_data4] (0x0000000b)
CHECK: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) CHECK: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg6 RBP)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000027] = "main") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000027] = "main")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
CHECK: DW_AT_prototyped [DW_FORM_flag_present] (true) CHECK: DW_AT_prototyped [DW_FORM_flag_present] (true)
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000000000a1) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000000000a1)
CHECK: DW_AT_external [DW_FORM_flag_present] (true) CHECK: DW_AT_external [DW_FORM_flag_present] (true)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_location [DW_FORM_exprloc] (<0x3> 55 93 04 ) CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_reg5 RDI, DW_OP_piece 0x4)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002c] = "argc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000002c] = "argc")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic1.c")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000000000a1) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000000000a1)
CHECK: DW_TAG_formal_parameter [4] CHECK: DW_TAG_formal_parameter [4]
CHECK: DW_AT_location [DW_FORM_exprloc] (<0x1> 54 ) CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_reg4 RSI)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000031] = "argv") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000031] = "argv")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0060 => {0x00000060}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0060 => {0x00000060})
CHECK: NULL CHECK: NULL
@ -55,11 +55,11 @@ CHECK: DW_TAG_base_type [7]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000044] = "int") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000044] = "int")
CHECK: DW_TAG_variable [8] CHECK: DW_TAG_variable [8]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000048] = "baz") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000048] = "baz")
CHECK: DW_AT_location [DW_FORM_exprloc] (<0x9> 03 00 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x100001000)
CHECK: DW_TAG_variable [8] CHECK: DW_TAG_variable [8]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000004c] = "private_int") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000004c] = "private_int")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
CHECK: DW_AT_location [DW_FORM_exprloc] (<0x9> 03 08 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x100001008)
CHECK: DW_TAG_subprogram [9] CHECK: DW_TAG_subprogram [9]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000058] = "inc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000058] = "inc")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1})
@ -67,13 +67,14 @@ CHECK: DW_AT_inline [DW_FORM_data1] (DW_INL_inlined)
CHECK: DW_TAG_subprogram [10] * CHECK: DW_TAG_subprogram [10] *
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f50) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f50)
CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000037) CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000037)
CHECK: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) CHECK: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg6 RBP)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005c] = "foo") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005c] = "foo")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
CHECK: DW_AT_prototyped [DW_FORM_flag_present] (true) CHECK: DW_AT_prototyped [DW_FORM_flag_present] (true)
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1})
CHECK: DW_TAG_formal_parameter [11] CHECK: DW_TAG_formal_parameter [11]
CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000) CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000
CHECK: 0x0000000000000000 - 0x000000000000000c: DW_OP_reg5 RDI, DW_OP_piece 0x4)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "arg") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "arg")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x002a => {0x000000a1})
CHECK: DW_TAG_inlined_subroutine [12] CHECK: DW_TAG_inlined_subroutine [12]
@ -94,7 +95,7 @@ CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000024)
CHECK: DW_TAG_variable [13] CHECK: DW_TAG_variable [13]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006d] = "val") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006d] = "val")
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
CHECK: DW_AT_location [DW_FORM_exprloc] (<0x9> 03 04 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x100001004)
CHECK: DW_TAG_volatile_type [14] CHECK: DW_TAG_volatile_type [14]
CHECK: DW_TAG_subprogram [15] CHECK: DW_TAG_subprogram [15]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000058] = "inc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000058] = "inc")
@ -102,10 +103,12 @@ CHECK: DW_AT_inline [DW_FORM_data1] (DW_INL_inlined)
CHECK: DW_TAG_subprogram [2] * CHECK: DW_TAG_subprogram [2] *
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90)
CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000024) CHECK: DW_AT_high_pc [DW_FORM_data4] (0x00000024)
CHECK: DW_AT_frame_base [DW_FORM_exprloc] (<0x1> 56 ) CHECK: DW_AT_frame_base [DW_FORM_exprloc] (DW_OP_reg6 RBP)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000071] = "bar") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000071] = "bar")
CHECK: DW_TAG_formal_parameter [16] CHECK: DW_TAG_formal_parameter [16]
CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000025) CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000025
CHECK: 0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK: 0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4)
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "arg") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "arg")
CHECK: DW_TAG_inlined_subroutine [17] CHECK: DW_TAG_inlined_subroutine [17]
CHECK: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0044 => {0x0000015f} "inc") CHECK: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x0044 => {0x0000015f} "inc")
@ -118,17 +121,13 @@ CHECK: NULL
CHECK: .debug_loc contents: CHECK: .debug_loc contents:
CHECK-NEXT: 0x00000000: Beginning address offset: 0x0000000000000000 CHECK-NEXT: 0x00000000:
CHECK-NEXT: Ending address offset: 0x000000000000000c CHECK-NEXT: 0x0000000000000000 - 0x000000000000000c: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK-NEXT: Location description: 55 93 04 CHECK-NOT: :
CHECK-NEXT: {{^$}} CHECK: 0x00000025:
CHECK-NEXT: 0x00000025: Beginning address offset: 0x0000000000000000 CHECK-NEXT: 0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK-NEXT: Ending address offset: 0x000000000000000f CHECK-NEXT: 0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK-NEXT: Location description: 55 93 04
CHECK-NEXT: {{^$}}
CHECK-NEXT: Beginning address offset: 0x0000000000000019
CHECK-NEXT: Ending address offset: 0x000000000000001d
CHECK-NEXT: Location description: 55 93 04
CHECK: .debug_aranges contents: CHECK: .debug_aranges contents:
CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00 CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00

View File

@ -24,15 +24,15 @@ CHECK: DW_AT_external [DW_FORM_flag] (0x01)
CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public) CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f40)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f4b) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f4b)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000056] = "argc") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000056] = "argc")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0063 => {0x00000063}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0063 => {0x00000063})
CHECK: DW_AT_location [DW_FORM_block1] (<0x03> 55 93 04 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_reg5 RDI, DW_OP_piece 0x4)
CHECK: DW_TAG_formal_parameter [3] CHECK: DW_TAG_formal_parameter [3]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005b] = "argv") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005b] = "argv")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006a => {0x0000006a}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006a => {0x0000006a})
CHECK: DW_AT_location [DW_FORM_block1] (<0x01> 54 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI)
CHECK: NULL CHECK: NULL
CHECK: DW_TAG_base_type [4] CHECK: DW_TAG_base_type [4]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000060] = "int")
@ -62,21 +62,22 @@ CHECK: DW_TAG_variable [7]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000072] = "private_int") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000072] = "private_int")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic2.c")
CHECK: DW_AT_location [DW_FORM_block1] (<0x09> 03 08 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001008)
CHECK: DW_TAG_variable [7] CHECK: DW_TAG_variable [7]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "baz") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000007e] = "baz")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_AT_location [DW_FORM_block1] (<0x09> 03 00 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001000)
CHECK: DW_TAG_subprogram [8] * CHECK: DW_TAG_subprogram [8] *
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000082] = "foo") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000082] = "foo")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f50) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f50)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f89) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000f89)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: DW_TAG_formal_parameter [9] CHECK: DW_TAG_formal_parameter [9]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_AT_location [DW_FORM_data4] (0x00000000) CHECK: DW_AT_location [DW_FORM_data4] (0x00000000
CHECK: 0x0000000000000000 - 0x000000000000000e: DW_OP_reg5 RDI, DW_OP_piece 0x4)
CHECK: DW_TAG_inlined_subroutine [10] CHECK: DW_TAG_inlined_subroutine [10]
CHECK: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x00a7 => {0x00000128} "inc") CHECK: DW_AT_abstract_origin [DW_FORM_ref4] (cu + 0x00a7 => {0x00000128} "inc")
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f63) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f63)
@ -101,7 +102,7 @@ CHECK: DW_TAG_variable [12]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000097] = "val") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000097] = "val")
CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x003c => {0x00000176}) CHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x003c => {0x00000176})
CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c") CHECK: DW_AT_decl_file [DW_FORM_data1] ("/Inputs{{[/\\]}}basic3.c")
CHECK: DW_AT_location [DW_FORM_block1] (<0x09> 03 04 10 00 00 01 00 00 00 ) CHECK: DW_AT_location [DW_FORM_block1] (DW_OP_addr 0x100001004)
CHECK: DW_TAG_volatile_type [13] CHECK: DW_TAG_volatile_type [13]
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_TAG_subprogram [8] * CHECK: DW_TAG_subprogram [8] *
@ -109,11 +110,13 @@ CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000009b] = "bar")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f90)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fb4) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fb4)
CHECK: DW_AT_frame_base [DW_FORM_block1] (<0x01> 56 ) CHECK: DW_AT_frame_base [DW_FORM_block1] (DW_OP_reg6 RBP)
CHECK: DW_TAG_formal_parameter [9] CHECK: DW_TAG_formal_parameter [9]
CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg") CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000086] = "arg")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: DW_AT_location [DW_FORM_data4] (0x00000025) CHECK: DW_AT_location [DW_FORM_data4] (0x00000025
CHECK: 0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK: 0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4)
CHECK: DW_TAG_lexical_block [14] * CHECK: DW_TAG_lexical_block [14] *
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f94) CHECK: DW_AT_low_pc [DW_FORM_addr] (0x0000000100000f94)
CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fa7) CHECK: DW_AT_high_pc [DW_FORM_addr] (0x0000000100000fa7)
@ -129,18 +132,13 @@ CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000008a] = "inc")
CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063) CHECK: DW_AT_type [DW_FORM_ref_addr] (0x0000000000000063)
CHECK: NULL CHECK: NULL
CHECK:.debug_loc contents: CHECK: .debug_loc contents:
CHECK-NEXT: 0x00000000: Beginning address offset: 0x0000000000000000 CHECK-NEXT: 0x00000000:
CHECK-NEXT: Ending address offset: 0x000000000000000e CHECK-NEXT: 0x0000000000000000 - 0x000000000000000e: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK-NEXT: Location description: 55 93 04 CHECK-NOT: :
CHECK-NEXT: {{^$}} CHECK: 0x00000025:
CHECK-NEXT: 0x00000025: Beginning address offset: 0x0000000000000000 CHECK-NEXT: 0x0000000000000000 - 0x000000000000000f: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK-NEXT: Ending address offset: 0x000000000000000f CHECK-NEXT: 0x0000000000000019 - 0x000000000000001d: DW_OP_reg5 RDI, DW_OP_piece 0x4
CHECK-NEXT: Location description: 55 93 04
CHECK-NEXT: {{^$}}
CHECK-NEXT: Beginning address offset: 0x0000000000000019
CHECK-NEXT: Ending address offset: 0x000000000000001d
CHECK-NEXT: Location description: 55 93 04
CHECK: .debug_aranges contents: CHECK: .debug_aranges contents:
CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00 CHECK-NEXT: Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00

View File

@ -11,7 +11,7 @@ $ clang common.macho.x86_64.o -o common.macho.x86_64
CHECK: DW_TAG_variable CHECK: DW_TAG_variable
CHECK: DW_AT_name {{.*}} "common" CHECK: DW_AT_name {{.*}} "common"
CHECK-NOT: {{NULL|DW_TAG}} CHECK-NOT: {{NULL|DW_TAG}}
CHECK: DW_AT_location {{.*}} (<0x09> 03 00 10 00 00 01 00 00 00 ) CHECK: DW_AT_location {{.*}} (DW_OP_addr 0x100001000)
CHECK: DW_TAG_subprogram CHECK: DW_TAG_subprogram
CHECK-NEXT: DW_AT_low_pc{{.*}}(0x0000000100000f80) CHECK-NEXT: DW_AT_low_pc{{.*}}(0x0000000100000f80)

View File

@ -1,5 +1,8 @@
set(LLVM_LINK_COMPONENTS set(LLVM_LINK_COMPONENTS
DebugInfoDWARF DebugInfoDWARF
AllTargetsDescs
AllTargetsInfos
MC
Object Object
Support Support
) )

View File

@ -26,6 +26,7 @@
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h" #include "llvm/Support/Signals.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
@ -94,7 +95,9 @@ static void error(StringRef Filename, std::error_code EC) {
} }
static void DumpObjectFile(ObjectFile &Obj, Twine Filename) { static void DumpObjectFile(ObjectFile &Obj, Twine Filename) {
std::unique_ptr<DIContext> DICtx = DWARFContext::create(Obj); std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(Obj);
logAllUnhandledErrors(DICtx->loadRegisterInfo(Obj), errs(),
Filename.str() + ": ");
outs() << Filename.str() << ":\tfile format " << Obj.getFileFormatName() outs() << Filename.str() << ":\tfile format " << Obj.getFileFormatName()
<< "\n\n"; << "\n\n";
@ -209,6 +212,9 @@ int main(int argc, char **argv) {
PrettyStackTraceProgram X(argc, argv); PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
llvm::InitializeAllTargetInfos();
llvm::InitializeAllTargetMCs();
cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n"); cl::ParseCommandLineOptions(argc, argv, "llvm dwarf dumper\n");
// Defaults to a.out if no filenames specified. // Defaults to a.out if no filenames specified.