================
@@ -0,0 +1,193 @@
+//===-- PlatformAIX.cpp -------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "PlatformAIX.h"
+#include "lldb/Host/Config.h"
+#include <cstdio>
+#if LLDB_ENABLE_POSIX
+#include <sys/utsname.h>
+#endif
+#include "Utility/ARM64_DWARF_Registers.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/State.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StreamString.h"
+
+// Use defined constants from AIX mman.h for use when targeting remote aix
+// systems even when host has different values.
+
+#if defined(_AIX)
+#include <sys/mman.h>
+#else // For remotely cross debugging aix
+#define MAP_VARIABLE 0x0
+#define MAP_PRIVATE 0x2
+#define MAP_ANONYMOUS 0x10
+#endif
----------------
labath wrote:

```suggestion
// For remotely cross debugging aix
constexpr int MapVariable = 0x0;
constexpr int MapPrivate = 0x2;
constexpr int MapAnonymous = 0x10;
#if defined(_AIX)
#include <sys/mman.h>
static_assert(MapVariable == MAP_VARIABLE);
static_assert(MapPrivate == MAP_PRIVATE);
static_assert(MapAnonymous = MAP_ANONYMOUS);
#endif
```

And then use the locally defined constants in the code. The advantage of that 
is that it checks the constants are defined correctly and avoids redefining 
macros from system headers.

https://github.com/llvm/llvm-project/pull/121273
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to