MCPcopy Create free account
hub / github.com/GPUOpen-Tools/radeon_gpu_analyzer / Copy

Method Copy

external/celf/Src/CElf.cpp:1167–1303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1165}
1166
1167void
1168CElf::Copy(const CElf& celf)
1169{
1170 if (!celf.m_Initialized)
1171 {
1172 return;
1173 }
1174
1175 // This is a utility with below...
1176
1177 // Copy the image header to get the ones that we care about.
1178 m_Header = celf.m_Header;
1179 size_t numberSections = celf.m_Sections.size();
1180 m_Sections.resize(numberSections);
1181
1182 // Iterate over celf's sections.
1183 // Copy, but don't populate the string tables.
1184 // Copy ordinary sections.
1185 // Make a map from celf's sections to their index.
1186 map<const CElfSection*, size_t> sectionMap;
1187
1188 for (size_t i = 0; i < numberSections; ++i)
1189 {
1190 sectionMap[celf.m_Sections[i]] = i;
1191
1192 CElfSection* section;
1193
1194 switch (celf.m_Sections[i]->GetType())
1195 {
1196 case SHT_SYMTAB:
1197 m_SymbolTable = new CElfSymbolTable();
1198 section = m_SymbolTable;
1199 break;
1200
1201 case SHT_STRTAB:
1202 if (celf.m_Sections[i] == celf.m_SectionHeaderStringTable)
1203 {
1204 m_SectionHeaderStringTable = new CElfStringTable();
1205 section = m_SectionHeaderStringTable;
1206 }
1207 else
1208 {
1209 section = new CElfStringTable();
1210 }
1211
1212 break;
1213
1214 default:
1215 section = new CElfSection();
1216 const vector<char>& data = celf.m_Sections[i]->GetData();
1217 section->SetData(data);
1218 break;
1219 }
1220
1221 m_Sections[i] = section;
1222
1223 // I could just copy celf.m_Sections[i]->m_Header, but that's ugly.
1224 // Copy just the fields that are maintained through the section's lifetime.

Callers

nothing calls this directly

Calls 15

SetDataMethod · 0.80
SetNameMethod · 0.80
SetAddrAlignMethod · 0.80
GetAddrAlignMethod · 0.80
SetEntrySizeMethod · 0.80
GetEntrySizeMethod · 0.80
SetLinkSectionMethod · 0.80
GetLinkSectionMethod · 0.80
SetInfoSectionMethod · 0.80
GetInfoSectionMethod · 0.80
SymbolsBeginMethod · 0.80

Tested by

no test coverage detected