Loading ...
Sorry, an error occurred while loading the content.

Debugger Problem

Expand Messages
  • Stephen Prater
    I m trying to debug a vimscript. Alright, I m trying to debug ANY vimscript. I can run debug call MyFunction() or debug :MyCommand And the next line that I
    Message 1 of 3 , Aug 12, 2011
    • 0 Attachment
      I'm trying to debug a vimscript. Alright, I'm trying to debug ANY
      vimscript.

      I can run
      debug call MyFunction()
      or
      debug :MyCommand

      And the next line that I see is always
      line 1: let cmd=getcmdline()

      No matter what commands I enter this is all I ever see. I cannot
      continue, I cannot next. In fact, in order to get out of the
      debugger, I generally have to quit Vim and restart it.

      Clearly I am doing something horribly, horribly wrong, but I have no
      idea what. Any help is greatly appreciated.

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Tony Mechelynck
      ... The Vim debugger should give you a prompt after displaying the command which is about to be executed. At that point, you can use any Vim command (such as
      Message 2 of 3 , Aug 12, 2011
      • 0 Attachment
        On 12/08/11 18:14, Stephen Prater wrote:
        > I'm trying to debug a vimscript. Alright, I'm trying to debug ANY
        > vimscript.
        >
        > I can run
        > debug call MyFunction()
        > or
        > debug :MyCommand
        >
        > And the next line that I see is always
        > line 1: let cmd=getcmdline()
        >
        > No matter what commands I enter this is all I ever see. I cannot
        > continue, I cannot next. In fact, in order to get out of the
        > debugger, I generally have to quit Vim and restart it.
        >
        > Clearly I am doing something horribly, horribly wrong, but I have no
        > idea what. Any help is greatly appreciated.
        >

        The Vim debugger should give you a > prompt after displaying the command
        which is about to be executed. At that point, you can use any Vim
        command (such as :echo) to view the current values of variables etc
        (except, I suppose, script-local variables). A colon is not required
        unless you need to avoid ambiguity with one of the debug commands listed
        below. Then you can give any of the following "debug-mode commands" with
        *no* prefix (not even a colon) at the > prompt. The first letter is
        enough, or you may type the full command:

        cont
        continue; don't stop unless a breakpoint is hit.

        quit
        quit Vim. Some breakpoints may be hit, some closedown
        actions may be run.

        next
        execute one command and come back to the > prompt.
        This doesn't stop inside functions and sourced scripts.

        step
        execute one command and come back to the > prompt.
        If a function call is encountered, or a script sourced,
        this stops at the first line inside the function or
        script.

        interrupt
        don't continue the current command (as with Ctrl-C)
        but come back to debug mode immediately afterwards

        finish
        continue to the end of the current function or script
        then come back to debug mode on return to the caller

        After a debug command has been given, hitting just <Enter> at the next >
        prompt will repeat the same debug command.

        For details, see ":help debug-scripts" and the full section 5 of that
        helpfile.


        Best regards,
        Tony.
        --
        Tertullian was born in Carthage somewhere about 160 A.D. He was a
        pagan, and he abandoned himself to the lascivious life of his city
        until about his 35th year, when he became a Christian .... To him is
        ascribed the sublime confession: Credo quia absurdum est (I believe
        because it is absurd). This does not altogether accord with historical
        fact, for he merely said:

        "And the Son of God died, which is immediately credible because
        it is absurd. And buried he rose again, which is certain
        because it is impossible."

        Thanks to the acuteness of his mind, he saw through the poverty of
        philosophical and Gnostic knowledge, and contemptuously rejected it.
        -- C. G. Jung, in Psychological Types

        (Tertullian was one of the founders of the Catholic Church).

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Andy Wokula
        ... Looks like the Enter-key has been remapped for Cmdline mode (you can check with ... ), and the right-hand-side contains some Ex-commands. Now when pressing
        Message 3 of 3 , Sep 1, 2011
        • 0 Attachment
          Am 12.08.2011 18:14, schrieb Stephen Prater:
          > I'm trying to debug a vimscript. Alright, I'm trying to debug ANY
          > vimscript.
          >
          > I can run
          > debug call MyFunction()
          > or
          > debug :MyCommand
          >
          > And the next line that I see is always
          > line 1: let cmd=getcmdline()
          >
          > No matter what commands I enter this is all I ever see. I cannot
          > continue, I cannot next. In fact, in order to get out of the
          > debugger, I generally have to quit Vim and restart it.
          >
          > Clearly I am doing something horribly, horribly wrong, but I have no
          > idea what. Any help is greatly appreciated.

          Looks like the Enter-key has been remapped for Cmdline mode (you can
          check with
          :cmap <CR>
          ), and the right-hand-side contains some Ex-commands.

          Now when pressing Enter while debugging, you will get into recursion,
          because debug mode also tries to debug "Enter" itself.

          Usually what works in that case is to press CTRL-J instead.
          (if this is too hard to remember, just do
          :cunmap <CR>|cunmap <buffer> <CR>
          beforehand :-)

          --
          Andy

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        Your message has been successfully submitted and would be delivered to recipients shortly.