paolosevMSFT wrote: > > But currently a simple gdb-remote [:] does not enable the "wasm' plugin. Is > > there a way to detect that we are debugging WebAssembly at connect time? > > Tracing down from `platform connect <no plugin option>`, I get to > `Process::FindPlugin`, which creates a process of all the registered types > then asks that process if it can debug that target. > > Though, a lot of them just return true and you already have: > > ``` > bool ProcessWasm::CanDebug(lldb::TargetSP target_sp, > bool plugin_specified_by_name) { > ``` > > So I wonder if some other plugin is saying "yes I can debug this" before the > wasm plugin has been asked. We must register the plugins in some order but > not sure where that is done.
What happens now is that there is a `ProcessGDBRemote` that registers for `gdb-remote` and it is returned by `Process::FindPlugin`. Then there is the new `ProcessWasm` which might also register for the same `gdb-remote` maybe. But the problem is that at the moment when we start the connection we do not know that we are connecting to a Wasm target. Here, with the following call stack, `target_sp->m_arch` is still not initialized: ``` > > liblldb.dll!lldb_private::process_gdb_remote::ProcessGDBRemote::CreateInstance(std::shared_ptr<lldb_private::Target> > target_sp, std::shared_ptr<lldb_private::Listener> listener_sp, const > lldb_private::FileSpec * crash_file_path, bool can_connect) Line 201 C++ liblldb.dll!lldb_private::Process::FindPlugin(std::shared_ptr<lldb_private::Target> target_sp, llvm::StringRef plugin_name, std::shared_ptr<lldb_private::Listener> listener_sp, const lldb_private::FileSpec * crash_file_path, bool can_connect) Line 382 C++ liblldb.dll!lldb_private::Target::CreateProcess(std::shared_ptr<lldb_private::Listener> listener_sp, llvm::StringRef plugin_name, const lldb_private::FileSpec * crash_file, bool can_connect) Line 215 C++ liblldb.dll!lldb_private::Platform::DoConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, lldb_private::Debugger & debugger, lldb_private::Stream * stream, lldb_private::Target * target, lldb_private::Status & error) Line 1948 C++ ``` This is why I introduced a new command `wasm`. https://github.com/llvm/llvm-project/pull/77949 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits