-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[lldb][AIX] Taking Linux Host Info header's base for AIX #106910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DhruvSrivastavaX
wants to merge
2
commits into
llvm:main
Choose a base branch
from
DhruvSrivastavaX:aix-lldb-host
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//===-- AbstractSocket.h ----------------------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef liblldb_AbstractSocket_h_ | ||
#define liblldb_AbstractSocket_h_ | ||
|
||
#include "lldb/Host/posix/DomainSocket.h" | ||
|
||
namespace lldb_private { | ||
class AbstractSocket : public DomainSocket { | ||
public: | ||
AbstractSocket(bool child_processes_inherit); | ||
|
||
protected: | ||
size_t GetNameOffset() const override; | ||
void DeleteSocketFile(llvm::StringRef name) override; | ||
}; | ||
} // namespace lldb_private | ||
|
||
#endif // ifndef liblldb_AbstractSocket_h_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Host.h --------------------------------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_HOST_LINUX_HOST_H | ||
#define LLDB_HOST_LINUX_HOST_H | ||
|
||
#include "lldb/lldb-types.h" | ||
#include <optional> | ||
|
||
namespace lldb_private { | ||
|
||
// Get PID (i.e. the primary thread ID) corresponding to the specified TID. | ||
std::optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid); | ||
|
||
} // namespace lldb_private | ||
|
||
#endif // #ifndef LLDB_HOST_LINUX_HOST_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===-- HostInfoLinux.h -----------------------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
DhruvSrivastavaX marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef lldb_Host_linux_HostInfoLinux_h_ | ||
#define lldb_Host_linux_HostInfoLinux_h_ | ||
|
||
#include "lldb/Host/posix/HostInfoPosix.h" | ||
#include "lldb/Utility/FileSpec.h" | ||
#include "llvm/ADT/StringRef.h" | ||
#include "llvm/Support/VersionTuple.h" | ||
|
||
#include <optional> | ||
#include <string> | ||
|
||
namespace lldb_private { | ||
|
||
class HostInfoLinux : public HostInfoPosix { | ||
friend class HostInfoBase; | ||
|
||
public: | ||
static void Initialize(SharedLibraryDirectoryHelper *helper = nullptr); | ||
static void Terminate(); | ||
|
||
static llvm::VersionTuple GetOSVersion(); | ||
static std::optional<std::string> GetOSBuildString(); | ||
static llvm::StringRef GetDistributionId(); | ||
static FileSpec GetProgramFileSpec(); | ||
|
||
protected: | ||
static bool ComputeSupportExeDirectory(FileSpec &file_spec); | ||
static bool ComputeSystemPluginsDirectory(FileSpec &file_spec); | ||
static bool ComputeUserPluginsDirectory(FileSpec &file_spec); | ||
static void ComputeHostArchitectureSupport(ArchSpec &arch_32, | ||
ArchSpec &arch_64); | ||
}; | ||
} // namespace lldb_private | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//===-- Ptrace.h ------------------------------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// This file defines ptrace functions & structures | ||
|
||
#ifndef liblldb_Host_linux_Ptrace_h_ | ||
#define liblldb_Host_linux_Ptrace_h_ | ||
|
||
#include <sys/ptrace.h> | ||
|
||
DhruvSrivastavaX marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#ifndef __GLIBC__ | ||
typedef int __ptrace_request; | ||
#endif | ||
|
||
#define DEBUG_PTRACE_MAXBYTES 20 | ||
|
||
// Support ptrace extensions even when compiled without required kernel support | ||
#ifndef PTRACE_GETREGS | ||
#define PTRACE_GETREGS 12 | ||
#endif | ||
#ifndef PTRACE_SETREGS | ||
#define PTRACE_SETREGS 13 | ||
#endif | ||
#ifndef PTRACE_GETFPREGS | ||
#define PTRACE_GETFPREGS 14 | ||
#endif | ||
#ifndef PTRACE_SETFPREGS | ||
#define PTRACE_SETFPREGS 15 | ||
#endif | ||
#ifndef PTRACE_GETREGSET | ||
#define PTRACE_GETREGSET 0x4204 | ||
#endif | ||
#ifndef PTRACE_SETREGSET | ||
#define PTRACE_SETREGSET 0x4205 | ||
#endif | ||
#ifndef PTRACE_GET_THREAD_AREA | ||
#define PTRACE_GET_THREAD_AREA 25 | ||
#endif | ||
#ifndef PTRACE_ARCH_PRCTL | ||
#define PTRACE_ARCH_PRCTL 30 | ||
#endif | ||
#ifndef ARCH_GET_FS | ||
#define ARCH_SET_GS 0x1001 | ||
#define ARCH_SET_FS 0x1002 | ||
#define ARCH_GET_FS 0x1003 | ||
#define ARCH_GET_GS 0x1004 | ||
#endif | ||
#ifndef PTRACE_PEEKMTETAGS | ||
#define PTRACE_PEEKMTETAGS 33 | ||
#endif | ||
#ifndef PTRACE_POKEMTETAGS | ||
#define PTRACE_POKEMTETAGS 34 | ||
#endif | ||
|
||
#endif // liblldb_Host_linux_Ptrace_h_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//===-- Support.h -----------------------------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_HOST_LINUX_SUPPORT_H | ||
#define LLDB_HOST_LINUX_SUPPORT_H | ||
|
||
#include "llvm/Support/ErrorOr.h" | ||
#include "llvm/Support/MemoryBuffer.h" | ||
#include <memory> | ||
|
||
namespace lldb_private { | ||
|
||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> | ||
getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file); | ||
|
||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> | ||
getProcFile(::pid_t pid, const llvm::Twine &file); | ||
|
||
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> | ||
getProcFile(const llvm::Twine &file); | ||
|
||
} // namespace lldb_private | ||
|
||
#endif // #ifndef LLDB_HOST_LINUX_SUPPORT_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//===-- Uio.h ---------------------------------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef liblldb_Host_linux_Uio_h_ | ||
#define liblldb_Host_linux_Uio_h_ | ||
|
||
#include "lldb/Host/Config.h" | ||
#include <sys/uio.h> | ||
|
||
// We shall provide our own implementation of process_vm_readv if it is not | ||
// present | ||
#if !HAVE_PROCESS_VM_READV | ||
ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov, | ||
unsigned long liovcnt, const struct iovec *remote_iov, | ||
unsigned long riovcnt, unsigned long flags); | ||
#endif | ||
|
||
#endif // liblldb_Host_linux_Uio_h_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be defining a reserved identifier. Also, isn't there an existing macro that we could test use to check if we're on AIX?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be really helpful, if we can decide on a better alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't really answer my question. Are there predefined compiler macros that we could use? I'd be surprised if there weren't any, as every platform I know of has some. FWIW, these are the predefined macros on linux: https://godbolt.org/z/EG9fKaxMv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point we are not aware of any predefined ones for AIX though. It would be great if the community can suggest something in this regard. We will also try to find some alternative accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
_AIX
at least in clang: https://godbolt.org/z/95MzjcsKnAnd according to this (totally official, legit) doc (https://www.lnf.infn.it/computing/doc/aixcxx/html/language/ref/rnmcradd.htm) they exist for the AIX system compiler as well. I'm sure you can find the proper page :)
llvm-project/clang/lib/Basic/Targets/OSTargets.h
Line 641 in 0fa78b6
If for some reason that's not going to work, then we would use something like
LLDB_...
as we have done forLLDB_ENABLE_LIBXML2
and friends.(but I'm yet to look at the whole PR so I don't know yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok Thats helpful 😄
I will give it go, trying to integrate it with the overall changes.
Meanwhile, shall I remove
__AIX__
from this PR to keep that discussion separate?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. If we need a cmake generated definition, add that in its own PR along with anything that uses it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, with something that uses it. I'm not asking you to look into the future and know all possible uses.