From 326bb62ea88047284ef6c0d8736a5a1b406e220b Mon Sep 17 00:00:00 2001 From: Jason Hiser <jdhiser@gmail.com> Date: Tue, 11 Sep 2018 02:00:54 +0000 Subject: [PATCH] attributes Former-commit-id: d140d13ace16fcc514c121784f576d1ab29de473 --- tools/rida/rida.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tools/rida/rida.cpp b/tools/rida/rida.cpp index 05f89af00..ca253ce7c 100644 --- a/tools/rida/rida.cpp +++ b/tools/rida/rida.cpp @@ -90,6 +90,14 @@ class CreateFunctions_t template<class T_Sym> void nameFunctions() { + // do symbol names. + parseSyms<T_Sym>(".dynsym", ".dynstr"); + parseSyms<T_Sym>(".symtab", ".strtab"); + + auto namedFunctions=0U; + auto unnamedFunctions=0U; + auto functions=0U; + // set default names for(const auto &func: sccs) { @@ -97,13 +105,23 @@ class CreateFunctions_t const auto first_range=*(func.begin()); const auto startAddr=first_range.first; const auto name=string()+"sub_"+to_string(startAddr); + functions++; if(funcNames[func]=="") // destructive test OK, next line sets if empty. + { + unnamedFunctions++; funcNames[func]=name; + } + else + { + namedFunctions++; + } + } + + cout<<"#ATTRIBUTE functions="<<dec<<functions<<endl; + cout<<"#ATTRIBUTE named_functions="<<dec<<namedFunctions<<endl; + cout<<"#ATTRIBUTE uunamed_functions="<<dec<<unnamedFunctions<<endl; - // do symbol names. - parseSyms<T_Sym>(".dynsym", ".dynstr"); - parseSyms<T_Sym>(".symtab", ".strtab"); } template<class T_Sym> @@ -307,6 +325,7 @@ class CreateFunctions_t addRange(i+6,plt_entry_size-plt_entry_size_first_part); addName(i,dynsymEntryIndex++); } + cout<<"#ATTRIBUTE plt_entries="<<dec<<dynsymEntryIndex<<endl; // deal with gotPlt Section. @@ -318,11 +337,14 @@ class CreateFunctions_t const auto gotPltEntrySize=8; const auto gotPltRangeSize=6; const auto gotPltStartAddr=gotPltSec->get_address(); + auto gotpltEntries=0U; for(auto i=0U; i + gotPltRangeSize < (size_t)gotPltSec->get_size(); i+=gotPltEntrySize) { addRange(gotPltStartAddr+i,gotPltRangeSize); + gotpltEntries++; } + cout<<"#ATTRIBUTE gotplt_entries="<<dec<<gotpltEntries<<endl; } -- GitLab