https://github.com/brad0 created 
https://github.com/llvm/llvm-project/pull/122173

None

>From 43784f2bb5f4755f9cf1e63738ad4c566c7d3044 Mon Sep 17 00:00:00 2001
From: Brad Smith <b...@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       | 6 ++++++
 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, 6 insertions(+), 20 deletions(-)

diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 03ea2f242d3c78..01749f4919de56 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -114,6 +114,12 @@ void LogChannelSystem::Initialize() {
 void LogChannelSystem::Terminate() { g_system_log.Disable(); }
 
 #if !defined(__APPLE__) && !defined(_WIN32)
+extern "C" {
+extern 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) {

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to