MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / CreateFromFile

Method CreateFromFile

extensions/cxx_debugging/lib/WasmModule.cc:113–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113llvm::Expected<std::unique_ptr<WasmModule>> WasmModule::CreateFromFile(
114 llvm::StringRef path) {
115 if (!llvm::sys::fs::exists(path)) {
116 return llvm::createStringError(llvm::inconvertibleErrorCode(),
117 "Module file '%s' not found\n.",
118 path.str().c_str());
119 }
120 LLVM_DEBUG(llvm::dbgs() << "Loading module from '" << path << "'\n");
121
122 auto instance = GetTarget();
123 if (!instance) {
124 return instance.takeError();
125 }
126 auto [debugger, target] = *instance;
127 auto module = target->GetOrCreateModule(
128 {lldb_private::FileSpec(path),
129 lldb_private::ArchSpec("wasm32-unknown-unknown-wasm")},
130 false);
131
132 return std::unique_ptr<WasmModule>(new WasmModule(target, module));
133}
134
135bool WasmModule::Valid() const {
136 return module_ && module_->GetNumCompileUnits() > 0;

Callers

nothing calls this directly

Calls 2

GetTargetFunction · 0.85
strMethod · 0.80

Tested by

no test coverage detected