Skip to content

Conversation

SahilPatidar
Copy link
Contributor

This patch adds the new executor-side resolver API as suggested by @lhames. It introduces a DylibSymbolResolver that helps resolve symbols for each loaded dylib.

Previously, we returned a DylibHandle to the controller. Now, we wrap the native handle inside DylibSymbolResolver and return a ResolverHandle instead. This makes the code cleaner and separates the symbol resolution logic from raw handle management.

Copy link

github-actions bot commented Jun 11, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@vgvassilev vgvassilev requested a review from lhames June 12, 2025 06:45
@SahilPatidar SahilPatidar marked this pull request as ready for review June 16, 2025 06:38
Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lhames, this looks reasonable to me. I'd like move forward with these changes. Can you take a look?

ExecutorAddr Lookup;
ExecutorAddr Resolve;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Lookup still used after this patch? I'm not opposed to replacing raw dylib handles with Resolver objects (as long as it doesn't change the dylib lifetimes, which I don't think it does), but if we are doing that then we can drop Lookup entirely and clean up the lookup wrappers and implementations in the target process library.

@SahilPatidar
Copy link
Contributor Author

SahilPatidar commented Aug 23, 2025

Previously, we were returning an error for a required symbol in SelfExecutorProcessControl::lookup. Now, instead of returning an error, we return an optional and added an assertion in EPCDebugObjectRegistrar.cpp — I believe that’s why the assertion was triggered.

As you can see below, the error is being silently consumed:

  JITBuilder->setPrePlatformSetup([](llvm::orc::LLJIT &J) {
    // Try to enable debugging of JIT'd code (only works with JITLink for
    // ELF and MachO).
    consumeError(llvm::orc::enableDebuggerSupport(J));
    return llvm::Error::success();
  });

The comment here shows that debugger support is only implemented for ELF and Mach-O. That explains why the assertion fails on Windows: no valid address is returned in this case.

Instead of asserting, we could return an error when the optional has no valid address or put a check here.
For now, I tried returning an error on lookup failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants