[PATCH] Add parser for the stackmap section format

Swaroop Sridhar Swaroop.Sridhar at microsoft.com
Wed Jun 10 18:13:27 PDT 2015


For StackMapSection::dump(), my suggestion is to follow the other dumper routines and send the output to dbgs(), instead of using printfs.

void StackMapSection::dump() const { print(dbgs()); }

void StackMapSection::print(raw_ostream &OS) const
{

  OS << "Functions (" << static_cast<int>(FnSizeRecords.size()) << ") [\n";
  for (uint16_t j = 0; j < FnSizeRecords.size(); j++) {
    OS << "  addr = " << static_cast<unsigned>(FnSizeRecords[j].FunctionAddr);
    OS << ", size = " << static_cast<unsigned>(FnSizeRecords[j].StackSize);
    OS << "\n";
  }
  OS << "]\n";
  
  OS << "Constants (" << static_cast<int>(Constants.size()) << ") [\n";
  for (uint16_t j = 0; j < Constants.size(); j++) {
    OS << "  value = " << static_cast<unsigned>(Constants[j]);
  }
  OS << "]\n";
  
  OS << "Records (" << static_cast<int>(Records.size()) << ") [\n";
  for (unsigned i = 0; i < Records.size(); i++) {
    const StackMapRecord& Rec = Records[i];
    OS << "  id = " << Rec.PatchPointID;
    OS << ", offset" << Rec.InstructionOffset;
    OS << ", flags=" << Rec.ReservedFlags;
    OS << "\n";
  
    OS << "  Locations (" << static_cast<int>(Rec.Locations.size()) << ") [\n";
    for (uint16_t j = 0; j < Rec.Locations.size(); j++) {
      const LocationRecord& Loc = Rec.Locations[j];
      OS << "    type = " << locationTypeToString(Loc.Type);
      OS << ", size = " << (size_t)Loc.SizeInBytes;
      OS << ", dwarfreg = " << Loc.DwarfRegNum;
      OS << ", offset = " << Loc.Offset;
      OS << "\n";
    }
    OS << "  ]\n";
  }
  OS << "]\n";

}


http://reviews.llvm.org/D10377

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list