[Lldb-commits] [lldb] [lldb] Support building lldbHost under Emscripten (PR #223206)
Anutosh Bhat via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 15 23:58:42 PDT 2026
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/223206
>From 85fb29805254a659245e909b8b488b5a06b4b963 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Sun, 13 Sep 2026 10:42:26 +0530
Subject: [PATCH] [lldb] Support building lldbHost under Emscripten
---
lldb/source/Host/CMakeLists.txt | 8 +++++++-
lldb/source/Host/common/Host.cpp | 6 +++---
lldb/source/Host/emscripten/Host.cpp | 29 ++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 4 deletions(-)
create mode 100644 lldb/source/Host/emscripten/Host.cpp
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index ef99c79deab82..45821aa410912 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -111,10 +111,15 @@ else()
posix/LockFilePosix.cpp
posix/MainLoopPosix.cpp
posix/PipePosix.cpp
- posix/ProcessLauncherPosixFork.cpp
posix/Support.cpp
)
+ if (NOT EMSCRIPTEN)
+ add_host_subdirectory(posix
+ posix/ProcessLauncherPosixFork.cpp
+ )
+ endif()
+
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_subdirectory(macosx/objcxx)
set(LLDBObjCLibs lldbHostMacOSXObjCXX)
@@ -137,6 +142,7 @@ else()
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
add_host_subdirectory(emscripten
+ emscripten/Host.cpp
emscripten/HostInfoEmscripten.cpp
)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index c4e1500fe68ab..fdf17db53ec3e 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -67,7 +67,7 @@
#if defined(_WIN32)
#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
#include "lldb/Host/windows/ProcessLauncherWindows.h"
-#else
+#elif !defined(__EMSCRIPTEN__)
#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
#endif
@@ -581,7 +581,7 @@ Status Host::RunShellCommand(llvm::StringRef shell_path, const Args &args,
// The functions below implement process launching for non-Apple-based
// platforms
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) {
std::unique_ptr<ProcessLauncher> delegate_launcher;
#if defined(_WIN32)
@@ -600,7 +600,7 @@ Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) {
return error;
}
-#endif // !defined(__APPLE__)
+#endif // !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#ifndef _WIN32
void Host::Kill(lldb::pid_t pid, int signo) { ::kill(pid, signo); }
diff --git a/lldb/source/Host/emscripten/Host.cpp b/lldb/source/Host/emscripten/Host.cpp
new file mode 100644
index 0000000000000..005a2f83f4ec7
--- /dev/null
+++ b/lldb/source/Host/emscripten/Host.cpp
@@ -0,0 +1,29 @@
+//===-- Host.cpp ---------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Host/Host.h"
+#include "lldb/Utility/Status.h"
+
+using namespace lldb_private;
+
+uint32_t Host::FindProcessesImpl(const ProcessInstanceInfoMatch &,
+ ProcessInstanceInfoList &) {
+ return 0;
+}
+
+bool Host::GetProcessInfo(lldb::pid_t, ProcessInstanceInfo &) { return false; }
+
+Status Host::LaunchProcess(ProcessLaunchInfo &) {
+ return Status::FromErrorString(
+ "launching a host process is not supported under Emscripten");
+}
+
+Status Host::ShellExpandArguments(ProcessLaunchInfo &) {
+ return Status::FromErrorString(
+ "shell expansion is not supported under Emscripten");
+}
More information about the lldb-commits
mailing list