|
|
|||
File indexing completed on 2026-05-10 08:43:52
0001 //===------ DylibManager.h - Manage dylibs in the executor ------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // APIs for managing real (non-JIT) dylibs in the executing process. 0010 // 0011 //===----------------------------------------------------------------------===// 0012 0013 #ifndef LLVM_EXECUTIONENGINE_ORC_DYLIBMANAGER_H 0014 #define LLVM_EXECUTIONENGINE_ORC_DYLIBMANAGER_H 0015 0016 #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h" 0017 #include "llvm/Support/Error.h" 0018 #include "llvm/Support/MSVCErrorWorkarounds.h" 0019 0020 #include <future> 0021 #include <mutex> 0022 #include <vector> 0023 0024 namespace llvm::orc { 0025 0026 class SymbolLookupSet; 0027 0028 class DylibManager { 0029 public: 0030 /// A pair of a dylib and a set of symbols to be looked up. 0031 struct LookupRequest { 0032 LookupRequest(tpctypes::DylibHandle Handle, const SymbolLookupSet &Symbols) 0033 : Handle(Handle), Symbols(Symbols) {} 0034 tpctypes::DylibHandle Handle; 0035 const SymbolLookupSet &Symbols; 0036 }; 0037 0038 virtual ~DylibManager(); 0039 0040 /// Load the dynamic library at the given path and return a handle to it. 0041 /// If LibraryPath is null this function will return the global handle for 0042 /// the target process. 0043 virtual Expected<tpctypes::DylibHandle> loadDylib(const char *DylibPath) = 0; 0044 0045 /// Search for symbols in the target process. 0046 /// 0047 /// The result of the lookup is a 2-dimensional array of target addresses 0048 /// that correspond to the lookup order. If a required symbol is not 0049 /// found then this method will return an error. If a weakly referenced 0050 /// symbol is not found then it be assigned a '0' value. 0051 Expected<std::vector<tpctypes::LookupResult>> 0052 lookupSymbols(ArrayRef<LookupRequest> Request) { 0053 std::promise<MSVCPExpected<std::vector<tpctypes::LookupResult>>> RP; 0054 auto RF = RP.get_future(); 0055 lookupSymbolsAsync(Request, 0056 [&RP](auto Result) { RP.set_value(std::move(Result)); }); 0057 return RF.get(); 0058 } 0059 0060 using SymbolLookupCompleteFn = 0061 unique_function<void(Expected<std::vector<tpctypes::LookupResult>>)>; 0062 0063 /// Search for symbols in the target process. 0064 /// 0065 /// The result of the lookup is a 2-dimensional array of target addresses 0066 /// that correspond to the lookup order. If a required symbol is not 0067 /// found then this method will return an error. If a weakly referenced 0068 /// symbol is not found then it be assigned a '0' value. 0069 virtual void lookupSymbolsAsync(ArrayRef<LookupRequest> Request, 0070 SymbolLookupCompleteFn F) = 0; 0071 }; 0072 0073 } // end namespace llvm::orc 0074 0075 #endif // LLVM_EXECUTIONENGINE_ORC_DYLIBMANAGER_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|