[Lldb-commits] [PATCH] D145276: [lldb] Let 'v' command directly access ivars of _any_ self/this

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 6 12:31:11 PST 2023


kastiglione created this revision.
Herald added a subscriber: ChuanqiXu.
Herald added a project: All.
kastiglione updated this revision to Diff 502753.
kastiglione added a comment.
kastiglione edited the summary of this revision.
kastiglione added reviewers: aprantl, Michael137, jingham.
kastiglione published this revision for review.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add tests; rebase


The `v` (`frame variable`) command can access ivars/fields of `this` or `self`. This
change relaxes the criteria for finding `this`/`self`.

There are cases where a `this`/`self` variable does exist, but are cases in which `v` did not
support direct access of ivars -- meaning the user would have to type `this->field` or
`self->_ivar` to access. This change allows those cases to also work without explicitly
dereferencing `this`/`self`.

For example:

  __weak Type *weakSelf = self;
  void (^block)() = ^{
     Type *self = weakSelf; // Re-establish strong reference.
     // ...
  };

In this case, `self` exists but `v` wouldn't use it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145276

Files:
  lldb/include/lldb/Symbol/CompilerDeclContext.h
  lldb/include/lldb/Symbol/SymbolContext.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerDeclContext.cpp
  lldb/source/Symbol/SymbolContext.cpp
  lldb/source/Target/StackFrame.cpp
  lldb/test/API/commands/frame/var/direct-ivar/objc/Makefile
  lldb/test/API/commands/frame/var/direct-ivar/objc/TestFrameVarDirectIvarObjC.py
  lldb/test/API/commands/frame/var/direct-ivar/objc/main.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145276.502753.patch
Type: text/x-patch
Size: 14652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230306/dbf7b564/attachment-0001.bin>


More information about the lldb-commits mailing list