[Lldb-commits] [lldb] [lldb-dap] Add valueLocationReference for member function pointers (PR #186837)
Sergei Druzhkov via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 13 00:46:28 PDT 2026
https://github.com/DrSergei updated https://github.com/llvm/llvm-project/pull/186837
>From 147c4ab82dd0215ca8732a6321dfc8cd8acd0427 Mon Sep 17 00:00:00 2001
From: Sergei Druzhkov <serzhdruzhok at gmail.com>
Date: Mon, 16 Mar 2026 19:43:18 +0300
Subject: [PATCH 1/3] [lldb-dap] Add valueLocationReference for member function
pointers
---
lldb/include/lldb/API/SBType.h | 4 +++
lldb/source/API/SBType.cpp | 16 ++++++++++++
lldb/source/API/SBValue.cpp | 7 +++--
.../lldb-dap/locations/TestDAP_locations.py | 26 ++++++++++++++++---
.../API/tools/lldb-dap/locations/main.cpp | 5 ++++
lldb/tools/lldb-dap/JSONUtils.cpp | 4 ++-
6 files changed, 54 insertions(+), 8 deletions(-)
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 9ad3244686328..234f65f4d177b 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -158,6 +158,10 @@ class SBType {
bool IsFunctionType();
+ bool IsFunctionPointerType();
+
+ bool IsMemberFunctionPointerType();
+
bool IsPolymorphicClass();
bool IsArrayType();
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index f58902dcf44d8..065c954b97090 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -258,6 +258,22 @@ bool SBType::IsFunctionType() {
return m_opaque_sp->GetCompilerType(true).IsFunctionType();
}
+bool SBType::IsFunctionPointerType() {
+ LLDB_INSTRUMENT_VA(this);
+
+ if (!IsValid())
+ return false;
+ return m_opaque_sp->GetCompilerType(true).IsFunctionPointerType();
+}
+
+bool SBType::IsMemberFunctionPointerType() {
+ LLDB_INSTRUMENT_VA(this);
+
+ if (!IsValid())
+ return false;
+ return m_opaque_sp->GetCompilerType(true).IsMemberFunctionPointerType();
+}
+
bool SBType::IsPolymorphicClass() {
LLDB_INSTRUMENT_VA(this);
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index a27da7b61f8ea..94d4f991d0c7f 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -46,6 +46,7 @@
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
#include <memory>
@@ -803,10 +804,8 @@ lldb::addr_t SBValue::GetValueAsAddress() {
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp) {
- bool success = true;
- uint64_t ret_val = fail_value;
- ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
- if (!success)
+ auto [ret_val, type] = value_sp->GetPointerValue();
+ if (type != eAddressTypeLoad)
return fail_value;
ProcessSP process_sp = m_opaque_sp->GetProcessSP();
if (!process_sp)
diff --git a/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py b/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py
index 45f836a2fa3c3..12eeeca72da37 100644
--- a/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py
+++ b/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py
@@ -37,7 +37,7 @@ def test_locations(self):
)
self.assertTrue(loc_var1["success"])
self.assertTrue(loc_var1["body"]["source"]["path"].endswith("main.cpp"))
- self.assertEqual(loc_var1["body"]["line"], 6)
+ self.assertEqual(loc_var1["body"]["line"], 10)
# func_ptr has both a declaration and a valueLocation
self.assertIn("declarationLocationReference", locals["func_ptr"].keys())
@@ -49,7 +49,7 @@ def test_locations(self):
self.assertTrue(
decl_loc_func_ptr["body"]["source"]["path"].endswith("main.cpp")
)
- self.assertEqual(decl_loc_func_ptr["body"]["line"], 7)
+ self.assertEqual(decl_loc_func_ptr["body"]["line"], 11)
val_loc_func_ptr = self.dap_server.request_locations(
locals["func_ptr"]["valueLocationReference"]
)
@@ -67,7 +67,7 @@ def test_locations(self):
self.assertTrue(
decl_loc_func_ref["body"]["source"]["path"].endswith("main.cpp")
)
- self.assertEqual(decl_loc_func_ref["body"]["line"], 8)
+ self.assertEqual(decl_loc_func_ref["body"]["line"], 12)
val_loc_func_ref = self.dap_server.request_locations(
locals["func_ref"]["valueLocationReference"]
)
@@ -75,6 +75,26 @@ def test_locations(self):
self.assertTrue(val_loc_func_ref["body"]["source"]["path"].endswith("main.cpp"))
self.assertEqual(val_loc_func_ref["body"]["line"], 3)
+ # member_ptr has both a declaration and a valueLocation
+ self.assertIn("declarationLocationReference", locals["member_ptr"].keys())
+ self.assertIn("valueLocationReference", locals["member_ptr"].keys())
+ decl_loc_member_ptr = self.dap_server.request_locations(
+ locals["member_ptr"]["declarationLocationReference"]
+ )
+ self.assertTrue(decl_loc_member_ptr["success"])
+ self.assertTrue(
+ decl_loc_member_ptr["body"]["source"]["path"].endswith("main.cpp")
+ )
+ self.assertEqual(decl_loc_member_ptr["body"]["line"], 13)
+ val_loc_member_ptr = self.dap_server.request_locations(
+ locals["member_ptr"]["valueLocationReference"]
+ )
+ self.assertTrue(val_loc_member_ptr["success"])
+ self.assertTrue(
+ val_loc_member_ptr["body"]["source"]["path"].endswith("main.cpp")
+ )
+ self.assertEqual(val_loc_member_ptr["body"]["line"], 6)
+
# `evaluate` responses for function pointers also have locations associated
eval_res = self.dap_server.request_evaluate("greet")
self.assertTrue(eval_res["success"])
diff --git a/lldb/test/API/tools/lldb-dap/locations/main.cpp b/lldb/test/API/tools/lldb-dap/locations/main.cpp
index fb7789ffd86fd..d5faf21eb7cb6 100644
--- a/lldb/test/API/tools/lldb-dap/locations/main.cpp
+++ b/lldb/test/API/tools/lldb-dap/locations/main.cpp
@@ -2,9 +2,14 @@
void greet() { printf("Hello"); }
+struct test {
+ void foo() {}
+};
+
int main(void) {
int var1 = 1;
void (*func_ptr)() = &greet;
void (&func_ref)() = greet;
+ auto member_ptr = &test::foo;
return 0; // break here
}
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 21647b314e3cd..3bb9e3309440e 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -345,7 +345,9 @@ std::string VariableDescription::GetResult(protocol::EvaluateContext context) {
}
bool ValuePointsToCode(lldb::SBValue v) {
- if (!v.GetType().GetPointeeType().IsFunctionType())
+ lldb::SBType type = v.GetType();
+ if (!(type.IsFunctionPointerType() || type.IsMemberFunctionPointerType() ||
+ type.GetReferenceType().IsFunctionType()))
return false;
lldb::addr_t addr = v.GetValueAsAddress();
>From 63805068b64294fe05a3d7e58b34945af8c2a0a1 Mon Sep 17 00:00:00 2001
From: Sergei Druzhkov <serzhdruzhok at gmail.com>
Date: Wed, 18 Mar 2026 10:15:40 +0300
Subject: [PATCH 2/3] Fix review comments
---
lldb/include/lldb/API/SBValue.h | 2 ++
lldb/source/API/SBValue.cpp | 19 +++++++++++++++++++
.../Handler/LocationsRequestHandler.cpp | 2 +-
lldb/tools/lldb-dap/JSONUtils.cpp | 2 +-
4 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index d4cc2f05c39e3..caa636b19b88f 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -69,6 +69,8 @@ class LLDB_API SBValue {
lldb::addr_t GetValueAsAddress();
+ lldb::addr_t GetPointerValue();
+
ValueType GetValueType();
// If you call this on a newly created ValueObject, it will always return
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 94d4f991d0c7f..553092ef94a91 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -800,6 +800,25 @@ uint64_t SBValue::GetValueAsUnsigned(uint64_t fail_value) {
}
lldb::addr_t SBValue::GetValueAsAddress() {
+ addr_t fail_value = LLDB_INVALID_ADDRESS;
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (value_sp) {
+ bool success = true;
+ uint64_t ret_val = fail_value;
+ ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
+ if (!success)
+ return fail_value;
+ ProcessSP process_sp = m_opaque_sp->GetProcessSP();
+ if (!process_sp)
+ return ret_val;
+ return process_sp->FixDataAddress(ret_val);
+ }
+
+ return fail_value;
+}
+
+lldb::addr_t SBValue::GetPointerValue() {
addr_t fail_value = LLDB_INVALID_ADDRESS;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
diff --git a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
index ce4a527009dea..4257733267b04 100644
--- a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
@@ -39,7 +39,7 @@ LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
return llvm::make_error<DAPError>(
"Value locations are only available for pointers and references");
- lldb::addr_t raw_addr = variable.GetValueAsAddress();
+ lldb::addr_t raw_addr = variable.GetPointerValue();
lldb::SBAddress addr = dap.target.ResolveLoadAddress(raw_addr);
lldb::SBLineEntry line_entry = GetLineEntryForAddress(dap.target, addr);
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 3bb9e3309440e..d3b9b23e25a71 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -350,7 +350,7 @@ bool ValuePointsToCode(lldb::SBValue v) {
type.GetReferenceType().IsFunctionType()))
return false;
- lldb::addr_t addr = v.GetValueAsAddress();
+ lldb::addr_t addr = v.GetPointerValue();
lldb::SBLineEntry line_entry =
v.GetTarget().ResolveLoadAddress(addr).GetLineEntry();
>From 29cdbe19d2e54ecd8bc84f0c8775277591dea41d Mon Sep 17 00:00:00 2001
From: Sergei Druzhkov <serzhdruzhok at gmail.com>
Date: Sat, 11 Apr 2026 00:08:43 +0300
Subject: [PATCH 3/3] Simplify code
---
lldb/include/lldb/API/SBType.h | 4 -
lldb/include/lldb/API/SBValue.h | 2 -
lldb/source/API/SBType.cpp | 16 ----
lldb/source/API/SBValue.cpp | 18 ----
.../lldb-dap/locations/TestDAP_locations.py | 94 +++++++++----------
.../API/tools/lldb-dap/locations/main.cpp | 6 +-
.../Handler/LocationsRequestHandler.cpp | 5 +-
lldb/tools/lldb-dap/JSONUtils.cpp | 6 +-
8 files changed, 53 insertions(+), 98 deletions(-)
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 234f65f4d177b..9ad3244686328 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -158,10 +158,6 @@ class SBType {
bool IsFunctionType();
- bool IsFunctionPointerType();
-
- bool IsMemberFunctionPointerType();
-
bool IsPolymorphicClass();
bool IsArrayType();
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index caa636b19b88f..d4cc2f05c39e3 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -69,8 +69,6 @@ class LLDB_API SBValue {
lldb::addr_t GetValueAsAddress();
- lldb::addr_t GetPointerValue();
-
ValueType GetValueType();
// If you call this on a newly created ValueObject, it will always return
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 065c954b97090..f58902dcf44d8 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -258,22 +258,6 @@ bool SBType::IsFunctionType() {
return m_opaque_sp->GetCompilerType(true).IsFunctionType();
}
-bool SBType::IsFunctionPointerType() {
- LLDB_INSTRUMENT_VA(this);
-
- if (!IsValid())
- return false;
- return m_opaque_sp->GetCompilerType(true).IsFunctionPointerType();
-}
-
-bool SBType::IsMemberFunctionPointerType() {
- LLDB_INSTRUMENT_VA(this);
-
- if (!IsValid())
- return false;
- return m_opaque_sp->GetCompilerType(true).IsMemberFunctionPointerType();
-}
-
bool SBType::IsPolymorphicClass() {
LLDB_INSTRUMENT_VA(this);
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 553092ef94a91..a27da7b61f8ea 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -46,7 +46,6 @@
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
#include "lldb/lldb-enumerations.h"
-#include "lldb/lldb-private-enumerations.h"
#include <memory>
@@ -818,23 +817,6 @@ lldb::addr_t SBValue::GetValueAsAddress() {
return fail_value;
}
-lldb::addr_t SBValue::GetPointerValue() {
- addr_t fail_value = LLDB_INVALID_ADDRESS;
- ValueLocker locker;
- lldb::ValueObjectSP value_sp(GetSP(locker));
- if (value_sp) {
- auto [ret_val, type] = value_sp->GetPointerValue();
- if (type != eAddressTypeLoad)
- return fail_value;
- ProcessSP process_sp = m_opaque_sp->GetProcessSP();
- if (!process_sp)
- return ret_val;
- return process_sp->FixDataAddress(ret_val);
- }
-
- return fail_value;
-}
-
bool SBValue::MightHaveChildren() {
LLDB_INSTRUMENT_VA(this);
diff --git a/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py b/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py
index 12eeeca72da37..ecb4303c6282e 100644
--- a/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py
+++ b/lldb/test/API/tools/lldb-dap/locations/TestDAP_locations.py
@@ -12,6 +12,12 @@
class TestDAP_locations(lldbdap_testcase.DAPTestCaseBase):
+ def verify_location(self, location_reference: str, filename: str, line: int):
+ response = self.dap_server.request_locations(location_reference)
+ self.assertTrue(response["success"])
+ self.assertTrue(response["body"]["source"]["path"].endswith(filename))
+ self.assertEqual(response["body"]["line"], line)
+
@skipIfWindows
def test_locations(self):
"""
@@ -30,70 +36,54 @@ def test_locations(self):
locals = {l["name"]: l for l in self.dap_server.get_local_variables()}
# var1 has a declarationLocation but no valueLocation
- self.assertIn("declarationLocationReference", locals["var1"].keys())
- self.assertNotIn("valueLocationReference", locals["var1"].keys())
- loc_var1 = self.dap_server.request_locations(
- locals["var1"]["declarationLocationReference"]
+ declaration_location_reference = locals["var1"].get(
+ "declarationLocationReference"
)
- self.assertTrue(loc_var1["success"])
- self.assertTrue(loc_var1["body"]["source"]["path"].endswith("main.cpp"))
- self.assertEqual(loc_var1["body"]["line"], 10)
+ self.assertIsNotNone(declaration_location_reference)
+ self.verify_location(declaration_location_reference, "main.cpp", 11)
+ value_location_reference = locals["var1"].get("valueLocationReference")
+ self.assertIsNone(value_location_reference)
# func_ptr has both a declaration and a valueLocation
- self.assertIn("declarationLocationReference", locals["func_ptr"].keys())
- self.assertIn("valueLocationReference", locals["func_ptr"].keys())
- decl_loc_func_ptr = self.dap_server.request_locations(
- locals["func_ptr"]["declarationLocationReference"]
- )
- self.assertTrue(decl_loc_func_ptr["success"])
- self.assertTrue(
- decl_loc_func_ptr["body"]["source"]["path"].endswith("main.cpp")
+ declaration_location_reference = locals["func_ptr"].get(
+ "declarationLocationReference"
)
- self.assertEqual(decl_loc_func_ptr["body"]["line"], 11)
- val_loc_func_ptr = self.dap_server.request_locations(
- locals["func_ptr"]["valueLocationReference"]
- )
- self.assertTrue(val_loc_func_ptr["success"])
- self.assertTrue(val_loc_func_ptr["body"]["source"]["path"].endswith("main.cpp"))
- self.assertEqual(val_loc_func_ptr["body"]["line"], 3)
+ self.assertIsNotNone(declaration_location_reference)
+ self.verify_location(declaration_location_reference, "main.cpp", 12)
+ value_location_reference = locals["func_ptr"].get("valueLocationReference")
+ self.assertIsNotNone(value_location_reference)
+ self.verify_location(value_location_reference, "main.cpp", 3)
# func_ref has both a declaration and a valueLocation
- self.assertIn("declarationLocationReference", locals["func_ref"].keys())
- self.assertIn("valueLocationReference", locals["func_ref"].keys())
- decl_loc_func_ref = self.dap_server.request_locations(
- locals["func_ref"]["declarationLocationReference"]
- )
- self.assertTrue(decl_loc_func_ref["success"])
- self.assertTrue(
- decl_loc_func_ref["body"]["source"]["path"].endswith("main.cpp")
+ declaration_location_reference = locals["func_ref"].get(
+ "declarationLocationReference"
)
- self.assertEqual(decl_loc_func_ref["body"]["line"], 12)
- val_loc_func_ref = self.dap_server.request_locations(
- locals["func_ref"]["valueLocationReference"]
- )
- self.assertTrue(val_loc_func_ref["success"])
- self.assertTrue(val_loc_func_ref["body"]["source"]["path"].endswith("main.cpp"))
- self.assertEqual(val_loc_func_ref["body"]["line"], 3)
+ self.assertIsNotNone(declaration_location_reference)
+ self.verify_location(declaration_location_reference, "main.cpp", 13)
+ value_location_reference = locals["func_ref"].get("valueLocationReference")
+ self.assertIsNotNone(value_location_reference)
+ self.verify_location(value_location_reference, "main.cpp", 3)
# member_ptr has both a declaration and a valueLocation
- self.assertIn("declarationLocationReference", locals["member_ptr"].keys())
- self.assertIn("valueLocationReference", locals["member_ptr"].keys())
- decl_loc_member_ptr = self.dap_server.request_locations(
- locals["member_ptr"]["declarationLocationReference"]
- )
- self.assertTrue(decl_loc_member_ptr["success"])
- self.assertTrue(
- decl_loc_member_ptr["body"]["source"]["path"].endswith("main.cpp")
+ declaration_location_reference = locals["member_ptr"].get(
+ "declarationLocationReference"
)
- self.assertEqual(decl_loc_member_ptr["body"]["line"], 13)
- val_loc_member_ptr = self.dap_server.request_locations(
- locals["member_ptr"]["valueLocationReference"]
+ self.assertIsNotNone(declaration_location_reference)
+ self.verify_location(declaration_location_reference, "main.cpp", 14)
+ value_location_reference = locals["member_ptr"].get("valueLocationReference")
+ self.assertIsNotNone(value_location_reference)
+ self.verify_location(value_location_reference, "main.cpp", 6)
+
+ # virtual_member_ptr has a declarationLocation but no valueLocation
+ declaration_location_reference = locals["virtual_member_ptr"].get(
+ "declarationLocationReference"
)
- self.assertTrue(val_loc_member_ptr["success"])
- self.assertTrue(
- val_loc_member_ptr["body"]["source"]["path"].endswith("main.cpp")
+ self.assertIsNotNone(declaration_location_reference)
+ self.verify_location(declaration_location_reference, "main.cpp", 15)
+ value_location_reference = locals["virtual_member_ptr"].get(
+ "valueLocationReference"
)
- self.assertEqual(val_loc_member_ptr["body"]["line"], 6)
+ self.assertIsNone(value_location_reference)
# `evaluate` responses for function pointers also have locations associated
eval_res = self.dap_server.request_evaluate("greet")
diff --git a/lldb/test/API/tools/lldb-dap/locations/main.cpp b/lldb/test/API/tools/lldb-dap/locations/main.cpp
index d5faf21eb7cb6..0df5491b959d5 100644
--- a/lldb/test/API/tools/lldb-dap/locations/main.cpp
+++ b/lldb/test/API/tools/lldb-dap/locations/main.cpp
@@ -2,14 +2,16 @@
void greet() { printf("Hello"); }
-struct test {
+struct Test {
void foo() {}
+ virtual void bar() {}
};
int main(void) {
int var1 = 1;
void (*func_ptr)() = &greet;
void (&func_ref)() = greet;
- auto member_ptr = &test::foo;
+ auto member_ptr = &Test::foo;
+ auto virtual_member_ptr = &Test::bar;
return 0; // break here
}
diff --git a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
index 4257733267b04..6a8adc408b7c6 100644
--- a/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/LocationsRequestHandler.cpp
@@ -39,7 +39,10 @@ LocationsRequestHandler::Run(const protocol::LocationsArguments &args) const {
return llvm::make_error<DAPError>(
"Value locations are only available for pointers and references");
- lldb::addr_t raw_addr = variable.GetPointerValue();
+ lldb::SBError error;
+ lldb::addr_t raw_addr = variable.GetData().GetAddress(error, 0);
+ if (error.Fail())
+ return ToError(error);
lldb::SBAddress addr = dap.target.ResolveLoadAddress(raw_addr);
lldb::SBLineEntry line_entry = GetLineEntryForAddress(dap.target, addr);
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index d3b9b23e25a71..add12313e9ff9 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -346,11 +346,11 @@ std::string VariableDescription::GetResult(protocol::EvaluateContext context) {
bool ValuePointsToCode(lldb::SBValue v) {
lldb::SBType type = v.GetType();
- if (!(type.IsFunctionPointerType() || type.IsMemberFunctionPointerType() ||
- type.GetReferenceType().IsFunctionType()))
+ if (!type.GetPointeeType().IsFunctionType())
return false;
- lldb::addr_t addr = v.GetPointerValue();
+ lldb::SBError error;
+ lldb::addr_t addr = v.GetData().GetAddress(error, 0);
lldb::SBLineEntry line_entry =
v.GetTarget().ResolveLoadAddress(addr).GetLineEntry();
More information about the lldb-commits
mailing list