From 0a816767085d68ec8e47dea84cbcb399ff80f2b5 Mon Sep 17 00:00:00 2001 From: Martell Malone Date: Mon, 23 Feb 2015 13:53:35 +0000 Subject: [PATCH] Hack around missing functions --- lib/Interpreter/IncrementalExecutor.cpp | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/lib/Interpreter/IncrementalExecutor.cpp b/lib/Interpreter/IncrementalExecutor.cpp index 2d7839d..dd2170f 100644 --- a/lib/Interpreter/IncrementalExecutor.cpp +++ b/lib/Interpreter/IncrementalExecutor.cpp @@ -203,6 +203,47 @@ IncrementalExecutor::NotifyLazyFunctionCreators(const std::string& mangled_name) return ret; } + FILE *pF = fopen("cling_func.map", "r"); + void *pAddr = NULL; + fflush(stdout); + while (pF) + { + char sz[512]; + if (!fgets(sz, sizeof(sz), pF)) + break; + + char *p = strrchr(sz, ' '); + if (!p) + continue; + + p++; + + char *p2 = strchr(sz, '\r'); + if (p2) + p2[0] = 0; + p2 = strchr(sz, '\n'); + if (p2) + p2[0] = 0; + + if (strcmp(p, mangled_name.c_str())) + { + if (p[0] != '_' || strcmp(p + 1, mangled_name.c_str())) + continue; + } + + sscanf(sz, "%x", &pAddr); + break; + } + + if (pF) + fclose(pF); + + if (pAddr) + { + fflush(stdout); + return pAddr; + } + return HandleMissingFunction(mangled_name); } -- 2.3.0