void visit(SgNode *astNode) { SgAsmElfSymbolSection *symsec = isSgAsmElfSymbolSection(astNode); if (symsec) { printf("Scanning symbols in [%d] \"%s\"\n", symsec->get_id(), symsec->get_name()->get_string(true).c_str()); const SgAsmElfSymbolPtrList &symbols = symsec->get_symbols()->get_symbols(); for (SgAsmElfSymbolPtrList::const_iterator i=symbols.begin(); i!=symbols.end(); ++i) { std::string name = (*i)->get_name()->get_string(); if (name.substr(0, 5)=="PMPI_") { printf(" %s\n", name.c_str()); name[0] = 'X'; (*i)->get_name()->set_string(name); } } #if 0 /* Case 3a: repack the string table to make free space contiguous in hope of being able to allocate space for the * new string without having to extend the string table. This works by removing storage for all the strings in the * table. When the string table is unparsed all its strings are reallocated in one coordinated operation. */ SgAsmElfStringSection *strsec = dynamic_cast<SgAsmElfStringSection*>(symsec->get_linked_section()); ROSE_ASSERT(strsec!=NULL); strsec->get_strtab()->free_all_strings(true); /*true means free even the unreferenced parts of the table*/ #endif } }