-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[lldb][AIX] Added Ptrace extensions for AIX #108000
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
Changes from 2 commits
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,44 @@ | ||
//===-- 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 | ||
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. What is the purpose of this and should it be declared like:
In case the build machine has a kernel that has changed this? 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. This is a lldb-specific macro that shouldn't be here even on linux (it's just used in one place, and might as well be inlined there). Let's delete it from here. 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. To be specific, it is being used in the 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. Yes, please do that. (Alternatively, we could move this constant to some common header, if you think that having a consistent number of logged bytes is useful (I don't think that)). 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. For now, I can define it with the given value in that file locally and use it, and going forward we can update/get it removed if that is a better alternative. |
||
|
||
// Support ptrace extensions even when compiled without required kernel support | ||
#ifndef PTRACE_GETREGS | ||
#define PTRACE_GETREGS (PT_COMMAND_MAX + 1) | ||
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. This PT_COMMAND_MAX is provided by some AIX include file, correct? If that's correct then using it like this is fine because PTrace.h is only included in code built natively. Do you have public documentation for these ptrace numbers? Perhaps there is a man page like https://man7.org/linux/man-pages/man2/ptrace.2.html? It would be good to include a link to that in the PR description. 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. I'll just add that all of these defines are only required if your system headers don't always provide these definitions. This was necessary on linux (in the past, maybe not in present), because people built lldb on all kinds of kernel versions. If you're only going to support building lldb on AIX version >=X (where 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. Just to avoid confusion, this comment was actually question: Is it the case that the AIX system headers (on all supported versions) do not already define these constants? 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.
Although it is defined in AIX's system header
We are actually using these defines do some emulation in the NativeProcess files, hence the need for them. Please take a look here: 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. Just pasting a small snippet from that here:
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. ok, so if I understand what you're saying, these definitions don't correspond to any actual values defined or supported by the system. In that case, I think these values do not belong here, as this is basically an OS compatibility header. In fact, I think there's no reason for these constants should exist. You don't have to follow the patterns in NativeProcessLinux, if they don't make sense for you. There's nothing forcing you do implement ReadGPR like this
If your host ptrace call does not support reading GPRs in bulk. If you need to read registers one by one, the most obvious implementation is to just do that directly inside the ReadGPR function -- basically inline the relevant part of PtraceWrapper into this function (and then get rid of the constant). 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. Okay, sure. I will try that implementation as well. |
||
#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_GETVRREGS | ||
#define PTRACE_GETVRREGS (PT_COMMAND_MAX + 5) | ||
#endif | ||
#ifndef PTRACE_GETVSRREGS | ||
#define PTRACE_GETVSRREGS (PT_COMMAND_MAX + 6) | ||
#endif | ||
|
||
#endif // liblldb_Host_aix_Ptrace_h_ |
Uh oh!
There was an error while loading. Please reload this page.