# HG changeset patch # User Alexis Jeandet # Date 2015-04-16 18:00:21 # Node ID 1f143e4ae72a0bb4832b546eb76eb50e94049b80 # Parent cc958c79ba0939809a70e63b8bac798930160243 Added int ElfFile::getSymbolIndex(const QString &name) diff --git a/elf/elffile.cpp b/elf/elffile.cpp --- a/elf/elffile.cpp +++ b/elf/elffile.cpp @@ -1009,6 +1009,21 @@ quint64 ElfFile::getSymbolSize(int index return 0; } +int ElfFile::getSymbolIndex(const QString &name) +{ + if(this->e!=NULL) + { + for(int i=0;isymbols.count();i++) + { + if(this->symbols.at(i)->name==name) + { + return i; + } + } + } + return -1; +} + QString ElfFile::getSymbolSectionName(int index) { if(this->e!=NULL) diff --git a/elf/elffile.h b/elf/elffile.h --- a/elf/elffile.h +++ b/elf/elffile.h @@ -105,6 +105,7 @@ public: QString getSymbolName(int index); QString getSymbolType(int index); quint64 getSymbolSize(int index); + int getSymbolIndex(const QString& name); QString getSymbolSectionName(int index); int getSymbolSectionIndex(int index); quint64 getSymbolAddress(int index);