简体   繁体   中英

Evaluate Expression LLDB Python C++ Type Formatter

I'm trying to make an lldb custom type formatter for a variant type, but I can't seem to call a query member function on the value to format. I have a size_t member called typeIndex, that can be gotten by calling index(). I can get the value by getting it directly through the get child member with name, but I can't seem to call the index() function which directly returns that value. What do I have to do to call a function on the type being formatted?

def format_variant(valobj, internal_dict):
    a = valobj.GetChildMemberWithName("typeIndex").GetValueAsUnsigned()
    b = valobj.EvaluateExpression(".index()").GetValueAsUnsigned()
    
    print(a)
    print(b)

b always results in no value, a is fine.

You want to eval "index()" instead of ".index()"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM