Skip to content

Commit cb04bc0

Browse files
authored
[lldb] Move GetEnvironment function into common code (#122173)
1 parent c57810a commit cb04bc0

File tree

5 files changed

+4
-20
lines changed

5 files changed

+4
-20
lines changed

lldb/source/Host/common/Host.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ void LogChannelSystem::Initialize() {
114114
void LogChannelSystem::Terminate() { g_system_log.Disable(); }
115115

116116
#if !defined(__APPLE__) && !defined(_WIN32)
117+
extern "C" char **environ;
118+
119+
Environment Host::GetEnvironment() { return Environment(environ); }
120+
117121
static thread_result_t
118122
MonitorChildProcessThreadFunction(::pid_t pid,
119123
Host::MonitorChildProcessCallback callback);

lldb/source/Host/freebsd/Host.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333

3434
#include "llvm/TargetParser/Host.h"
3535

36-
extern "C" {
37-
extern char **environ;
38-
}
39-
4036
namespace lldb_private {
4137
class ProcessLaunchInfo;
4238
}
@@ -241,8 +237,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {
241237
return false;
242238
}
243239

244-
Environment Host::GetEnvironment() { return Environment(environ); }
245-
246240
Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
247241
return Status::FromErrorString("unimplemented");
248242
}

lldb/source/Host/linux/Host.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,6 @@ bool Host::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) {
411411
return GetProcessAndStatInfo(pid, process_info, State, tracerpid);
412412
}
413413

414-
Environment Host::GetEnvironment() { return Environment(environ); }
415-
416414
Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
417415
return Status::FromErrorString("unimplemented");
418416
}

lldb/source/Host/netbsd/HostNetBSD.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,13 @@
3535
#include "llvm/Object/ELF.h"
3636
#include "llvm/TargetParser/Host.h"
3737

38-
extern "C" {
39-
extern char **environ;
40-
}
41-
4238
using namespace lldb;
4339
using namespace lldb_private;
4440

4541
namespace lldb_private {
4642
class ProcessLaunchInfo;
4743
}
4844

49-
Environment Host::GetEnvironment() { return Environment(environ); }
50-
5145
static bool GetNetBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
5246
ProcessInstanceInfo &process_info) {
5347
if (!process_info.ProcessIDIsValid())

lldb/source/Host/openbsd/Host.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,13 @@
3030

3131
#include "llvm/TargetParser/Host.h"
3232

33-
extern "C" {
34-
extern char **environ;
35-
}
36-
3733
using namespace lldb;
3834
using namespace lldb_private;
3935

4036
namespace lldb_private {
4137
class ProcessLaunchInfo;
4238
}
4339

44-
Environment Host::GetEnvironment() { return Environment(environ); }
45-
4640
static bool
4741
GetOpenBSDProcessArgs(const ProcessInstanceInfoMatch *match_info_ptr,
4842
ProcessInstanceInfo &process_info) {

0 commit comments

Comments
 (0)