@@ -49,9 +49,11 @@ void elfFile_create(struct elfFile* self) {
4949 self -> _ .type = ELF_FILE ;
5050 self -> _ .concrete = self ;
5151
52- self -> _ .addr2String = & elfFile_addr2String ;
53- self -> _ .destroy = & elfFile_destroy ;
54- self -> _ .deleter = & elfFile_delete ;
52+ self -> _ .getFunctionInfo = & elfFile_getFunctionInfo ;
53+ self -> _ .addr2String = & elfFile_addr2String ;
54+ self -> _ .destroy = & elfFile_destroy ;
55+ self -> _ .deleter = & elfFile_delete ;
56+
5557 lcs_section_create (& self -> debugLine );
5658 lcs_section_create (& self -> debugLineStr );
5759 lcs_section_create (& self -> debugStr );
@@ -363,6 +365,25 @@ static inline optional_debugInfo_t elfFile_getDebugInfo(struct elfFile* self, vo
363365 return toReturn ;
364366}
365367
368+ bool elfFile_getFunctionInfo (struct binaryFile * me , const char * functionName , struct functionInfo * info ) {
369+ struct elfFile * self = elfFileOrNull (me );
370+ if (self == NULL ) return false;
371+
372+ if (!me -> parsed &&
373+ !(me -> parsed = elfFile_loadFile (self ))) {
374+ return false;
375+ }
376+
377+ vector_iterate (struct function , & self -> functions , {
378+ if (strcmp (element -> linkedName , functionName ) == 0 ) {
379+ info -> begin = (uintptr_t ) element -> startAddress ;
380+ info -> length = element -> length ;
381+ return true;
382+ }
383+ })
384+ return false;
385+ }
386+
366387bool elfFile_addr2String (struct binaryFile * me , void * address , struct callstack_frame * frame ) {
367388 struct elfFile * self = elfFileOrNull (me );
368389 if (self == NULL ) return false;
0 commit comments