Skip to content

Commit

Permalink
1. Support standard dwarf format (was bootstrapping in Apple format.)
Browse files Browse the repository at this point in the history
2. Add vector support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28807 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
JimLaskey committed Jun 15, 2006
1 parent d5a932b commit f8a01a9
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 20 deletions.
7 changes: 6 additions & 1 deletion docs/SourceLevelDebugging.html
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@
uint, ;; Size in bits
uint, ;; Alignment in bits
uint, ;; Offset in bits
bool, ;; Is vector flag
{ }* ;; Reference to array of member descriptors
}
</pre>
Expand All @@ -590,6 +591,8 @@
DW_TAG_union_type = 23
</pre>

<p>The vector flag indicates that an array type is a native packed vector.</p>

<p>The members of array types (tag = <tt>DW_TAG_array_type</tt>) are <a
href="#format_subrange">subrange descriptors</a>, each representing the range of
subscripts at that level of indexing.</p>
Expand Down Expand Up @@ -1600,7 +1603,8 @@
uint 96,
uint 32,
uint 0,
{ }* null,
{ }* null,
bool false,
{ }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata"
%str2 = internal constant [6 x sbyte] c"Color\00", section "llvm.metadata"

Expand Down Expand Up @@ -1693,6 +1697,7 @@
uint 32,
uint 0,
{ }* null,
bool false,
{ }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata"
%str1 = internal constant [6 x sbyte] c"Trees\00", section "llvm.metadata"

Expand Down
5 changes: 4 additions & 1 deletion include/llvm/CodeGen/MachineDebugInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class StructType;
// Debug info constants.

enum {
LLVMDebugVersion = 3 // Current version of debug information.
LLVMDebugVersion = 4 // Current version of debug information.
};

//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -400,13 +400,16 @@ class DerivedTypeDesc : public TypeDesc {
/// array/struct types (eg., arrays, struct, union, enums.)
class CompositeTypeDesc : public DerivedTypeDesc {
private:
bool IsVector; // packed/vector array
std::vector<DebugInfoDesc *> Elements;// Information used to compose type.

public:
CompositeTypeDesc(unsigned T);

// Accessors
bool isVector() const { return IsVector; }
std::vector<DebugInfoDesc *> &getElements() { return Elements; }
void setIsVector() { IsVector = true; }

// Implement isa/cast/dyncast.
static bool classof(const CompositeTypeDesc *) { return true; }
Expand Down
13 changes: 10 additions & 3 deletions include/llvm/Support/Dwarf.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ enum llvm_dwarf_constants {
DW_TAG_arg_variable = 0x101, // Tag for argument variables.
DW_TAG_return_variable = 0x102, // Tag for return variables.

DW_TAG_user_base = 0x1000, // Recommended base for user tags.
DW_TAG_user_base = 0x1000, // Recommended base for user tags.

DW_CIE_VERSION = 1, // Common frame information version.
DW_CIE_ID = 0xffffffff // Common frame information mark.
DW_CIE_VERSION = 1, // Common frame information version.
DW_CIE_ID = 0xffffffff // Common frame information mark.
};

enum dwarf_constants {
Expand Down Expand Up @@ -198,6 +198,13 @@ enum dwarf_constants {
DW_AT_elemental = 0x66,
DW_AT_pure = 0x67,
DW_AT_recursive = 0x68,
DW_AT_sf_names = 0x2101,
DW_AT_src_info = 0x2102,
DW_AT_mac_info = 0x2103,
DW_AT_src_coords = 0x2104,
DW_AT_body_begin = 0x2105,
DW_AT_body_end = 0x2106,
DW_AT_GNU_vector = 0x2107,
DW_AT_lo_user = 0x2000,
DW_AT_hi_user = 0x3fff,

Expand Down
16 changes: 12 additions & 4 deletions lib/CodeGen/DwarfWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc, CompileUnit *Unit) {
// Fundamental types like int, float, bool
Slot = Ty = new DIE(DW_TAG_base_type);
unsigned Encoding = BasicTy->getEncoding();
Ty->AddUInt (DW_AT_encoding, DW_FORM_data1, Encoding);
Ty->AddUInt(DW_AT_encoding, DW_FORM_data1, Encoding);
} else if (DerivedTypeDesc *DerivedTy = dyn_cast<DerivedTypeDesc>(TyDesc)) {
// Create specific DIE.
Slot = Ty = new DIE(DerivedTy->getTag());
Expand All @@ -1287,6 +1287,12 @@ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc, CompileUnit *Unit) {
Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4,
NewType(Context, FromTy, Unit));
}

// check for vector type
if (CompTy->isVector()) {
Ty->AddUInt(DW_AT_GNU_vector, DW_FORM_flag, 1);
}

// Don't emit size attribute.
Size = 0;

Expand Down Expand Up @@ -1419,7 +1425,8 @@ CompileUnit *DwarfWriter::NewCompileUnit(CompileUnitDesc *UnitDesc,
unsigned ID) {
// Construct debug information entry.
DIE *Die = new DIE(DW_TAG_compile_unit);
Die->AddLabel (DW_AT_stmt_list, DW_FORM_data4, DWLabel("line", 0));
Die->AddDelta (DW_AT_stmt_list, DW_FORM_data4, DWLabel("line", 0),
DWLabel("section_line", 0));
Die->AddLabel (DW_AT_high_pc, DW_FORM_addr, DWLabel("text_end", 0));
Die->AddLabel (DW_AT_low_pc, DW_FORM_addr, DWLabel("text_begin", 0));
Die->AddString(DW_AT_producer, DW_FORM_string, UnitDesc->getProducer());
Expand Down Expand Up @@ -1842,7 +1849,7 @@ void DwarfWriter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
int stackGrowth =
Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
TargetFrameInfo::StackGrowsUp ?
AddressSize : -AddressSize;
AddressSize : -AddressSize;

EmitULEB128Bytes(Src.getOffset() / stackGrowth);
EOL("Offset");
Expand Down Expand Up @@ -1875,7 +1882,8 @@ void DwarfWriter::EmitDebugInfo() const {

EmitInt32(ContentSize); EOL("Length of Compilation Unit Info");
EmitInt16(DWARF_VERSION); EOL("DWARF version number");
EmitReference("abbrev_begin", 0); EOL("Offset Into Abbrev. Section");
EmitDifference("abbrev_begin", 0, "section_abbrev", 0);
EOL("Offset Into Abbrev. Section");
EmitInt8(AddressSize); EOL("Address Size (in bytes)");

EmitDIE(Die);
Expand Down
2 changes: 2 additions & 0 deletions lib/CodeGen/MachineDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ void DerivedTypeDesc::dump() {

CompositeTypeDesc::CompositeTypeDesc(unsigned T)
: DerivedTypeDesc(T)
, IsVector(false)
, Elements()
{}

Expand All @@ -839,6 +840,7 @@ bool CompositeTypeDesc::classof(const DebugInfoDesc *D) {
void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) {
DerivedTypeDesc::ApplyToFields(Visitor);

Visitor->Apply(IsVector);
Visitor->Apply(Elements);
}

Expand Down
7 changes: 7 additions & 0 deletions lib/Support/Dwarf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ const char *AttributeString(unsigned Attribute) {
case DW_AT_elemental: return "AT_elemental";
case DW_AT_pure: return "AT_pure";
case DW_AT_recursive: return "AT_recursive";
case DW_AT_sf_names: return "AT_sf_names";
case DW_AT_src_info: return "AT_src_info";
case DW_AT_mac_info: return "AT_mac_info";
case DW_AT_src_coords: return "AT_src_coords";
case DW_AT_body_begin: return "AT_body_begin";
case DW_AT_body_end: return "AT_body_end";
case DW_AT_GNU_vector: return "AT_GNU_vector";
case DW_AT_lo_user: return "AT_lo_user";
case DW_AT_hi_user: return "AT_hi_user";
}
Expand Down
22 changes: 11 additions & 11 deletions lib/Target/PowerPC/PPCAsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,17 @@ namespace {
: DwarfWriter(o, ap)
{
needsSet = true;
DwarfAbbrevSection = ".section __DWARFA,__debug_abbrev";
DwarfInfoSection = ".section __DWARFA,__debug_info";
DwarfLineSection = ".section __DWARFA,__debug_line";
DwarfFrameSection = ".section __DWARFA,__debug_frame";
DwarfPubNamesSection = ".section __DWARFA,__debug_pubnames";
DwarfPubTypesSection = ".section __DWARFA,__debug_pubtypes";
DwarfStrSection = ".section __DWARFA,__debug_str";
DwarfLocSection = ".section __DWARFA,__debug_loc";
DwarfARangesSection = ".section __DWARFA,__debug_aranges";
DwarfRangesSection = ".section __DWARFA,__debug_ranges";
DwarfMacInfoSection = ".section __DWARFA,__debug_macinfo";
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev";
DwarfInfoSection = ".section __DWARF,__debug_info";
DwarfLineSection = ".section __DWARF,__debug_line";
DwarfFrameSection = ".section __DWARF,__debug_frame";
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames";
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes";
DwarfStrSection = ".section __DWARF,__debug_str";
DwarfLocSection = ".section __DWARF,__debug_loc";
DwarfARangesSection = ".section __DWARF,__debug_aranges";
DwarfRangesSection = ".section __DWARF,__debug_ranges";
DwarfMacInfoSection = ".section __DWARF,__debug_macinfo";
TextSection = ".text";
DataSection = ".data";
}
Expand Down

0 comments on commit f8a01a9

Please sign in to comment.