[lldb-dev] Interactive commands in LLDB

jingham at apple.com jingham at apple.com
Wed Feb 25 18:36:20 PST 2015


I haven't used the gdb "explore".  It does seem a little odd to me, like something that is well modeled by a turn-down GUI variable display but not so much by this kind of question & answer session.  But I haven't used it so I can't say.

OTOH, I do have other uses for a slightly more advanced interactive IO handler.  For instance, it you do "process attach -n" and there are multiple processes with the same name, we show you a nice little listing of the processes and their arguments so you can figure out which PID you actually want to attach to.  But it would be nicer to say "here are these five processes, type the index of the one you want to attach to."  Maybe you could also have "show me more about process 3" which could dump a more verbose output, and then you would decide to attach to 3...

Jim


> On Feb 25, 2015, at 6:30 PM, Zachary Turner <zturner at google.com> wrote:
> 
> I know you answered this briefly on IRC, but i had to run so I didn't have time to ask for clarification. What is the benefit of this approach over a stateful command similar to git bisect? I know you said something about exploring very large types, but I didn't quite follow why this approach lends itself better.
> 
> There are a number of advantages of the stateful approach. One is that you can run arbitrary commands between stages of the traversal. Maybe you see a pointer whose value is a module load address , and you want to dump info about the module loaded at that address. 
> 
> It also provides more flexibility even in the exploration process. If a field is a void* for example, an interactive command might be forced to give up, whereas a stateful non interactive command may be able to be forced into treating it as a specific type through a cast expression. It seems like the number of times you would know more than the type information lets on might warrant the additional flexibility.
> 
> It might also be difficult to test an interactive command. Would the command callback into python? Seems difficult.
> 
> Anyways, these are just ideas. I do like the general idea of a command that explores type hierarchies this way
> On Wed, Feb 25, 2015 at 6:11 PM Siva Chandra <sivachandra at google.com> wrote:
> Hello,
> 
> This is more like a question through a proposal on how to add
> interactive commands to LLDB.
> 
> By an interactive command, I mean that when one runs the command, it
> asks for more input from the user. AFAICT, there is no way currently
> to do that in LLDB. There is an IOHandlerConfirm which can be used to
> get a yes/no response from the user, but what I am looking for is
> something which can read in "richer" inputs. Could we extend
> IOHandlerConfirm as follows:
> 
> 1. Rename IOHandlerConfirm to IOHandlerUserResponse
> 2. To support the existing use case of "confirm", add two methods,
> UserResponseIsYes and UserResponseIsNo to it.
> 3. Make its GetResponse method return the raw user input.
> 4. Add few convenience methods to it like GetResponseAsUint8,
> GetResponseAsString etc.
> 
> The above is a big picture idea; there could be a few details to
> resolve when getting down to implementation. My motivation to require
> a facility like this is to implement something like the "explore"
> command of GDB:
> https://sourceware.org/gdb/current/onlinedocs/gdb/Data.html.
> 
> Thanks,
> Siva Chandra
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list