[Lldb-commits] [PATCH] Add a new command "frame dump" to dump the current stack frame displaying sp and fp registers.

jingham at apple.com jingham at apple.com
Wed Jul 23 11:32:47 PDT 2014


This seems like a useful command, but I don't think the implementation is right. Obviously you need to fix the indenting, having the address after the sp> and fp> not line up with the other memory entries makes this hard to read.  But that's pretty trivial.

More importantly, it looks like you are just hand-coding the memory dump rather than using lldb's memory dumping code, which handles different output formats and the like.  After all, this is just a fancy version of "memory read" so it should support all the same options that does, and use the same code.  Please take a look at how that command works, and copy it.  Also look at how the option group for memory options work.  Your command should adopt that, so that these formatting options are available to users of the command.

It would be great if we could think of a better name than dump, maybe "show-memory"?  Dump is not very descriptive.  Greg's suggestion was to have this be "memory read --frame" which would dump the memory from the currently selected frame.  I actually think it's clearer as a part of the frame hierarchy, but don't have a strong feeling either way.

Also, I'm not sure showing the frame header in this case helps much, I think it makes the memory dump harder to see.  But I don't feel very strongly about that.

Thanks for the submission.  This does seem like a good addition, and if you use the facilities for memory display available in lldb, you can make it more flexible and consistent with the other commands that do the same sort of thing.

Jim


> On Jul 23, 2014, at 9:44 AM, Deepak Panickal <deepak2427 at gmail.com> wrote:
> 
> (lldb) help frame dump    
>   Dump the current stack frame
> 
> Syntax: frame dump
> 
> (lldb) frame dump   
> frame #0: 0x000050dc hello`foo + 4 at hello.c:10
>      0x041100e0: 1f 1f 1f 1f 
>      0x041100e4: 1f 1f 1f 1f 
> sp>0x041100e8: ef be be ba 
>      0x041100ec: ef be be ba 
> fp> 0x041100f0: 28 01 11 04 
>      0x041100f4: 1c 51 00 00   hello`main + 40 at hello.c:17
>      0x041100f8: ef be be ba 
> (lldb)
> 
> http://reviews.llvm.org/D4640
> 
> Files:
>  source/Commands/CommandObjectFrame.cpp
>  source/Commands/CommandObjectRegister.cpp
> <D4640.11812.patch>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list