[Lldb-commits] [lldb] [lldb] Move GetEnvironment function into common code (PR #122173)
Brad Smith via lldb-commits
lldb-commits at lists.llvm.org
Thu Jan 9 06:23:20 PST 2025
https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/122173
>From d6663bdbf2a7cdf0c8289573cf9caefc15f7338f Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Wed, 8 Jan 2025 16:23:11 -0500
Subject: [PATCH] [lldb] Move GetEnvironment function into common code
---
lldb/source/Host/common/Host.cpp | 4 ++++
lldb/source/Host/freebsd/Host.cpp | 6 ------
lldb/source/Host/linux/Host.cpp | 2 --
lldb/source/Host/netbsd/HostNetBSD.cpp | 6 ------
lldb/source/Host/openbsd/Host.cpp | 6 ------
5 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 03ea2f242d3c78..7b2bae74e196fe 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -114,6 +114,10 @@ void LogChannelSystem::Initialize() {
void LogChannelSystem::Terminate() { g_system_log.Disable(); }
#if !defined(__APPLE__) && !defined(_WIN32)
+extern "C" char **environ;
+
+Environment Host::GetEnvironment() { return Environment(environ); }
+
static thread_result_t
MonitorChildProcessThreadFunction(::pid_t pid,
Host::MonitorChildProcessCallback callback);
diff --git a/lldb/source/Host/freebsd/Host.cpp b/lldb/source/Host/freebsd/Host.cpp
index 89ebe714f095f8..14c0e9f2209d24 100644
--- a/lldb/source/Host/freebsd/Host.cpp
+++ b/lldb/source/Host/freebsd/Host.cpp
@@ -33,10 +33,6 @@
#include "llvm/TargetParser/Host.h"
-extern "C" {
-extern char **environ;
-}
-
namespace lldb_private {
class ProcessLaunchInfo;
}
@@ -241,8 +237,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {
return false;
}
-Environment Host::GetEnvironment() { return Environment(environ); }
-
Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
return Status::FromErrorString("unimplemented");
}
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index f5ec2e187af196..25bef9b0e7151b 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -411,8 +411,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {
return GetProcessAndStatInfo(pid, process_info, State, tracerpid);
}
-Environment Host::GetEnvironment() { return Environment(environ); }
-
Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
return Status::FromErrorString("unimplemented");
}
diff --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp
index 49ff342fe152f6..8904df5eba03eb 100644
--- a/lldb/source/Host/netbsd/HostNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostNetBSD.cpp
@@ -35,10 +35,6 @@
#include "llvm/Object/ELF.h"
#include "llvm/TargetParser/Host.h"
-extern "C" {
-extern char **environ;
-}
-
using namespace lldb;
using namespace lldb_private;
@@ -46,8 +42,6 @@ namespace lldb_private {
class ProcessLaunchInfo;
}
-Environment Host::GetEnvironment() { return Environment(environ); }
-
static bool GetNetBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
ProcessInstanceInfo &process_info) {
if (!process_info.ProcessIDIsValid())
diff --git a/lldb/source/Host/openbsd/Host.cpp b/lldb/source/Host/openbsd/Host.cpp
index 24650ff97075ea..2b66a3c8696b10 100644
--- a/lldb/source/Host/openbsd/Host.cpp
+++ b/lldb/source/Host/openbsd/Host.cpp
@@ -30,10 +30,6 @@
#include "llvm/TargetParser/Host.h"
-extern "C" {
-extern char **environ;
-}
-
using namespace lldb;
using namespace lldb_private;
@@ -41,8 +37,6 @@ namespace lldb_private {
class ProcessLaunchInfo;
}
-Environment Host::GetEnvironment() { return Environment(environ); }
-
static bool
GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
ProcessInstanceInfo &process_info) {
More information about the lldb-commits
mailing list