[Lldb-commits] vim-lldb patches
Arthur Evstifeev
ap4y at me.com
Thu May 23 14:28:38 PDT 2013
Hi Daniel, sorry that I forgot about help page. I fixed that, sending you
updated patch. Thanks!
On 05/23, Malea, Daniel wrote:
> Hi Arthur, thanks for the new functionality; I will try it out today and
> let you know how it goes!
>
> Do you mind also adding a few words in utils/vim-lldb/doc/lldb.txt for the
> new commands? I like to keep the help page in sync :)
>
>
> Cheers,
> Dan
>
> On 2013-05-22 6:57 PM, "Arthur Evstifeev" <ap4y at me.com> wrote:
>
> >Hi Daniel,
> >
> >Thanks for the response and accepting patches. I have implemented couple
> >small additions that we discussed:
> >
> >1. Added new :Lpo command
> >2. :Lpo and :Lprint can be invoked without parameters. In that case
> >cursor word will be used
> >3. Added :LpO command in that case instead of <cword> will be used
> >stripped <cWORD>. This command is useful for printing objective-c
> >properties (for ex.: self.tableView). I think alternative :Lprint
> >command with cWORD will be useful too (for structs and cpp accessors),
> >but couldn't come up with meaningful alias.
> >
> >Thanks again!
> >
> >On 05/22, Malea, Daniel wrote:
> >> Sweet! I'm glad it's working out for you. I committed your improvements
> >>in
> >> 182483 and 182484!
> >>
> >> I'm not too familiar with Objective-C but anything that helps out with
> >> that is that is welcome. Are you thinking of adding a ":Lpo" option?
> >>
> >> As for the :Lprint under cursor thing, I've been meaning to implement
> >> something like that myself but have not gotten around to it. If you have
> >> improvements, please send patches and I will commit post haste!
> >>
> >>
> >> Cheers,
> >> Dan
> >>
> >> On 2013-05-21 10:47 PM, "Arthur Evstifeev" <ap4y at me.com> wrote:
> >>
> >> >Hi Daniel,
> >> >
> >> >Thanks for the lldb plugin, this plugin is so helpful for me. I
> >> >have missed couple function though, so I implemented them and want to
> >> >contribute them.
> >> >
> >> >I'm using this plugin for iOS development. Since such apps only work
> >> >under simulator process, current target-centric plugin architecture
> >> >doesn't fit well. I added attach and detach operations, that
> >> >don't require target instance (empty target will be created during
> >> >attach).
> >> >
> >> >Also I found myself several time in situation when I wanted to close
> >> >plugin panes, but it's really hard to restore them all at once. So I
> >> >allowed to invoke Lshow without parameters. In that case all panes will
> >> >be restored.
> >> >
> >> >I wanted to ask what do you think about adding additional objective-c
> >> >specific printing command ("po", which is alias to "expression -o")?
> >>This
> >> >is
> >> >a most used command for objective-c developers. Also I found very
> >> >useful macro for :Lprint word under cursor. What do you think about
> >>this
> >> >additions? I can send patches for this operations too.
> >> >
> >> >Thanks,
> >> >Arthur
> >>
>
-------------- next part --------------
>From 5e808e8ca59debdf4fdff9ec007a9e696109604d Mon Sep 17 00:00:00 2001
From: ap4y <lod at pisem.net>
Date: Thu, 23 May 2013 10:41:27 +1200
Subject: [PATCH] - Added plugin alias for lldb po command - All print
commands can be used without parameter cursor word will be
used - Added LpO alias for Lpo with cWORD
---
utils/vim-lldb/doc/lldb.txt | 11 +++++++++--
utils/vim-lldb/plugin/lldb.vim | 15 ++++++++++++++-
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/utils/vim-lldb/doc/lldb.txt b/utils/vim-lldb/doc/lldb.txt
index e380197..e54e6f2 100644
--- a/utils/vim-lldb/doc/lldb.txt
+++ b/utils/vim-lldb/doc/lldb.txt
@@ -37,10 +37,10 @@ Possible window name arguments to the Lhide and Lshow commands include:
* locals
* registers
* threads
- lldb-:Lattach
+ *lldb-:Lattach*
:Lattach <process-name> Attach to a process by name.
- lldb-:Ldetach
+ *lldb-:Ldetach*
:Ldetach Detach from the current process.
*lldb-:Ltarget*
@@ -90,6 +90,13 @@ Possible window name arguments to the Lhide and Lshow commands include:
command is invoked. If no arguments are provided,
a breakpoint at the location under the cursor.
+ *lldb-:Lprint*
+ *lldb-:Lpo*
+ *lldb-:LpO*
+:Lprint <expr> Aliases to the lldb print and po commands. Cursor
+:Lpo <expr> word (cursor WORD for LpO) will be used when
+:LpO <expr> expression omitted.
+
MAPPINGS *lldb-mappings*
On Mac OS X (under MacVim) , the following key mappings are available:
diff --git a/utils/vim-lldb/plugin/lldb.vim b/utils/vim-lldb/plugin/lldb.vim
index e4a248c..ac5cfe3 100644
--- a/utils/vim-lldb/plugin/lldb.vim
+++ b/utils/vim-lldb/plugin/lldb.vim
@@ -82,7 +82,9 @@ function! s:InitLldbPlugin()
command -complete=custom,s:CompleteCommand -nargs=* Lwatchpoint python ctrl.doCommand('watchpoint', '<args>')
" Convenience (shortcut) LLDB commands
- command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', '<args>')
+ command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', vim.eval("s:CursorWord('<args>')"))
+ command -complete=custom,s:CompleteCommand -nargs=* Lpo python ctrl.doCommand('po', vim.eval("s:CursorWord('<args>')"))
+ command -complete=custom,s:CompleteCommand -nargs=* LpO python ctrl.doCommand('po', vim.eval("s:CursorWORD('<args>')"))
command -complete=custom,s:CompleteCommand -nargs=* Lbt python ctrl.doCommand('bt', '<args>')
" Frame/Thread-Selection (commands that also do an Uupdate but do not
@@ -135,4 +137,15 @@ returnCompleteWindow(a, l, p)
EOF
endfunction()
+" Returns cword if search term is empty
+function! s:CursorWord(term)
+ return empty(a:term) ? expand('<cword>') : a:term
+endfunction()
+
+" Returns cleaned cWORD if search term is empty
+function! s:CursorWORD(term)
+ " Will strip all non-alphabetic characters from both sides
+ return empty(a:term) ? substitute(expand('<cWORD>'), '^\A*\(.\{-}\)\A*$', '\1', '') : a:term
+endfunction()
+
call s:InitLldbPlugin()
--
1.7.12.4 (Apple Git-37)
More information about the lldb-commits
mailing list