If you have the following code:
#include <stdio.h>
#include <stdint.h>
class A {
public:
static int a;
};
int A::a = 123;
int main (int argc, char const *argv[], char const *envp[])
{
puts("hello");
return A::a;
}
You can get to it using when running using the "frame variable" or "expression"
commands:
% lldb a.out
(lldb) b main
(lldb) run
(lldb) fr var A::a
(int) A::a = 123
(lldb) expression A::a
(int) $0 = 123
You can also access it when you are not running because it is a static variable
by using the "target variable" (a command that allows access to global and
static variables). Since its value is stored in the data sections:
% xcrun lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) target variable A::a
(int) A::a = 123
> On Jul 16, 2014, at 6:42 AM, Carlo Kok <[email protected]> wrote:
>
> I've explored the internal and external apis for LLDB, but I cannot find any
> way to expose (from LLVM) a static field on a class (like Java: class Test {
> public static int A = 15; }) or a constant on a class. How do I do this and
> read it out again with LLDB?
>
>
> --
> Carlo Kok
> RemObjects Software
> _______________________________________________
> lldb-dev mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev