[lldb] [llvm] [lldb][SBAPI] Add (SBTarget/SBModule)::FindSymbolContexts (PR #223808)

Alex Langford via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 13:59:40 PDT 2026


================
@@ -308,6 +298,13 @@ Makes programs 10x faster by doing Special New Thing.
   return values that were actually in a different set. Both methods are now fixed
   so that they are limited to the registers within the register set. Scripts
   using these methods may have to be updated as a result.
+* New `SBTarget::FindSymbolContexts` and `SBModule::FindSymbolContexts`
+  return an `SBSymbolContextList` for every match of a given source location.
+* A new `SBLineEntry(SBFileSpec, line, column)` constructor lets
+  scripts build the location argument directly.
+* `SBLineEntry::GetLine()` and `SBLineEntry::GetColumn()` now return
+  `LLDB_INVALID_LINE_NUMBER` / `LLDB_INVALID_COLUMN_NUMBER` when unset;
+  scripts checking `entry.GetLine() == 0` should use `entry.IsValid()`.
----------------
bulbazord wrote:

> `SBLineEntry::GetLine()` and `SBLineEntry::GetColumn()` now return
  `LLDB_INVALID_LINE_NUMBER` / `LLDB_INVALID_COLUMN_NUMBER` when unset;

This isn't correct. You can still make an empty FileSpec where `GetLine`/`GetColumn` will return 0. If you want this to be the case, you'll need to change `GetLine` and `GetColumn` as well. However, that would be a breaking change for the SBAPI and I would not encourage it.

Your guidance is correct (`IsValid` will give you the right answer). Unfortunately, it's possible for a valid SBLineEntry to have a line/column of 0 (e.g. compiler-generated code may have this property). I think we should expand on the guidance and change the documentation for these methods to explain this shortcoming.

https://github.com/llvm/llvm-project/pull/223808


More information about the llvm-commits mailing list