summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
diff options
context:
space:
mode:
authorEmmmer <yjhdandan@163.com>2022-08-16 15:35:38 +0800
committerEmmmer <yjhdandan@163.com>2022-08-16 23:41:00 +0800
commit95e2949a5352aea0182ba5295bf9ba46080c261e (patch)
tree6e0fc45cf5566ae8d75ae8d350135e3f031ab775 /lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
parent1638ad1ebfa818a454aad35e52a0912aba6172e6 (diff)
[LLDB] Fix possible nullptr exception
Some architectures do not have a flag register (like riscv). In this case, we should set it to `baton.m_register_values.end()` to avoid nullptr exception. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D131945
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp')
-rw-r--r--lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp b/lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
index ee5295bf6565..f9520cf4cfb7 100644
--- a/lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
+++ b/lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
@@ -128,8 +128,10 @@ Status NativeProcessSoftwareSingleStep::SetupSoftwareSingleStepping(
auto pc_it =
baton.m_register_values.find(reg_info_pc->kinds[eRegisterKindDWARF]);
- auto flags_it =
- baton.m_register_values.find(reg_info_flags->kinds[eRegisterKindDWARF]);
+ auto flags_it = reg_info_flags == nullptr
+ ? baton.m_register_values.end()
+ : baton.m_register_values.find(
+ reg_info_flags->kinds[eRegisterKindDWARF]);
lldb::addr_t next_pc;
lldb::addr_t next_flags;