Skip to content

Commit 0cb9347

Browse files
committed
Fix style, license headers, and includes.
move includes to .cpp and remove <sys/ptrace> that causes error when build.
1 parent a2a2e62 commit 0cb9347

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64dbreg.cpp

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1+
//===-- NativeRegisterContextLinux_arm64dbreg.cpp -------------------------===//
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+
19
#include "NativeRegisterContextLinux_arm64dbreg.h"
10+
#include "lldb/Host/linux/Ptrace.h"
211

3-
using namespace lldb_private::process_linux::arm64;
12+
#include <asm/ptrace.h>
13+
// System includes - They have to be included after framework includes because
14+
// they define some macros which collide with variable names in other modules
15+
#include <sys/uio.h>
16+
// NT_PRSTATUS and NT_FPREGSET definition
17+
#include <elf.h>
418

5-
namespace lldb_private {
6-
namespace process_linux {
7-
namespace arm64 {
19+
using namespace lldb;
20+
using namespace lldb_private;
21+
using namespace lldb_private::process_linux;
822

9-
namespace {
10-
Status ReadHardwareDebugInfoHelper(int regset, ::pid_t tid,
11-
uint32_t &max_supported) {
23+
static Status ReadHardwareDebugInfoHelper(int regset, ::pid_t tid,
24+
uint32_t &max_supported) {
1225
struct iovec ioVec;
1326
struct user_hwdebug_state dreg_state;
1427
Status error;
@@ -24,10 +37,9 @@ Status ReadHardwareDebugInfoHelper(int regset, ::pid_t tid,
2437
max_supported = dreg_state.dbg_info & 0xff;
2538
return error;
2639
}
27-
} // namespace
2840

29-
Status ReadHardwareDebugInfo(::pid_t tid, uint32_t &max_hwp_supported,
30-
uint32_t &max_hbp_supported) {
41+
Status lldb_private::process_linux::arm64::ReadHardwareDebugInfo(
42+
::pid_t tid, uint32_t &max_hwp_supported, uint32_t &max_hbp_supported) {
3143
Status error =
3244
ReadHardwareDebugInfoHelper(NT_ARM_HW_WATCH, tid, max_hwp_supported);
3345

@@ -37,7 +49,7 @@ Status ReadHardwareDebugInfo(::pid_t tid, uint32_t &max_hwp_supported,
3749
return ReadHardwareDebugInfoHelper(NT_ARM_HW_BREAK, tid, max_hbp_supported);
3850
}
3951

40-
Status WriteHardwareDebugRegs(
52+
Status lldb_private::process_linux::arm64::WriteHardwareDebugRegs(
4153
int hwbType, ::pid_t tid, uint32_t max_supported,
4254
const std::array<NativeRegisterContextDBReg::DREG, 16> &regs) {
4355
struct iovec ioVec;
@@ -57,7 +69,3 @@ Status WriteHardwareDebugRegs(
5769
return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, tid, &regset,
5870
&ioVec, ioVec.iov_len);
5971
}
60-
61-
} // namespace arm64
62-
} // namespace process_linux
63-
} // namespace lldb_private

lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64dbreg.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
//===-- NativeRegisterContextLinux_arm64dbreg.h -----------------*- C++ -*-===//
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+
// These functions are split out to be reused in NativeRegisterContextLinux_arm,
10+
// for supporting debugging 32bit processes on arm64.
11+
112
#include "Plugins/Process/Linux/NativeProcessLinux.h"
213
#include "Plugins/Process/Utility/NativeRegisterContextDBReg.h"
314
#include "lldb/Utility/Status.h"
4-
#include <asm/ptrace.h>
5-
#include <cstdint>
6-
#include <elf.h>
7-
#include <sys/ptrace.h>
8-
#include <sys/uio.h>
915

1016
namespace lldb_private {
1117
namespace process_linux {
@@ -20,4 +26,4 @@ Status WriteHardwareDebugRegs(
2026

2127
} // namespace arm64
2228
} // namespace process_linux
23-
} // namespace lldb_private
29+
} // namespace lldb_private

0 commit comments

Comments
 (0)