Skip to content

Commit 7239f62

Browse files
Meet review items
1 parent d30c3b7 commit 7239f62

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv64.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313
using namespace lldb_private;
1414

1515
std::unique_ptr<RegisterContextCorePOSIX_riscv64>
16-
RegisterContextCorePOSIX_riscv64::Create(
17-
lldb_private::Thread &thread, const lldb_private::ArchSpec &arch,
18-
const lldb_private::DataExtractor &gpregset,
19-
llvm::ArrayRef<lldb_private::CoreNote> notes) {
16+
RegisterContextCorePOSIX_riscv64::Create(Thread &thread, const ArchSpec &arch,
17+
const DataExtractor &gpregset,
18+
llvm::ArrayRef<CoreNote> notes) {
2019
Flags flags = 0;
2120

22-
auto register_info_up =
23-
std::make_unique<RegisterInfoPOSIX_riscv64>(arch, flags);
2421
return std::unique_ptr<RegisterContextCorePOSIX_riscv64>(
25-
new RegisterContextCorePOSIX_riscv64(thread, std::move(register_info_up),
26-
gpregset, notes));
22+
new RegisterContextCorePOSIX_riscv64(
23+
thread, std::make_unique<RegisterInfoPOSIX_riscv64>(arch, flags),
24+
gpregset, notes));
2725
}
2826

2927
RegisterContextCorePOSIX_riscv64::RegisterContextCorePOSIX_riscv64(
@@ -51,12 +49,12 @@ bool RegisterContextCorePOSIX_riscv64::ReadGPR() { return true; }
5149
bool RegisterContextCorePOSIX_riscv64::ReadFPR() { return true; }
5250

5351
bool RegisterContextCorePOSIX_riscv64::WriteGPR() {
54-
assert(0);
52+
assert(false && "Writing registers is not allowed for core dumps");
5553
return false;
5654
}
5755

5856
bool RegisterContextCorePOSIX_riscv64::WriteFPR() {
59-
assert(0);
57+
assert(false && "Writing registers is not allowed for core dumps");
6058
return false;
6159
}
6260

@@ -67,9 +65,11 @@ bool RegisterContextCorePOSIX_riscv64::ReadRegister(
6765

6866
if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
6967
src = m_gpr.GetDataStart();
70-
} else { // IsFPR
68+
} else if (IsFPR(reg_info->kinds[lldb::eRegisterKindLLDB])) {
7169
src = m_fpr.GetDataStart();
7270
offset -= GetGPRSize();
71+
} else {
72+
return false;
7373
}
7474

7575
Status error;

0 commit comments

Comments
 (0)