[Lldb-commits] [lldb-dev] PTYPE replacement in LLDB

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 12 12:24:56 PDT 2017


The original plan was to add a "type eval" to go alongside "type lookup".  "type eval" would take an expression, evaluate it, and then print the resulting type.  gdb's type takes either a type name or an expression, but there's no way to disambiguate if you have a type that has the same name as a local variable, so I'm more inclined to make them separate commands or use options.

Note, gdb also has "whatis" which doesn't do any evaluation, just looks up the argument asa name.  That is pretty much the --variable option that Greg suggests.  That could be done either by having "type eval" first try local vars and then evaluate the expression or by having an explicit "--vars" flag.

Jim



> On Sep 12, 2017, at 11:21 AM, Greg Clayton via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> 
>> On Sep 11, 2017, at 10:10 PM, vignesh balu via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> 
>> Hi All,
>> 
>> I see in the command Mapping Documnet, we can use "image lookup -type" in place of "ptype" from gdb. Currently, this can be used only for Type(link int, char) , or gloal, static variable or function symbol.
> 
> Another option is:
> 
> (lldb) type lookup
>> 
>> This is not as efficient as GDB, where it  will whole structure if we point to variable.
>> Here we have to find the variable type first and then we have to do "image lookup".
>> 
>> do we have a single command which will do that ?
> 
> Not at the moment. 
> 
>> If not, shall we implement one or integrating with one of existing command is good ?
> 
> The question is where does it belong? We could add it in one of two places as far as I see:
> 
> (lldb) frame variable --type my_var [my_var2]
> 
> The "--type" option (no arguments for the option) would indicate we want to dump the types of any variable names listed as arguments to the command.
> 
> (lldb) type lookup --variable my_var --variable my_var2
> 
> where "--variable <VARNAME>" means to look at the type of a variable.
> 
> I think both would be useful as they would be easy to add.
> 
> Please let me know if anyone has any other ideas.
> 
> BTW: it would be easy to add this as a python command for now until we get this into lldb.
> 
>> 
>> thanks,
>> vigneshbalu
>> 
>> 
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list