[lldb] Fix member access in GetExpressionPath
This change fixes two issues in ValueObject::GetExpressionPath method:
1. Accessing members of struct references used to produce expression
paths such as "str.&str.member" (instead of the expected
"str.member"). This is fixed by assigning the flag tha the child
value is a dereference when calling Dereference() on references
and adjusting logic in expression path creation.
2. If the parent of member access is dereference, the produced
expression path was "*(ptr).member". This is incorrect, since it
dereferences the member instead of the pointer. This is fixed by
wrapping dereference expression into parenthesis, resulting with
"(*ptr).member".
Reviewed By: werat, clayborg
Differential Revision: https://reviews.llvm.org/D132734
This commit is contained in:
1 parent
b781ef890f
commit
0205aa4a02
6 files changed
+243
-56
No files matched your search
@@ -0,0 +1,34 @@
|
||||
struct StructA {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct StructB {
|
||||
int x;
|
||||
StructA &a_ref;
|
||||
StructA *&a_ptr_ref;
|
||||
};
|
||||
|
||||
struct StructC : public StructB {
|
||||
int y;
|
||||
|
||||
StructC(int x, StructA &a_ref, StructA *&a_ref_ptr, int y)
|
||||
: StructB{x, a_ref, a_ref_ptr}, y(y) {}
|
||||
};
|
||||
|
||||
int main() {
|
||||
StructA a{1, 2};
|
||||
StructA *a_ptr = &a;
|
||||
|
||||
StructB b{3, a, a_ptr};
|
||||
StructB *b_ptr = &b;
|
||||
StructB &b_ref = b;
|
||||
StructB *&b_ptr_ref = b_ptr;
|
||||
|
||||
StructC c(4, a, a_ptr, 5);
|
||||
StructC *c_ptr = &c;
|
||||
StructC &c_ref = c;
|
||||
StructC *&c_ptr_ref = c_ptr;
|
||||
|
||||
return 0; // Set breakpoint here
|
||||
}
|
||||
Reference in new issue
Block a user