[llvm-jitlink] Add -show-init-es option to dump initial ExecutionSession state.
authorLang Hames <lhames@gmail.com>
Sat, 14 Mar 2020 23:07:46 +0000 (16:07 -0700)
committerLang Hames <lhames@gmail.com>
Sat, 14 Mar 2020 23:07:46 +0000 (16:07 -0700)
Inspecting this state can be helpful when debugging jit-linking testcases.

llvm/tools/llvm-jitlink/llvm-jitlink.cpp

index 3e444e6..9058a79 100644 (file)
@@ -86,6 +86,11 @@ static cl::list<std::string> AbsoluteDefs(
     cl::desc("Inject absolute symbol definitions (syntax: <name>=<addr>)"),
     cl::ZeroOrMore);
 
+static cl::opt<bool> ShowInitialExecutionSessionState(
+    "show-init-es",
+    cl::desc("Print ExecutionSession state before resolving entry point"),
+    cl::init(false));
+
 static cl::opt<bool> ShowAddrs(
     "show-addrs",
     cl::desc("Print registered symbol, section, got and stub addresses"),
@@ -841,12 +846,14 @@ int main(int argc, char *argv[]) {
     ExitOnErr(loadProcessSymbols(*S));
   ExitOnErr(loadDylibs());
 
-
   {
     TimeRegion TR(Timers ? &Timers->LoadObjectsTimer : nullptr);
     ExitOnErr(loadObjects(*S));
   }
 
+  if (ShowInitialExecutionSessionState)
+    S->ES.dump(outs());
+
   JITEvaluatedSymbol EntryPoint = 0;
   {
     TimeRegion TR(Timers ? &Timers->LinkTimer : nullptr);