Skip to content

Commit ab9c6e3

Browse files
felipepiovezankrishna2803
authored andcommitted
[lldb] Fix incorrect conversion from boolean in RegisterContextThreadMemory (llvm#151767)
The method ConvertRegisterKindToRegisterNumber should return INVALID_REGNUM, and not "false" upon failure: false would mean 0 which is usually the number for generic PC. Likewise, NumSupportedHardwareBreakpoints should return 0 instead of false (though for this one they are equivalent).
1 parent 99fe09e commit ab9c6e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ uint32_t RegisterContextThreadMemory::ConvertRegisterKindToRegisterNumber(
153153
UpdateRegisterContext();
154154
if (m_reg_ctx_sp)
155155
return m_reg_ctx_sp->ConvertRegisterKindToRegisterNumber(kind, num);
156-
return false;
156+
return LLDB_INVALID_REGNUM;
157157
}
158158

159159
uint32_t RegisterContextThreadMemory::NumSupportedHardwareBreakpoints() {
160160
UpdateRegisterContext();
161161
if (m_reg_ctx_sp)
162162
return m_reg_ctx_sp->NumSupportedHardwareBreakpoints();
163-
return false;
163+
return 0;
164164
}
165165

166166
uint32_t RegisterContextThreadMemory::SetHardwareBreakpoint(lldb::addr_t addr,

0 commit comments

Comments
 (0)