[Lldb-commits] [lldb] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for invalid symbols (PR #175545)
https://github.com/da-viper updated
https://github.com/llvm/llvm-project/pull/175545
>From aeb644259040d96e18a43afe2e59f697182672d6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Mon, 12 Jan 2026 14:13:59 +
Subject: [PATCH 1/3] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for
invalid symbols
Return UINT32_MAX instead of 0 when SBSymbol has no underlying symbol,
since 0 is a valid symbol ID. This makes it possible to distinguish
between a valid symbol with ID 0 and an invalid/uninitialized symbol.
>From https://github.com/llvm/llvm-project/pull/172687#discussion_r2628319927
---
lldb/source/API/SBSymbol.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index fd68a3820181d..73f082ebde6a3 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -207,7 +207,7 @@ uint32_t SBSymbol::GetID() const {
if (m_opaque_ptr)
return m_opaque_ptr->GetID();
- return 0;
+ return UINT32_MAX;
}
bool SBSymbol::IsExternal() {
>From e69407672c5d07714c34a93261386bdad7b5500e Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Mon, 12 Jan 2026 17:57:39 +
Subject: [PATCH 2/3] add review changes.
---
lldb/include/lldb/API/SBSymbol.h | 4 +++-
lldb/include/lldb/Symbol/Symbol.h | 4 ++--
lldb/include/lldb/lldb-defines.h | 1 +
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lldb/include/lldb/API/SBSymbol.h b/lldb/include/lldb/API/SBSymbol.h
index 3ec0dab5112f5..b913b8ef5771f 100644
--- a/lldb/include/lldb/API/SBSymbol.h
+++ b/lldb/include/lldb/API/SBSymbol.h
@@ -90,7 +90,9 @@ class LLDB_API SBSymbol {
/// Get the ID of this symbol, usually the original symbol table index.
///
/// \returns
- /// Returns the ID of this symbol.
+ /// LLDB_INVALID_PROCESS_ID if this object does not
+ /// contain a valid symbol object.
+ /// Otherwise, Returns a valid symbol ID.
uint32_t GetID() const;
bool operator==(const lldb::SBSymbol &rhs) const;
diff --git a/lldb/include/lldb/Symbol/Symbol.h
b/lldb/include/lldb/Symbol/Symbol.h
index b994c34e46493..1f9d222b6ab29 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -318,8 +318,8 @@ class Symbol : public SymbolContextScope {
void SynthesizeNameIfNeeded() const;
- uint32_t m_uid =
- UINT32_MAX; // User ID (usually the original symbol table
index)
+ uint32_t m_uid = LLDB_INVALID_SYMBOL_ID; // User ID (usually the original
+ // symbol table index)
uint16_t m_type_data = 0; // data specific to m_type
uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has
// already been calculated
diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h
index c54ef884b01dc..52bf7c5cce947 100644
--- a/lldb/include/lldb/lldb-defines.h
+++ b/lldb/include/lldb/lldb-defines.h
@@ -90,6 +90,7 @@
#define LLDB_INVALID_THREAD_ID 0
#define LLDB_INVALID_FRAME_ID UINT32_MAX
#define LLDB_INVALID_SIGNAL_NUMBER INT32_MAX
+#define LLDB_INVALID_SYMBOL_ID UINT32_MAX
#define LLDB_INVALID_OFFSET UINT64_MAX // Must match max of lldb::offset_t
#define LLDB_INVALID_LINE_NUMBER UINT32_MAX
#define LLDB_INVALID_COLUMN_NUMBER 0
>From a7135767226c7dc557475290699d3a6528553e24 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Mon, 12 Jan 2026 17:58:11 +
Subject: [PATCH 3/3] add review changes
---
lldb/include/lldb/API/SBSymbol.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lldb/include/lldb/API/SBSymbol.h b/lldb/include/lldb/API/SBSymbol.h
index b913b8ef5771f..d4c4c7011ce34 100644
--- a/lldb/include/lldb/API/SBSymbol.h
+++ b/lldb/include/lldb/API/SBSymbol.h
@@ -90,9 +90,8 @@ class LLDB_API SBSymbol {
/// Get the ID of this symbol, usually the original symbol table index.
///
/// \returns
- /// LLDB_INVALID_PROCESS_ID if this object does not
- /// contain a valid symbol object.
- /// Otherwise, Returns a valid symbol ID.
+ /// LLDB_INVALID_SYMBOL_ID if this object does not contain a valid symbol
+ /// object. Otherwise, Returns a valid symbol ID.
uint32_t GetID() const;
bool operator==(const lldb::SBSymbol &rhs) const;
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for invalid symbols (PR #175545)
https://github.com/da-viper updated
https://github.com/llvm/llvm-project/pull/175545
>From aeb644259040d96e18a43afe2e59f697182672d6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Mon, 12 Jan 2026 14:13:59 +
Subject: [PATCH 1/2] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for
invalid symbols
Return UINT32_MAX instead of 0 when SBSymbol has no underlying symbol,
since 0 is a valid symbol ID. This makes it possible to distinguish
between a valid symbol with ID 0 and an invalid/uninitialized symbol.
>From https://github.com/llvm/llvm-project/pull/172687#discussion_r2628319927
---
lldb/source/API/SBSymbol.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index fd68a3820181d..73f082ebde6a3 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -207,7 +207,7 @@ uint32_t SBSymbol::GetID() const {
if (m_opaque_ptr)
return m_opaque_ptr->GetID();
- return 0;
+ return UINT32_MAX;
}
bool SBSymbol::IsExternal() {
>From e69407672c5d07714c34a93261386bdad7b5500e Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Mon, 12 Jan 2026 17:57:39 +
Subject: [PATCH 2/2] add review changes.
---
lldb/include/lldb/API/SBSymbol.h | 4 +++-
lldb/include/lldb/Symbol/Symbol.h | 4 ++--
lldb/include/lldb/lldb-defines.h | 1 +
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lldb/include/lldb/API/SBSymbol.h b/lldb/include/lldb/API/SBSymbol.h
index 3ec0dab5112f5..b913b8ef5771f 100644
--- a/lldb/include/lldb/API/SBSymbol.h
+++ b/lldb/include/lldb/API/SBSymbol.h
@@ -90,7 +90,9 @@ class LLDB_API SBSymbol {
/// Get the ID of this symbol, usually the original symbol table index.
///
/// \returns
- /// Returns the ID of this symbol.
+ /// LLDB_INVALID_PROCESS_ID if this object does not
+ /// contain a valid symbol object.
+ /// Otherwise, Returns a valid symbol ID.
uint32_t GetID() const;
bool operator==(const lldb::SBSymbol &rhs) const;
diff --git a/lldb/include/lldb/Symbol/Symbol.h
b/lldb/include/lldb/Symbol/Symbol.h
index b994c34e46493..1f9d222b6ab29 100644
--- a/lldb/include/lldb/Symbol/Symbol.h
+++ b/lldb/include/lldb/Symbol/Symbol.h
@@ -318,8 +318,8 @@ class Symbol : public SymbolContextScope {
void SynthesizeNameIfNeeded() const;
- uint32_t m_uid =
- UINT32_MAX; // User ID (usually the original symbol table
index)
+ uint32_t m_uid = LLDB_INVALID_SYMBOL_ID; // User ID (usually the original
+ // symbol table index)
uint16_t m_type_data = 0; // data specific to m_type
uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has
// already been calculated
diff --git a/lldb/include/lldb/lldb-defines.h b/lldb/include/lldb/lldb-defines.h
index c54ef884b01dc..52bf7c5cce947 100644
--- a/lldb/include/lldb/lldb-defines.h
+++ b/lldb/include/lldb/lldb-defines.h
@@ -90,6 +90,7 @@
#define LLDB_INVALID_THREAD_ID 0
#define LLDB_INVALID_FRAME_ID UINT32_MAX
#define LLDB_INVALID_SIGNAL_NUMBER INT32_MAX
+#define LLDB_INVALID_SYMBOL_ID UINT32_MAX
#define LLDB_INVALID_OFFSET UINT64_MAX // Must match max of lldb::offset_t
#define LLDB_INVALID_LINE_NUMBER UINT32_MAX
#define LLDB_INVALID_COLUMN_NUMBER 0
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for invalid symbols (PR #175545)
@@ -207,7 +207,7 @@ uint32_t SBSymbol::GetID() const {
if (m_opaque_ptr)
return m_opaque_ptr->GetID();
- return 0;
+ return UINT32_MAX;
adrian-prantl wrote:
Can you add this to the Doxygen comment in SBSymbol.h?
https://github.com/llvm/llvm-project/pull/175545
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for invalid symbols (PR #175545)
llvmbot wrote:
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
Changes
Return UINT32_MAX instead of 0 when SBSymbol has no underlying symbol, since 0
is a valid symbol ID.
This makes it possible to distinguish between a valid symbol with ID 0 and an
invalid/uninitialised symbol.
>From https://github.com/llvm/llvm-project/pull/172687#discussion_r2628319927
---
Full diff: https://github.com/llvm/llvm-project/pull/175545.diff
1 Files Affected:
- (modified) lldb/source/API/SBSymbol.cpp (+1-1)
``diff
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index fd68a3820181d..73f082ebde6a3 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -207,7 +207,7 @@ uint32_t SBSymbol::GetID() const {
if (m_opaque_ptr)
return m_opaque_ptr->GetID();
- return 0;
+ return UINT32_MAX;
}
bool SBSymbol::IsExternal() {
``
https://github.com/llvm/llvm-project/pull/175545
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for invalid symbols (PR #175545)
https://github.com/da-viper created
https://github.com/llvm/llvm-project/pull/175545
Return UINT32_MAX instead of 0 when SBSymbol has no underlying symbol, since 0
is a valid symbol ID.
This makes it possible to distinguish between a valid symbol with ID 0 and an
invalid/uninitialised symbol.
>From https://github.com/llvm/llvm-project/pull/172687#discussion_r2628319927
>From aeb644259040d96e18a43afe2e59f697182672d6 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Mon, 12 Jan 2026 14:13:59 +
Subject: [PATCH] [lldb] Change SBSymbol::GetID() to return UINT32_MAX for
invalid symbols
Return UINT32_MAX instead of 0 when SBSymbol has no underlying symbol,
since 0 is a valid symbol ID. This makes it possible to distinguish
between a valid symbol with ID 0 and an invalid/uninitialized symbol.
>From https://github.com/llvm/llvm-project/pull/172687#discussion_r2628319927
---
lldb/source/API/SBSymbol.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index fd68a3820181d..73f082ebde6a3 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -207,7 +207,7 @@ uint32_t SBSymbol::GetID() const {
if (m_opaque_ptr)
return m_opaque_ptr->GetID();
- return 0;
+ return UINT32_MAX;
}
bool SBSymbol::IsExternal() {
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
