[Lldb-commits] [lldb] [lldb] Add DWARFExpressionEntry and GetExpressionEntryAtAddress() to … (PR #144238)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 10 06:48:34 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- lldb/include/lldb/Expression/DWARFExpressionList.h lldb/source/Expression/DWARFExpressionList.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Expression/DWARFExpressionList.h b/lldb/include/lldb/Expression/DWARFExpressionList.h
index 1bd762a98..d303ad834 100644
--- a/lldb/include/lldb/Expression/DWARFExpressionList.h
+++ b/lldb/include/lldb/Expression/DWARFExpressionList.h
@@ -59,7 +59,7 @@ public:
}
lldb::addr_t GetFuncFileAddress() { return m_func_file_addr; }
-
+
/// Represents an entry in the DWARFExpressionList with all needed metadata.
struct DWARFExpressionEntry {
/// Represents a DWARF location range in the DWARF unit’s file‐address space
@@ -69,7 +69,8 @@ public:
/// Returns a DWARFExpressionEntry whose file_range contains the given
/// load‐address. `func_load_addr` is the load‐address of the function
- /// start; `load_addr` is the full runtime PC. On success, `expr` is non-null.
+ /// start; `load_addr` is the full runtime PC. On success, `expr` is
+ /// non-null.
std::optional<DWARFExpressionEntry>
GetExpressionEntryAtAddress(lldb::addr_t func_load_addr,
lldb::addr_t load_addr) const;
diff --git a/lldb/source/Expression/DWARFExpressionList.cpp b/lldb/source/Expression/DWARFExpressionList.cpp
index b51317a98..45606ec7f 100644
--- a/lldb/source/Expression/DWARFExpressionList.cpp
+++ b/lldb/source/Expression/DWARFExpressionList.cpp
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/AddressRange.h"
#include "lldb/Expression/DWARFExpressionList.h"
+#include "lldb/Core/AddressRange.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
@@ -56,7 +56,7 @@ bool DWARFExpressionList::ContainsAddress(lldb::addr_t func_load_addr,
std::optional<DWARFExpressionList::DWARFExpressionEntry>
DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr,
- lldb::addr_t load_addr) const {
+ lldb::addr_t load_addr) const {
if (const DWARFExpression *always = GetAlwaysValidExpr()) {
return DWARFExpressionEntry{std::nullopt, always};
}
@@ -64,9 +64,10 @@ DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr,
if (func_load_addr == LLDB_INVALID_ADDRESS)
func_load_addr = m_func_file_addr;
- // Guard against underflow when translating a load address back into file space.
+ // Guard against underflow when translating a load address back into file
+ // space.
if (load_addr < func_load_addr)
- return std::nullopt;
+ return std::nullopt;
// Guard against overflow.
lldb::addr_t delta = load_addr - func_load_addr;
@@ -74,10 +75,10 @@ DWARFExpressionList::GetExpressionEntryAtAddress(lldb::addr_t func_load_addr,
return std::nullopt;
lldb::addr_t file_pc = (load_addr - func_load_addr) + m_func_file_addr;
-
+
if (const auto *entry = m_exprs.FindEntryThatContains(file_pc)) {
AddressRange range_in_file(entry->GetRangeBase(),
- entry->GetRangeEnd() - entry->GetRangeBase());
+ entry->GetRangeEnd() - entry->GetRangeBase());
return DWARFExpressionEntry{range_in_file, &entry->data};
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/144238
More information about the lldb-commits
mailing list