Skip to content

Instantly share code, notes, and snippets.

@IngoMeyer441
Created March 11, 2018 16:38
Show Gist options
  • Save IngoMeyer441/23f8585633defa4742cd2657d2d9cc7f to your computer and use it in GitHub Desktop.
Save IngoMeyer441/23f8585633defa4742cd2657d2d9cc7f to your computer and use it in GitHub Desktop.
Dockerfile for vim-vebugger testing with LLDB
FROM debian:unstable
LABEL maintainer="Ingo Heimbach <[email protected]>"
RUN apt-get update && \
apt-get install --no-install-recommends -y automake \
build-essential \
ca-certificates \
cmake \
curl \
git \
libtool-bin \
lldb-3.9 \
pkg-config \
python-lldb-3.9 \
unzip && \
rm -rf /var/lib/apt/lists/* && \
update-alternatives --install "/usr/bin/lldb" "lldb" "/usr/bin/lldb-3.9" 1 && \
sed -i '33c_swig_python_version_info = (0, 0, 0)' /usr/lib/python2.7/dist-packages/lldb/__init__.py
WORKDIR /tmp
RUN git clone https://github.com/neovim/neovim.git && \
cd neovim && \
make CMAKE_BUILD_TYPE=Release && \
make install && \
cd .. && \
rm -rf neovim
RUN curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh && \
bash installer.sh ~/.vim/dein && \
rm -f installer.sh
RUN mkdir -p "${HOME}/.config/nvim" && \
echo 'set runtimepath^=~/.vim runtimepath+=~/.vim/after\n\
let &packpath = &runtimepath\n\
source ~/.vimrc' \
> "${HOME}/.config/nvim/init.vim" && \
echo "set nocompatible\n\
\n\
set runtimepath+=/root/.vim/dein/repos/github.com/Shougo/dein.vim\n\
if dein#load_state('/root/.vim/dein')\n\
call dein#begin('/root/.vim/dein')\n\
call dein#add('Shougo/dein.vim')\n\
call dein#add('Shougo/vimproc.vim', {\n\
\\ 'build': 'make',\n\
\\ })\n\
call dein#add('idanarye/vim-vebugger', {\n\
\\ 'rev': 'develop',\n\
\\ })\n\
call dein#end()\n\
call dein#save_state()\n\
endif\n\
\n\
filetype plugin indent on\n\
syntax enable\n\
set background=dark\n\
\n\
let g:vebugger_leader = '<leader>v'" > /root/.vimrc
RUN echo ":call dein#install()\n" > ./vim_install_plugins && \
echo '#!/bin/bash\nmake\nnvim -s /tmp/vim_install_plugins\nexec "$@"' > /tmp/entrypoint.sh && \
chmod +x /tmp/entrypoint.sh
WORKDIR /root
RUN echo "#include<stdlib.h>\n#include<stdio.h>\n\
\n\
int main(void) {\n\
int *ptr = NULL;\n\
printf(\"ptr conent: %d\", *ptr);\n\
return 0;\n\
}" > test.c && \
echo "test: test.c\n\
\t\$(CC) -o \$@ -g \$<" > Makefile
ENTRYPOINT ["/tmp/entrypoint.sh"]
CMD ["/bin/bash"]
@IngoMeyer441
Copy link
Author

IngoMeyer441 commented Mar 11, 2018

Some notes:

  1. The docker container must be run with the --privileged flag for lldb to work.
  2. After starting, neovim is run and installs vim-vebugger automatically. When finished, neovim should be reopened.
  3. A small test program with a segmentation fault in stored in ~. Start vim-vebugger with:
    VBGstartLLDB ./test
    VBGcontinue
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment