LLDB mainline
NativeRegisterContextDBReg_loongarch.cpp
Go to the documentation of this file.
1//===-- NativeRegisterContextDBReg_loongarch.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
10
12#include "lldb/Utility/Log.h"
14
15using namespace lldb_private;
16
17uint32_t
20 LLDB_LOG(log, "wp_index: {0}", wp_index);
21
22 switch ((m_hwp_regs[wp_index].control >> 10) & 0x3) {
23 case 0x0:
24 return 8;
25 case 0x1:
26 return 4;
27 case 0x2:
28 return 2;
29 case 0x3:
30 return 1;
31 default:
32 return 0;
33 }
34}
35
36std::optional<NativeRegisterContextDBReg::WatchpointDetails>
38 const WatchpointDetails &details) {
39 // LoongArch only needs to check the size; it does not need to check the
40 // address.
41 size_t size = details.size;
42 if (size != 1 && size != 2 && size != 4 && size != 8)
43 return std::nullopt;
44
45 return details;
46}
47
48uint32_t
50 // Return encoded hardware breakpoint control value.
52}
53
55 size_t size, uint32_t watch_flags) {
56 // Encoding hardware watchpoint control value.
57 // Size encoded:
58 // case 1 : 0b11
59 // case 2 : 0b10
60 // case 4 : 0b01
61 // case 8 : 0b00
62 size_t encoded_size = (3 - llvm::Log2_32(size)) << 10;
63
64 return m_hw_dbg_enable_bit | encoded_size | (watch_flags << 8);
65}
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:369
uint32_t MakeWatchControlValue(size_t size, uint32_t watch_flags) override
std::optional< WatchpointDetails > AdjustWatchpoint(const WatchpointDetails &details) override
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:332