[Bug 49946] New: python SBTarget.EvaluateExpression cannot call selectors prefixed with underscore

Bug ID 49946
Summary python SBTarget.EvaluateExpression cannot call selectors prefixed with underscore
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter matan1008@gmail.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org

to whom it may concern,
I am using the official LLDB python api in the project hilda
([https://github.com/doronz88/hilda](https://github.com/doronz88/hilda)).
When trying to evaluate an expression in MobileSafari process I noticed that
evaluating methods prefixed with underscore has unexpected behavior.

My code was:

options = lldb.SBExpressionOptions()
options.SetIgnoreBreakpoints(True)
options.SetTryAllThreads(True)
e = target.EvaluateExpression('[NSUserDefaults _sf_safariDefaults]')
e.error.Success() # This one turns as False

When printing str(e.error) I see:
error: <user expression 15>:1:17: no known method '+_sf_safariDefaults'; cast
the message send to the method's return type

It seems that for some reason, LLDB added '+' before the _sf_safariDefaults.

Also, I tried running from the LLDB command line with 'expr -o' and it worked
well, so I think the problem might be somewhere in the API.

I would really like your help solving this problem.
Thanks for dedicating time!
Matan.