Exemple #1
0
void DIEItem::FormatDIType(wxTextOutputStream& out, DIType type) const {
  if (type.isCompositeType()) {
    DICompositeType diCompType(type);
    if (!type.getName().empty()) {
      out << toWxStr(type.getName());
    } else {
      out << _("?Implement unnamed composite");
      // TODO: Implement:
      // DW_TAG_array_type
      // DW_TAG_enumeration_type
      // DW_TAG_structure_type
      // DW_TAG_union_type
      // DW_TAG_vector_type
      // DW_TAG_subroutine_type
      // DW_TAG_inheritance
    }
  } else if (type.isDerivedType()) {
    DIDerivedType diDerivedType(type);
    DIType diBase = diDerivedType.getTypeDerivedFrom();
    switch (diDerivedType.getTag()) {
      case dwarf::DW_TAG_inheritance:
        FormatDIType(out, diBase);
        break;

      case dwarf::DW_TAG_pointer_type:
        FormatDIType(out, diBase);
        out << _("*");
        break;

      case dwarf::DW_TAG_array_type:
        FormatDIType(out, diBase);
        // TODO: Get the array size, use LLVM array notation.
        out << _("[]");
        break;

      case dwarf::DW_TAG_member:
        out << toWxStr(diDerivedType.getName());
        break;

      case dwarf::DW_TAG_reference_type:
      case dwarf::DW_TAG_const_type:
      case dwarf::DW_TAG_volatile_type:
      case dwarf::DW_TAG_restrict_type:
      case dwarf::DW_TAG_typedef:
        // TODO: Implement
        break;
    }
  } else if (type.isBasicType()) {
    DIBasicType diBasicType(type);
    const char * encodingName =
        dwarf::AttributeEncodingString(diBasicType.getEncoding());
    if (encodingName != NULL) {
      out << toWxStr(encodingName);
    }
  }
}
/// PopulateDebugInfo - Populate the TypeNo, Aux[] and TagName from Ty.
///
void PIC16DbgInfo::PopulateDebugInfo (DIType Ty, unsigned short &TypeNo,
                                      bool &HasAux, int Aux[], 
                                      std::string &TagName) {
  if (Ty.isBasicType(Ty.getTag())) 
    PopulateBasicTypeInfo (Ty, TypeNo);
  else if (Ty.isDerivedType(Ty.getTag())) 
    PopulateDerivedTypeInfo (Ty, TypeNo, HasAux, Aux, TagName);
  else if (Ty.isCompositeType(Ty.getTag())) 
    PopulateCompositeTypeInfo (Ty, TypeNo, HasAux, Aux, TagName);
  else {
    TypeNo = PIC16Dbg::T_NULL;
    HasAux = false;
  }
  return;
}