Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide runtime support values such as clang's __vla_expr from frame var…
…iable by respecting the "artificial" attribute on variables. Function arguments that are artificial and useful to end-users are being whitelisted by the language runtime. <rdar://problem/45322477> Differential Revision: https://reviews.llvm.org/D61451 llvm-svn: 359841
- Loading branch information
1 parent
a85a832
commit c19d7fb
Showing
10 changed files
with
146 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
lldb/packages/Python/lldbsuite/test/lang/objcxx/hide-runtime-values/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
LEVEL = ../../../make | ||
|
||
OBJCXX_SOURCES := main.mm | ||
LDFLAGS = $(CFLAGS) -lobjc -framework Foundation | ||
|
||
include $(LEVEL)/Makefile.rules |
47 changes: 47 additions & 0 deletions
47
...ages/Python/lldbsuite/test/lang/objcxx/hide-runtime-values/TestObjCXXHideRuntimeValues.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import lldb | ||
from lldbsuite.test.lldbtest import * | ||
from lldbsuite.test.decorators import * | ||
import lldbsuite.test.lldbutil as lldbutil | ||
import os | ||
import unittest2 | ||
|
||
|
||
class TestObjCXXHideRuntimeSupportValues(TestBase): | ||
|
||
mydir = TestBase.compute_mydir(__file__) | ||
|
||
def setUp(self): | ||
TestBase.setUp(self) | ||
|
||
def test_hide_runtime_support_values(self): | ||
self.build() | ||
_, process, _, _ = lldbutil.run_to_source_breakpoint( | ||
self, 'break here', lldb.SBFileSpec('main.mm')) | ||
|
||
var_opts = lldb.SBVariablesOptions() | ||
var_opts.SetIncludeArguments(True) | ||
var_opts.SetIncludeLocals(True) | ||
var_opts.SetInScopeOnly(True) | ||
var_opts.SetIncludeStatics(False) | ||
var_opts.SetIncludeRuntimeSupportValues(False) | ||
var_opts.SetUseDynamic(lldb.eDynamicCanRunTarget) | ||
values = self.frame().GetVariables(var_opts) | ||
|
||
def shows_var(name): | ||
for value in values: | ||
if value.name == name: | ||
return True | ||
return False | ||
# ObjC method. | ||
values = self.frame().GetVariables(var_opts) | ||
self.assertFalse(shows_var("this")) | ||
self.assertTrue(shows_var("self")) | ||
self.assertTrue(shows_var("_cmd")) | ||
self.assertTrue(shows_var("c")) | ||
|
||
process.Continue() | ||
# C++ method. | ||
values = self.frame().GetVariables(var_opts) | ||
self.assertTrue(shows_var("this")) | ||
self.assertFalse(shows_var("self")) | ||
self.assertFalse(shows_var("_cmd")) |
28 changes: 28 additions & 0 deletions
28
lldb/packages/Python/lldbsuite/test/lang/objcxx/hide-runtime-values/main.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
void baz() {} | ||
|
||
struct MyClass { | ||
void bar() { | ||
baz(); // break here | ||
} | ||
}; | ||
|
||
@interface MyObject : NSObject {} | ||
- (void)foo; | ||
@end | ||
|
||
@implementation MyObject | ||
- (void)foo { | ||
MyClass c; | ||
c.bar(); // break here | ||
} | ||
@end | ||
|
||
int main (int argc, char const *argv[]) { | ||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | ||
id obj = [MyObject new]; | ||
[obj foo]; | ||
[pool release]; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters