[Lldb-commits] [lldb] [lldb] Avoid Function::GetAddressRange in ThreadPlanStepRange::InSymbol (PR #128515)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 24 06:12:48 PST 2025


https://github.com/labath created https://github.com/llvm/llvm-project/pull/128515

The existing implementation would probably produce false positives for discontinuous functions. I haven't tried reproducing it because setting up discontinuous functions (and executing them, in particular) is pretty complex and there's nothing particularly interesting happening here.

>From 8ac15fca343bab69639b573094a7ec784b22b566 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Mon, 24 Feb 2025 15:03:46 +0100
Subject: [PATCH] [lldb] Avoid Function::GetAddressRange in
 ThreadPlanStepRange::InSymbol

The existing implementation would probably produce false positives for
discontinuous functions. I haven't tried reproducing it because setting
up discontinuous functions (and executing them, in particular) is pretty
complex and there's nothing particularly interesting happening here.
---
 lldb/source/Target/ThreadPlanStepRange.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp
index de4cd5995f695..78e1270edcdab 100644
--- a/lldb/source/Target/ThreadPlanStepRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepRange.cpp
@@ -197,9 +197,11 @@ bool ThreadPlanStepRange::InRange() {
 bool ThreadPlanStepRange::InSymbol() {
   lldb::addr_t cur_pc = GetThread().GetRegisterContext()->GetPC();
   if (m_addr_context.function != nullptr) {
-    return m_addr_context.function->GetAddressRange().ContainsLoadAddress(
-        cur_pc, &GetTarget());
-  } else if (m_addr_context.symbol && m_addr_context.symbol->ValueIsAddress()) {
+    AddressRange unused_range;
+    return m_addr_context.function->GetRangeContainingLoadAddress(
+        cur_pc, GetTarget(), unused_range);
+  }
+  if (m_addr_context.symbol && m_addr_context.symbol->ValueIsAddress()) {
     AddressRange range(m_addr_context.symbol->GetAddressRef(),
                        m_addr_context.symbol->GetByteSize());
     return range.ContainsLoadAddress(cur_pc, &GetTarget());



More information about the lldb-commits mailing list