Skip to content

Conversation

@felipepiovezan
Copy link
Contributor

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).

…Memory

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).
@llvmbot
Copy link
Member

llvmbot commented Aug 1, 2025

@llvm/pr-subscribers-lldb

Author: Felipe de Azevedo Piovezan (felipepiovezan)

Changes

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).


Full diff: https://github.com/llvm/llvm-project/pull/151767.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp (+2-2)
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
index 29927e3b5e4ed..b5577874e211b 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
@@ -153,14 +153,14 @@ uint32_t RegisterContextThreadMemory::ConvertRegisterKindToRegisterNumber(
   UpdateRegisterContext();
   if (m_reg_ctx_sp)
     return m_reg_ctx_sp->ConvertRegisterKindToRegisterNumber(kind, num);
-  return false;
+  return LLDB_INVALID_REGNUM;
 }
 
 uint32_t RegisterContextThreadMemory::NumSupportedHardwareBreakpoints() {
   UpdateRegisterContext();
   if (m_reg_ctx_sp)
     return m_reg_ctx_sp->NumSupportedHardwareBreakpoints();
-  return false;
+  return 0;
 }
 
 uint32_t RegisterContextThreadMemory::SetHardwareBreakpoint(lldb::addr_t addr,

Copy link
Collaborator

@jimingham jimingham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@felipepiovezan felipepiovezan merged commit c3b5f1c into llvm:main Aug 1, 2025
11 checks passed
@felipepiovezan felipepiovezan deleted the felipe/unwinder_regcontext_bool_conversion branch August 1, 2025 22:40
felipepiovezan added a commit to felipepiovezan/llvm-project that referenced this pull request Sep 2, 2025
…Memory (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).

(cherry picked from commit c3b5f1c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants