Skip to content

Commit 7a2f5a7

Browse files
committed
Implemented first part of the function info getter
1 parent e6969cb commit 7a2f5a7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/functionInfo/functionInfo.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,36 @@
1919
* CallstackLibrary, see the file LICENSE. If not, see <https://www.gnu.org/licenses/>.
2020
*/
2121

22+
#include <stdbool.h>
23+
2224
#include <callstack_internals.h>
2325
#include <functionInfo/functionInfo.h>
2426

27+
#include "../dlMapper/dlMapper.h"
28+
2529
struct functionInfo functionInfo_loadHint(const char* functionName, const char* libraryName) {
2630
struct functionInfo toReturn = (struct functionInfo) { 0, 0 };
2731

32+
dlMapper_init();
33+
bool found = false;
34+
if (libraryName != NULL) {
35+
struct loadedLibInfo* info = dlMapper_libInfoForFileName(libraryName);
36+
if (info != NULL) {
37+
if (info->associated == NULL) {
38+
info->associated = binaryFile_new(info->fileName, info->begin);
39+
}
40+
struct binaryFile* file = info->associated;
41+
if (file != NULL) {
42+
file->relocationOffset = info->relocationOffset;
43+
file->inMemory = true;
44+
found = file->getFunctionInfo(file, functionName, &toReturn);
45+
}
46+
}
47+
}
48+
if (!found) {
49+
// TODO: Search in all known binaries
50+
}
51+
2852
if (callstack_autoClearCaches) {
2953
callstack_clearCaches();
3054
}

0 commit comments

Comments
 (0)