10 strncpy(name, disk->
name, 8);
29 SgAsmPEFileHeader *fhdr = SageInterface::getEnclosingNode<SgAsmPEFileHeader>(section);
30 ROSE_ASSERT(fhdr!=NULL);
133 fprintf(stderr,
"warning: section name too long to store in PE file: \"%s\" (truncated)\n",
136 memset(disk->
name, 0,
sizeof(disk->
name));
141 memcpy(disk->
name,
p_name.c_str(), std::min( (
size_t)(
sizeof(disk->
name)), (
size_t)(
p_name.size()) ));
164 sprintf(p,
"%sPESectionTableEntry[%zd].", prefix, idx);
166 sprintf(p,
"%sPESectionTableEntry.", prefix);
171 fprintf(f,
"%s%-*s = %" PRIu64
" bytes\n", p, w,
"virtual_size",
p_virtual_size);
172 fprintf(f,
"%s%-*s = 0x%08" PRIx64
"\n", p, w,
"rva",
p_rva);
173 fprintf(f,
"%s%-*s = %" PRIu64
" bytes\n", p, w,
"physical_size",
p_physical_size);
174 fprintf(f,
"%s%-*s = %" PRIu64
" file byte offset\n", p, w,
"physical_offset",
p_physical_offset);
175 fprintf(f,
"%s%-*s = %u byte offset\n", p, w,
"coff_line_nums",
p_coff_line_nums);
176 fprintf(f,
"%s%-*s = %u\n", p, w,
"n_relocs",
p_n_relocs);
178 fprintf(f,
"%s%-*s = 0x%08x\n", p, w,
"flags",
p_flags);
186 ROSE_ASSERT(fhdr!=NULL);
201 ROSE_ASSERT(fhdr!=NULL);
209 fprintf(stderr,
"SgAsmPESectionTable::parse: warning: section table entry %zu at file offset 0x%08"PRIx64
210 " extends beyond end of defined section table.\n",
215 if (entry->
get_name() ==
".idata") {
221 pending.push_back(section);
229 ROSE_ASSERT(loader!=NULL);
231 loader->remap(loader_map, fhdr);
235 for (
size_t i=0; i<pending.size(); i++)
247 ROSE_ASSERT(section!=NULL);
253 ROSE_ASSERT(fhdr!=NULL);
256 if (section->
get_id()<0) {
259 for (
size_t i=0; i<seclist->
get_sections().size(); i++) {
265 section->
set_id(max_id+1);
278 bool reallocated =
false;
282 ROSE_ASSERT(fhdr != NULL);
285 for (
size_t i=0; i<sections.size(); i++) {
291 size_t nsections = max_id;
313 ROSE_ASSERT(fhdr != NULL);
316 for (
size_t i = 0; i < sections.size(); i++) {
317 if (sections[i]->
get_id()>=0) {
319 ROSE_ASSERT(section!=NULL);
322 ROSE_ASSERT(section->
get_id() > 0);
323 size_t slot = section->
get_id() - 1;
327 write(f, slot*
sizeof(disk),
sizeof disk, &disk);
338 sprintf(p,
"%sPESectionTable[%zd].", prefix, idx);
340 sprintf(p,
"%sPESectionTable.", prefix);