I am compiling on-line generated source code in a loop:
std::unique_ptrcling::Interpreter gCling;
for ( … ) {
gCling.reset(new cling::Interpreter(argc, argv, “…”));
…generate source code, compile and run it…
}
Seemingly at some random iteration i end up with:
GDBRegistrationListener.cpp:177: virtual void {anonymous}::GDBJITRegistrationListener::NotifyObjectEmitted(const llvm::object::ObjectFile&, const llvm::RuntimeDyld::LoadedObjectInfo&): Assertion `ObjectBufferMap.find(Key) == ObjectBufferMap.end() && “Second attempt to perform debug registration.”’ failed.
Changed the name (although i don’t see how can that have any effect).
Is there some way to restart the interpreter (so i do not have to destruct and re-create it)?
I have tried unlink(), but i have no way to tell how many transactions need to be rolled back.
The generated code is complete source with includes, multiple functions etc so i think process() which would attempt to wrap it into a function is not going to work. I am using declare() but as far as i can tell the end result is not a single transaction, and i have not found a way to figure out the number of transactions generated (and unload() does not return any status so i cannot run it in a loop).
Currently the preamble (includes, typedefs etc) does not change between compilations, so i can try to compile the static part once, then at each iteration add functions then unload(# of functions added) – assuming function definitions add one transaction each. Would that work?