Files
clang-p2996/lldb/test/API/tools/lldb-dap/locations/main.cpp
Adrian Vogelsgesang 9f8ae7844d [lldb-dap] Implement value locations for function pointers (#104589)
This commit adds `valueLocationReference` to function pointers and
function references. Thereby, users can navigate directly to the
pointed-to function from within the "variables" pane.

In general, it would be useful to also a add similar location references
also to member function pointers, `std::source_location`,
`std::function`, and many more. Doing so would require extending the
formatters to provide such a source code location.

There were two RFCs about this a while ago:

https://discourse.llvm.org/t/rfc-extending-formatters-with-a-source-code-reference/68375
https://discourse.llvm.org/t/rfc-sbvalue-metadata-provider/68377/26

However, both RFCs ended without a conclusion. As such, this commit now
implements the lowest-hanging fruit, i.e. function pointers. If people
find it useful, I will revive the RFC afterwards.
2024-10-11 03:31:26 +02:00

11 lines
176 B
C++

#include <cstdio>
void greet() { printf("Hello"); }
int main(void) {
int var1 = 1;
void (*func_ptr)() = &greet;
void (&func_ref)() = greet;
return 0; // break here
}