-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Extending LLDB to work on AIX #102601
base: main
Are you sure you want to change the base?
Extending LLDB to work on AIX #102601
Changes from all commits
39d395f
b1da5b1
50ad673
a2f162d
d1e3ac5
061180f
b3b75da
c1967be
ae7a76e
094e590
758ab64
f7fb892
33d561f
450793d
bb117dd
9c95e79
61e7843
f334146
627a542
fd3dc9f
163e510
c357357
e610977
9713e7a
0ad10dc
473947d
ea34b15
fee4abf
a8020a6
a77dc02
07e66aa
dfb2648
5b2d196
815c36e
2c34d32
daac372
b78c1c0
e70dd07
1529f91
6bccc8a
ecd7a18
15225a2
723cbde
ad7efa0
10bcf83
dba98d6
cbc5033
0943a37
dc26b73
bca31f3
13f3598
7609ad3
cfae3da
a486c75
d2235be
dd56fce
3f58fa4
4ffba50
2e032f6
af5f4f2
48b8b1b
eb8d97f
325057e
87d3aba
6d0f3fe
7ca81e0
56ed03c
131579b
d410734
6161d1f
9830f34
2976417
075daef
4b1b309
e4b98f4
ebc44c4
64bd8d6
accdf2c
ff6562c
9ac84cd
70f63f0
7864b11
05be756
30cf01d
e192cd4
ef0084d
e6cd74f
ad3c9ae
e4579f7
c33cc6e
4489e86
b2d40bb
c555d7c
5213cca
1c22912
9a6f83a
6371dfc
a7ca585
d6f90a8
5b008d8
685620a
0c9e4c1
2718b3d
c6a00fa
abca02e
48f39da
685aa51
7b28aa5
34adb6d
4b0c484
c826a08
8e80b80
93c105a
9ba650f
174efe0
d58b833
a8e7f03
818e9d8
f494470
3db456b
e7203d5
0ec1cd0
85ae4f0
05e2848
11cb200
7660757
6ce2d11
19b9251
cbc8e39
07b5dbd
b0ef220
015f689
61ad7c9
97531f7
20bcb5b
f234a2a
5c0f06e
8dfafd4
0fd991b
01d9338
71d2fcf
a52d2f6
9a526a0
8045b92
c7d4eab
78d1671
8fcf69e
c3c2b32
a4f4d4a
af732be
40b4fbe
51fb774
252e0c0
585bd72
22cd1da
a66defe
38ce4a5
2a2d668
5551074
fd59a98
49d795f
f8b05df
57d080e
673713a
53037f1
4d15937
63e8df6
94c6c10
cdc31f3
713a6cb
0a706d2
84ebb4e
27e8a91
b6c1d8d
588e1c5
0a18186
6db1782
c334103
3bfb427
eef33d2
844f798
4d5a088
b457557
1d20ebb
2c30170
ad2c204
72de919
79e9625
84ab2f0
aefbbbf
847230b
cab9674
054733b
b01e24c
26a3c23
befb24c
68e0c4c
4fe42cd
b4d4329
021ca06
49cc9bb
f428ca6
e5ed4f2
cd39f0a
ddcf64f
626c018
3903792
8a464f3
98de95c
9d3a322
82dbcb0
68c2b7a
57a4ca0
216bde5
72dd626
fc16f21
1692376
60294ea
c031b94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
This product contains small piece of code to support AIX, taken from netbsd. | ||
|
||
* LICENSE: | ||
* lldb/source/Host/common/LICENSE.aix-netbsd.txt (OpenSSL License) | ||
* HOMEPAGE: | ||
* https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/crypto/external/bsd/openssl/dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,11 @@ | |
|
||
#include "lldb/Host/Config.h" | ||
|
||
#if defined(_AIX) | ||
//FIXME for AIX | ||
#undef LLDB_ENABLE_LIBXML2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory if you configure with |
||
#endif | ||
|
||
#if LLDB_ENABLE_LIBXML2 | ||
#include <libxml/xmlreader.h> | ||
#endif | ||
|
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(); | ||
|
||
protected: | ||
size_t GetNameOffset() const override; | ||
void DeleteSocketFile(llvm::StringRef name) override; | ||
}; | ||
} | ||
|
||
#endif // ifndef liblldb_AbstractSocket_h_ |
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_AIX_HOST_H | ||
#define LLDB_HOST_AIX_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_AIX_HOST_H |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//===-- 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_aix_Ptrace_h_ | ||
#define liblldb_Host_aix_Ptrace_h_ | ||
|
||
#include <sys/ptrace.h> | ||
|
||
#define DEBUG_PTRACE_MAXBYTES 20 | ||
|
||
// Support ptrace extensions even when compiled without required kernel support | ||
#ifndef PTRACE_GETREGS | ||
#define PTRACE_GETREGS (PT_COMMAND_MAX+1) | ||
#endif | ||
#ifndef PTRACE_SETREGS | ||
#define PTRACE_SETREGS (PT_COMMAND_MAX+2) | ||
#endif | ||
#ifndef PTRACE_GETFPREGS | ||
#define PTRACE_GETFPREGS (PT_COMMAND_MAX+3) | ||
#endif | ||
#ifndef PTRACE_SETFPREGS | ||
#define PTRACE_SETFPREGS (PT_COMMAND_MAX+4) | ||
#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 (PT_COMMAND_MAX+5) | ||
#endif | ||
#ifndef PTRACE_ARCH_PRCTL | ||
#define PTRACE_ARCH_PRCTL (PT_COMMAND_MAX+6) | ||
#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 (PT_COMMAND_MAX+7) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Funny seeing this here, I worked on lldb's MTE support for AArch64. Does AIX support a memory tagging feature as well? If so I'd be quite interested to see how it fits into the memory tagging support code. I tried to make it generic but when you've only got one implementation, you never know if it's truly flexible or not. |
||
#endif | ||
#ifndef PTRACE_POKEMTETAGS | ||
#define PTRACE_POKEMTETAGS (PT_COMMAND_MAX+8) | ||
#endif | ||
#ifndef PTRACE_GETVRREGS | ||
#define PTRACE_GETVRREGS (PT_COMMAND_MAX+9) | ||
#endif | ||
#ifndef PTRACE_GETVSRREGS | ||
#define PTRACE_GETVSRREGS (PT_COMMAND_MAX+10) | ||
#endif | ||
|
||
#endif // liblldb_Host_aix_Ptrace_h_ |
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_AIX_SUPPORT_H | ||
#define LLDB_HOST_AIX_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_AIX_SUPPORT_H |
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_aix_Uio_h_ | ||
#define liblldb_Host_aix_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_aix_Uio_h_ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,10 @@ class RegisterContextUnwind : public lldb_private::RegisterContext { | |
|
||
bool ReadPC(lldb::addr_t &start_pc); | ||
|
||
#ifdef _AIX | ||
bool ReadLR(lldb::addr_t &lr); | ||
#endif | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's likely we'd ask you to make this a method on all platforms that is only called on, or implemented for, AIX. |
||
// Indicates whether this frame *behaves* like frame zero -- the currently | ||
// executing frame -- or not. This can be true in the middle of the stack | ||
// above asynchronous trap handlers (sigtramp) for instance. | ||
|
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'll need to confirm license compatibility for this.
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.
And if there is a way not to pull in this code, we're likely going to prefer that.