From da59eff7c0e13a648c18239f864ed1a4f5129aae Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sat, 14 Mar 2020 16:07:46 -0700 Subject: [PATCH] [llvm-jitlink] Add -show-init-es option to dump initial ExecutionSession state. Inspecting this state can be helpful when debugging jit-linking testcases. --- tools/llvm-jitlink/llvm-jitlink.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/llvm-jitlink/llvm-jitlink.cpp b/tools/llvm-jitlink/llvm-jitlink.cpp index 3e444e609de..9058a7907b0 100644 --- a/tools/llvm-jitlink/llvm-jitlink.cpp +++ b/tools/llvm-jitlink/llvm-jitlink.cpp @@ -86,6 +86,11 @@ static cl::list AbsoluteDefs( cl::desc("Inject absolute symbol definitions (syntax: =)"), cl::ZeroOrMore); +static cl::opt ShowInitialExecutionSessionState( + "show-init-es", + cl::desc("Print ExecutionSession state before resolving entry point"), + cl::init(false)); + static cl::opt 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);