LLDB
mainline
llvm-project
lldb
source
Host
linux
PythonRuntimeLoaderLinux.cpp
Go to the documentation of this file.
1
//===----------------------------------------------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "lldb/Host/Config.h"
10
11
#if LLDB_ENABLE_PYTHON
12
13
#include "
../common/PythonRuntimeLoaderInternal.h
"
14
#include "llvm/ADT/STLFunctionalExtras.h"
15
16
namespace
lldb_private
{
17
18
void
ForEachPythonRuntimeCandidate
(
19
llvm::function_ref<
bool
(
const
char
*)> callback) {
20
// Bare names rely on the dynamic linker's search (LD_LIBRARY_PATH,
21
// ldconfig cache, default paths). libpython3.so usually requires a -dev
22
// package; the versioned SONAMEs cover stripped runtime installs. The
23
// 3.8 floor matches Python's Stable ABI baseline.
24
static
constexpr
const
char
*kCandidates[] = {
25
"libpython3.so"
,
"libpython3.13.so.1.0"
,
"libpython3.12.so.1.0"
,
26
"libpython3.11.so.1.0"
,
"libpython3.10.so.1.0"
,
"libpython3.9.so.1.0"
,
27
"libpython3.8.so.1.0"
,
28
};
29
for
(
const
char
*candidate : kCandidates) {
30
if
(callback(candidate))
31
return
;
32
}
33
}
34
35
}
// namespace lldb_private
36
37
#endif
// LLDB_ENABLE_PYTHON
PythonRuntimeLoaderInternal.h
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb_private::ForEachPythonRuntimeCandidate
void ForEachPythonRuntimeCandidate(llvm::function_ref< bool(const char *)> callback)
Visits candidate Python runtime paths in priority order, stopping at the first call that returns true...
Generated on
for LLDB by
1.14.0