4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

awsのvimでリモートデバックできるようにした

Last updated at Posted at 2014-09-26

vimでリモートデバックをできるようにしたときのメモ

環境

$cat /proc/version
Linux version 3.4.76-65.111.amzn1.x86_64 (mockbuild@gobi-build-31004)
 (gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #1 SMP Tue Jan 14 21:06:49 UTC 2014
$vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 26 2014 08:33:01)
Huge version without GUI. 

xdebug, vdebug, chromeツール

ほぼこちら参照
Vim + Vdebug + Xdebug でPHPのリモートデバッグ

$pecl install xdebug
vim.rcに下記をいれ、:NeoBundleInstall
NeoBundle 'joonty/vdebug'
$find / -name "xdebug"*
xdebugは下記にインストール
/usr/lib64/php/modules/xdebug.so
/etc/php.d/xdebug.iniを作って下記を入れる
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

chromeにXdebug Helperを入れる
https://chrome.google.com/webstore/search/Xdebug%20helper

はまった

これで、準備完了のはずが、
vimを開いてF5を押してもまったく何も起きない。。

:help vdebugを行う

TroubleShootingに下記の記載あり。

If you have any questions or problems that aren't addressed or fixed here then
feel free to raise an issue on the Github page https://github.com/joonty/vdebug
or email me at <jon AT joncairns.com>. If the question is good I might even add
it to this list.

    Q. I can't get the debugger to run! Pressing <F5> does nothing.
    A. The most common reason for this is that your VIM installation is not
       compiled with Python support. To check this, run "vim --version" and check
       for any mention of Python. If it is compiled with Python support, try
       remapping the start key to something else, e.g:
        :let g:vdebug_keymap['run'] = '<C-s>'

ようするにvimにpythonがサポートされてない????

調べ方は下記。

# vim --version | grep python
+cryptv          +linebreak       -python          +viminfo
+cscope          +lispindent      -python3         +vreplace

python が- <=これがだめだった。

解決

解決方法はそのまんまこちらを参照
CentOSで最新ソースからvimをインストール

$ yum -y install gcc make ncurse-devel
$ yum -y install mercurial
$ yum -y install perl-devel perl-ExtUtils-Embed
$ yum -y install ruby-devel
$ yum -y install python-devel

$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim/src
$ ./configure \
--with-features=huge \
--disable-gui \
--without-x \
--disable-gpm \
--disable-nls \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--enable-perlinterp \
--enable-cscope
$ make
$ sudo make install
# vim --version | grep python
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace

python が+

その後

今度こそvimでF5を押すと、

Waiting for a connection (Ctrl-C to cancel, this message will self-destruct in 20 seconds...)

が出た!

vimでF5を押した状態で、google-chromeのDebugを有効にして、該当ページにアクセスすると、リモートデバックができた

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?