From d69e76f136fbba64bfaad46c4136ac019afd480f Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 26 Nov 2019 21:47:40 +0000 Subject: [PATCH 01/13] Center notification popups horizontally by default --- runtime/doc/popup.txt | 6 +++++- src/popupwin.c | 2 +- src/testdir/dumps/Test_popupwin_notify_01.dump | 6 +++--- src/testdir/dumps/Test_popupwin_notify_02.dump | 12 ++++++------ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt index 463bc9a2be9bb5..88488d113ac95b 100644 --- a/runtime/doc/popup.txt +++ b/runtime/doc/popup.txt @@ -510,7 +510,7 @@ popup_notification({what}, {options}) *popup_notification()* This works like: > call popup_create({what}, #{ \ line: 1, - \ col: 10, + \ col: 0, \ minwidth: 20, \ time: 3000, \ tabpage: -1, @@ -529,6 +529,10 @@ popup_notification({what}, {options}) *popup_notification()* The position will be adjusted to avoid overlap with other notifications. + + The default position is horizontally centered at the top of + the screen. + Use {options} to change the properties. Can also be used as a |method|: > diff --git a/src/popupwin.c b/src/popupwin.c index a0d33fd0bb56fc..25eb7b1649f8fe 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -2209,7 +2209,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type) wp->w_wantline = 1; } - wp->w_wantcol = 10; + wp->w_wantcol = 0; // center horizontally wp->w_zindex = POPUPWIN_NOTIFICATION_ZINDEX; wp->w_minwidth = 20; wp->w_popup_flags |= POPF_DRAG; diff --git a/src/testdir/dumps/Test_popupwin_notify_01.dump b/src/testdir/dumps/Test_popupwin_notify_01.dump index bad62f6d9adf11..76f8a6c91e95b0 100644 --- a/src/testdir/dumps/Test_popupwin_notify_01.dump +++ b/src/testdir/dumps/Test_popupwin_notify_01.dump @@ -1,6 +1,6 @@ ->1+0&#ffffff0| @7|╔+0#e000002&|═@21|╗| +0#0000000&@41 -|2| @7|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@41 -|3| @7|╚+0#e000002&|═@21|╝| +0#0000000&@41 +>1+0&#ffffff0| @23|╔+0#e000002&|═@21|╗| +0#0000000&@25 +|2| @23|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@25 +|3| @23|╚+0#e000002&|═@21|╝| +0#0000000&@25 |4| @73 |5| @73 |6| @73 diff --git a/src/testdir/dumps/Test_popupwin_notify_02.dump b/src/testdir/dumps/Test_popupwin_notify_02.dump index 72e2895f167a4c..873c5630988a7b 100644 --- a/src/testdir/dumps/Test_popupwin_notify_02.dump +++ b/src/testdir/dumps/Test_popupwin_notify_02.dump @@ -1,9 +1,9 @@ ->1+0&#ffffff0| @7|╔+0#e000002&|═@21|╗| +0#0000000&@41 -|2| @7|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@41 -|3| @7|╚+0#e000002&|═@21|╝| +0#0000000&@41 -|4| @7|╔+0fd7ff255|═@31|╗| +0&#ffffff0@31 -|5| @7|║+0fd7ff255| |a|n|o|t|h|e|r| |i|m|p|o|r|t|a|n|t| |n|o|t|i|f|i|c|a|t|i|o|n| |║| +0&#ffffff0@31 -|6| @7|╚+0fd7ff255|═@31|╝| +0&#ffffff0@31 +>1+0&#ffffff0| @23|╔+0#e000002&|═@21|╗| +0#0000000&@25 +|2| @23|║+0#e000002&| |f|i|r|s|t| |n|o|t|i|f|i|c|a|t|i|o|n| @2|║| +0#0000000&@25 +|3| @23|╚+0#e000002&|═@21|╝| +0#0000000&@25 +|4| @18|╔+0fd7ff255|═@31|╗| +0&#ffffff0@20 +|5| @18|║+0fd7ff255| |a|n|o|t|h|e|r| |i|m|p|o|r|t|a|n|t| |n|o|t|i|f|i|c|a|t|i|o|n| |║| +0&#ffffff0@20 +|6| @18|╚+0fd7ff255|═@31|╝| +0&#ffffff0@20 |7| @73 |8| @73 |9| @73 From 9fd52899ce0502a81eb7d65ff41722406db16e24 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 25 Feb 2019 19:03:57 +0000 Subject: [PATCH 02/13] Ignore more swap files --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3a55d25b18affe..9aad1483320388 100644 --- a/.gitignore +++ b/.gitignore @@ -58,7 +58,7 @@ src/xxd/xxd.dSYM *.rej *.orig *.mo -*.swp +*.sw[a-p] *~ *.pyc *.log From b0da1c2c9048b8dbc6a95e359553b82371550abf Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 27 Apr 2019 16:32:26 +0100 Subject: [PATCH 03/13] Add scripts for building into my env including debug builds --- .vimspector.json | 88 ++++++++++++++++++++++++++++++++ .ycm_extra_conf.py | 81 ++++++++++++++++++++++++++++++ bashrc_vimenv | 5 ++ configure_vimenv | 122 +++++++++++++++++++++++++++++++++++++++++++++ make_compile_db | 8 +++ src/Makefile | 6 +++ 6 files changed, 310 insertions(+) create mode 100644 .vimspector.json create mode 100644 .ycm_extra_conf.py create mode 100644 bashrc_vimenv create mode 100755 configure_vimenv create mode 100755 make_compile_db diff --git a/.vimspector.json b/.vimspector.json new file mode 100644 index 00000000000000..b68ef88bc85226 --- /dev/null +++ b/.vimspector.json @@ -0,0 +1,88 @@ +{ + "configurations": { + "Run - clean": { + "adapter": "CodeLLDB", + "configuration": { + "request": "launch", + "program": "${workspaceRoot}/src/vim", + "args": [ "-Nu", "NONE" ], + "cwd": "${workspaceRoot}", + "env": { + "VIMRUNTIME": "${workspaceRoot}/runtime" + }, + "expressions": "native" + } + }, + "Run - with vimrc": { + "adapter": "CodeLLDB", + "configuration": { + "request": "launch", + "program": "${workspaceRoot}/src/vim", + "args": [ "-Nu", "${vimrc}" ], + "cwd": "${workspaceRoot}", + "env": { + "VIMRUNTIME": "${workspaceRoot}/runtime" + }, + "expressions": "native" + } + }, + "Run - a test": { + "adapter": "CodeLLDB", + "configuration": { + "request": "launch", + "program": "${workspaceRoot}/src/vim", + "args": [ + "-f", + "-u", "unix.vim", + "-U", "NONE", + "--noplugin", + "--not-a-term", + "-S", "runtest.vim", + "${Test}.vim" + ], + "cwd": "${workspaceRoot}/src/testdir", + "env": { + "VIMRUNTIME": "${workspaceRoot}/runtime" + }, + "expressions": "native" + } + }, + "Run - dev": { + "adapter": "CodeLLDB", + "configuration": { + "request": "launch", + "program": "${workspaceRoot}/src/vim", + "args": [ + "--cmd", "let g:benj_test_ycm=1" + ], + "cwd": "${workspaceRoot}", + "env": { + "VIMRUNTIME": "${workspaceRoot}/runtime" + }, + "expressions": "native" + } + }, + + "Attach: PID": { + "adapter": "CodeLLDB", + "configuration": { + "request": "attach", + "program": "${workspaceRoot}/src/vim", + "expressions": "native", + "stopOnEntry#json": "${StopOnEntry:true}", + "pid": "${pid}" + } + }, + + "Attach: Instance": { + "adapter": "CodeLLDB", + "configuration": { + "request": "attach", + "program": "${workspaceRoot}/src/vim", + "expressions": "native", + "stopOnEntry#json": "${StopOnEntry:true}", + "waitFor#json": "${WaitFor:false}" + } + } + } +} diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py new file mode 100644 index 00000000000000..ec4b664be2d97c --- /dev/null +++ b/.ycm_extra_conf.py @@ -0,0 +1,81 @@ +import os +import logging +import subprocess +import shlex +from ycmd import utils + +try: + from ycmd.extra_conf_support import IgnoreExtraConf +except ImportError: + IgnoreExtraConf = None + +# Map files to translation units. +file_to_tu = { + 'nbdebug.c': 'netbeans.c', + 'if_py_both.h': 'if_python3.c', + 'structs.h': 'main.c', + 'vim.h': 'main.c', +} + +# By default we just use ALL_CFLAGS, but some modules require specific flags. +tu_to_flags = { + 'gui_gtk_gresources.c': [ 'PERL_CFLAGS', 'ALL_CFLAGS' ], + 'if_lua.c': [ 'LUA_CFLAGS', 'ALL_CFLAGS' ], + 'if_perl.c': [ 'PERL_CFLAGS', 'ALL_CFLAGS' ], + 'if_perlsfio.c': [ 'PERL_CFLAGS', 'ALL_CFLAGS' ], + 'if_python3.c': [ 'PYTHON3_CFLAGS', 'PYTHON3_CFLAGS_EXTRA', 'ALL_CFLAGS' ], + 'if_python.c': [ 'PYTHON_CFLAGS', 'PYTHON_CFLAGS_EXTRA', 'ALL_CFLAGS' ], + 'if_ruby.c': [ 'RUBY_CFLAGS', 'ALL_CFLAGS' ], + 'if_tcl.c': [ 'TCL_CFLAGS', 'ALL_CFLAGS' ], + 'option.c': [ 'LUA_CFLAGS', + 'PERL_CFLAGS', + 'PYTHON_CFLAGS', + 'PYTHON3_CFLAGS', + 'RUBY_CFLAGS', + 'TCL_CFLAGS', + 'ALL_CFLAGS' ], + +} + +_logger = logging.getLogger(__name__) + + +SRC_DIR = os.path.join( os.path.dirname( os.path.abspath( __file__ ) ), + 'src' ) + +def GetMacro( m ): + return utils.ToUnicode( + subprocess.check_output( [ 'make', + '-s', + '-C', + SRC_DIR, + 'show_' + m ] ).strip() + ) + +def Settings(**kwargs): + if IgnoreExtraConf and os.path.exists( os.path.join( + os.path.dirname( os.path.abspath( __file__ ) ), 'compile_commands.json' ) ): + # Use the compilation database + raise IgnoreExtraConf() + + file_name = kwargs[ 'filename' ] + base_name = os.path.basename(file_name) + tu = (os.path.join(os.path.dirname(file_name), file_to_tu[base_name]) + if base_name in file_to_tu else file_name) + + _logger.info('Using tu %s for %s vs %s', tu, base_name, file_name) + + macros = tu_to_flags.get( os.path.basename( tu ), [ 'ALL_CFLAGS' ] ) + _logger.info( "Using macros %s for %s", + macros, + os.path.basename( tu ) ) + flags = [] + for macro in macros: + flags.extend( shlex.split( GetMacro( macro ) ) ) + + + return { + 'include_paths_relative_to_dir': os.path.dirname(tu), + 'override_filename': tu, + 'flags': flags + } diff --git a/bashrc_vimenv b/bashrc_vimenv new file mode 100644 index 00000000000000..e45b477c7d18ca --- /dev/null +++ b/bashrc_vimenv @@ -0,0 +1,5 @@ +function vimenvinit { + export PATH=$HOME/Development/vim-env/bin:${PATH} + source $HOME/Development/vim-env/bin/activate +} + diff --git a/configure_vimenv b/configure_vimenv new file mode 100755 index 00000000000000..bc16d1302aca9a --- /dev/null +++ b/configure_vimenv @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +PYTHON="--enable-python3interp" + +OPTS="--enable-rubyinterp=dynamic \ + --enable-tclinterp \ + --enable-multibyte \ + --enable-cscope" + +DEBUG_FLAGS="-g -gdwarf-4 -DDEBUG -O0 -fno-omit-frame-pointer" +SAFETY_FLAGS='-DABORT_ON_INTERNAL_ERROR -DEXITFREE' +LD=lld + +export CFLAGS="${CFLAGS} -isystem /usr/local/include" + +BREW_TCL=1 +BREW_PYTHON=1 +ENV_SUFFIX="" +PYTHON_TYPE="" +while [[ -n "$1" ]]; do + OPT=$1 + shift + case "$OPT" in + "--help") + echo "Usage: $0 -- " + echo "" + echo "Options:" + echo " --debug" + echo " --relwithdebinfo" + echo " --asan" + echo " --ubsan" + echo " --no-brew-python" + echo " --no-brew-tcl" + echo " --debug-python" + echo " --python2" + echo " --python3" + echo " --python2-python3" + echo " --python-type " + echo " --no-python" + echo " --env3 - use vim-env3 (else use vim-env)" + echo "" + exit 0 + ;; + + "--env3") + ENV_SUFFIX=3 + ;; + "--debug") + export CFLAGS="${CFLAGS} ${DEBUG_FLAGS}" + ;; + "--relwithdebinfo") + export CFLAGS="${CFLAGS} -g -O2 -march=native" + ;; + "--develop") + export CFLAGS="${CFLAGS} ${SAFETY_FLAGS}" + ;; + "--asan") + export CFLAGS="${CFLAGS} ${DEBUG_FLAGS} ${SAFETY_FLAGS} -fsanitize=address" + export LIBS="${DEBUG_FLAGS} ${SAFETY_FLAGS} -fsanitize=address" + ;; + "--ubsan") + export CFLAGS="${CFLAGS} ${DEBUG_FLAGS} -${SAFETY_FLAGS} -fsanitize=undefined" + export LIBS="${DEBUG_FLAGS} ${SAFETY_FLAGS} -fsanitize=undefined" + ;; + "--no-brew-python") + BREW_PYTHON=0 + ;; + "--no-brew-python") + BREW_TCL=0 + ;; + "--debug-python") + export CFLAGS="${CFLAGS} -DPy_DEBUG -DPy_DEBUG_NO_PYMALLOC" + BREW_PYTHON=0 + OPTS="--enable-python3interp" + ;; + "--python2") + PYTHON="--enable-pythoninterp" + ;; + "--python3") + PYTHON="--enable-python3interp" + ;; + "--python2-python3") + PYTHON="--enable-pythoninterp --enable-python3interp" + ;; + "--python-type") + PYTHON_TYPE="=$1" + shift + ;; + "--no-python") + PYTHON="" + ;; + "--") + break + ;; + *) + echo "Unknown option $OPT" + exit 1 + ;; + esac +done + +echo "Additional args: "$@"" + +if [[ $BREW_PYTHON == 1 ]]; then + echo "Using homebrew python" + export PATH=$(brew --prefix python)/bin:${PATH} +fi + +if [[ $BREW_TCL -eq 1 ]]; then + echo "Using homebrew TCL" + export PATH=$(brew --prefix tcl-tk)/bin:${PATH} + OPTS="${OPTS} --with-tclsh=tclsh" +fi + +make distclean +./configure --prefix=/Users/ben/Development/vim-env${ENV_SUFFIX} \ + --with-features=huge \ + --enable-terminal \ + ${PYTHON}${PYTHON_TYPE} \ + ${OPTS} \ + --enable-fail-if-missing \ + "$@" diff --git a/make_compile_db b/make_compile_db new file mode 100755 index 00000000000000..35b6c0aa7480fe --- /dev/null +++ b/make_compile_db @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +pushd $(dirname $0) + make clean + make -j 16 | tee make.out + python -m compiledb -p make.out -f -d $(pwd)/src --full-path + rm -f make.out +popd diff --git a/src/Makefile b/src/Makefile index a2a63ba90010e7..b21157568ac615 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1381,6 +1381,12 @@ ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(SANITIZER_CFLAGS) $(LEAK_ ALL_IF_CFLAGS = $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) $(RUBY_CFLAGS) $(TCL_CFLAGS) ALL_IF_CFLAGS_EXTRA = $(LUA_CFLAGS_EXTRA) $(PERL_CFLAGS_EXTRA) $(PYTHON_CFLAGS_EXTRA) $(PYTHON3_CFLAGS_EXTRA) $(RUBY_CFLAGS_EXTRA) $(TCL_CFLAGS_EXTRA) +# The following rule allows printing any macro in the makefile. This is useful +# for debugging (e.g. make -s show_OBJ) and for integrations with tooling, +# e.g. to get the compile flags for an object with `make -s show_ALL_CFLAGS` +show_%: + @echo $($*) + # Exclude $CFLAGS for osdef.sh, for Mac 10.4 some flags don't work together # with "-E". OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS) From 814f3018b5d7ccd954e95f83dff3d691acb847a8 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 18 May 2019 11:23:33 +0100 Subject: [PATCH 04/13] Add simple linux docker test --- docker/linux-test/Dockerfile | 84 ++++++++++++++++++++++++++++++++++++ docker/linux-test/build | 3 ++ docker/linux-test/run | 22 ++++++++++ 3 files changed, 109 insertions(+) create mode 100644 docker/linux-test/Dockerfile create mode 100755 docker/linux-test/build create mode 100755 docker/linux-test/run diff --git a/docker/linux-test/Dockerfile b/docker/linux-test/Dockerfile new file mode 100644 index 00000000000000..7e224b5149ba39 --- /dev/null +++ b/docker/linux-test/Dockerfile @@ -0,0 +1,84 @@ +FROM ubuntu:18.04 + +## for apt to be noninteractive +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true +ENV CFLAGS -g -O0 + +RUN echo "root:Docker!" | chpasswd + +RUN apt-get update && \ + apt-get -y dist-upgrade + +# pre-seed tzdata, update package index, upgrade packages and install needed +# software +RUN echo "tzdata tzdata/Areas select Europe" > /tmp/preseed.txt; \ + echo "tzdata tzdata/Zones/Europe select London" >> /tmp/preseed.txt; \ + debconf-set-selections /tmp/preseed.txt && \ + rm -f /etc/timezone && \ + rm -f /etc/localtime && \ + apt-get install -y tzdata + +# https://github.com/pyenv/pyenv/wiki/Common-build-problems +RUN apt-get -y install build-essential \ + curl \ + gdb \ + sudo \ + python-dev \ + python3-dev \ + libffi-dev \ + ca-cacert \ + libncurses5-dev libncursesw5-dev \ + git \ + ruby-dev \ + lua5.2 \ + liblua5.2-dev \ + lua5.3 \ + liblua5.3-dev \ + tcl-dev \ + tcllib \ + libssl-dev\ + zlib1g-dev\ + libbz2-dev\ + libreadline-dev\ + libsqlite3-dev\ + wget\ + curl\ + man\ + llvm\ + libncurses5-dev\ + libncursesw5-dev\ + xz-utils\ + tk-dev\ + libffi-dev\ + liblzma-dev\ + ctags \ + python-openssl && \ + apt-get -y autoremove + +## cleanup of files from setup +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN useradd -ms /bin/bash -d /home/dev -G sudo dev && \ + echo "dev:dev" | chpasswd && \ + echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/sudo + +USER dev +WORKDIR /home/dev + +ENV HOME /home/dev +ENV PYTHON_CONFIGURE_OPTS --enable-shared + +ENV TERM screen-256color + +ENV CONF_ARGS "--enable-rubyinterp=dynamic \ + --enable-tclinterp \ + --enable-multibyte \ + --enable-cscope \ + --enable-python3interp \ + --enable-pythoninterp \ + --enable-tclinterp \ + --enable-luainterp \ + --with-features=huge \ + --enable-terminal \ + --enable-fail-if-missing" diff --git a/docker/linux-test/build b/docker/linux-test/build new file mode 100755 index 00000000000000..a78f9a5c22e3cc --- /dev/null +++ b/docker/linux-test/build @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +docker build "$@" -t puremourning:vim-test-linux . diff --git a/docker/linux-test/run b/docker/linux-test/run new file mode 100755 index 00000000000000..ac1764707ee297 --- /dev/null +++ b/docker/linux-test/run @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +if [ -z "$1" ]; then + CONTAINER="puremourning:vim-test-linux" +else + CONTAINER=$1 + shift +fi + +echo "Using container $CONTAINER" + +CMD="bash" + +if [ "$@" ];then + CMD="$@" +fi + +docker run --cap-add=SYS_PTRACE \ + --security-opt seccomp=unconfined \ + --mount src="$(pwd)/../..",target=/home/dev/vim,type=bind \ + -it ${CONTAINER} \ + $CMD From 50645854c7ab1e2a14fcd80e883dc0083feccb44 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sun, 4 Apr 2021 12:22:52 +0100 Subject: [PATCH 05/13] Allow connecting to docker instance of vim --- .vimspector.json | 50 +++++++++++++++++++++++++++++++++++++++++++ docker/linux-test/run | 1 + 2 files changed, 51 insertions(+) diff --git a/.vimspector.json b/.vimspector.json index b68ef88bc85226..4a53cd21e09928 100644 --- a/.vimspector.json +++ b/.vimspector.json @@ -83,6 +83,56 @@ "stopOnEntry#json": "${StopOnEntry:true}", "waitFor#json": "${WaitFor:false}" } + }, + "Run: Docker": { + "adapter": { + "command": [ + "${gadgetDir}/vscode-cpptools/debugAdapters/OpenDebugAD7" + ], + "name": "cppdbg", + "configuration": { + "type": "cppdbg" + }, + "launch": { + "remote": { + "container": "${ContainerID}", + "runCommand": [ + "gdbserver", + "--once", + "--no-startup-with-shell", + "0.0.0.0:${port}", + "%CMD%" + ] + }, + "delay": "1000m" + }, + "attach": { + "remote": { + "container": "${ContainerID}", + "pidCommand": [ "pgrep", "vim" ], + "attachCommand": [ + "gdbserver", + "--once", + "--attach", + "0.0.0.0:${port}", + "%PID%" + ] + } + } + }, + "variables": { + "RemoteRoot": "/home/dev/vim" + }, + "remote-cmdLine": [ "${RemoteRoot}/src/vim" ], + "remote-request": "launch", + "configuration": { + "request": "launch", + "program": "${workspaceRoot}/src/vim", + "cwd": "${workspaceRoot}", + "MIMode": "gdb", + "miDebuggerServerAddress": "127.0.0.1:${port}", + "sourceFileMap#json": "{\"${RemoteRoot}\": \"${workspaceRoot}\"}" + } } } } diff --git a/docker/linux-test/run b/docker/linux-test/run index ac1764707ee297..0add5439c8e10f 100755 --- a/docker/linux-test/run +++ b/docker/linux-test/run @@ -18,5 +18,6 @@ fi docker run --cap-add=SYS_PTRACE \ --security-opt seccomp=unconfined \ --mount src="$(pwd)/../..",target=/home/dev/vim,type=bind \ + -p 4567:4567 \ -it ${CONTAINER} \ $CMD From 4bfc99e894f2a5e7170ec4e28b952ba72a2fa1ce Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sun, 4 Apr 2021 15:43:07 +0100 Subject: [PATCH 06/13] Add lldb/lldb-server to docker image --- .vimspector.json | 2 +- docker/linux-test/Dockerfile | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.vimspector.json b/.vimspector.json index 4a53cd21e09928..1f3694fad47dd1 100644 --- a/.vimspector.json +++ b/.vimspector.json @@ -84,7 +84,7 @@ "waitFor#json": "${WaitFor:false}" } }, - "Run: Docker": { + "Run: Docker - gdbserver": { "adapter": { "command": [ "${gadgetDir}/vscode-cpptools/debugAdapters/OpenDebugAD7" diff --git a/docker/linux-test/Dockerfile b/docker/linux-test/Dockerfile index 7e224b5149ba39..a5e002a8999c23 100644 --- a/docker/linux-test/Dockerfile +++ b/docker/linux-test/Dockerfile @@ -53,9 +53,17 @@ RUN apt-get -y install build-essential \ libffi-dev\ liblzma-dev\ ctags \ + lsb-release \ + software-properties-common \ python-openssl && \ apt-get -y autoremove +## LLDB - latest +RUN bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" && \ + update-alternatives \ + --install /usr/bin/lldb lldb /usr/bin/lldb-12 10 \ + --slave /usr/bin/lldb-server lldb-server /usr/bin/lldb-server-12 + ## cleanup of files from setup RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From 3400ca6d9da94453484a6e8009e2838af3ab7477 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 18 Jun 2022 14:14:52 +0100 Subject: [PATCH 07/13] BenTools: make_compile_db use python3 as no python on macOS anymore --- make_compile_db | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make_compile_db b/make_compile_db index 35b6c0aa7480fe..5b51bc8758f89b 100755 --- a/make_compile_db +++ b/make_compile_db @@ -3,6 +3,7 @@ pushd $(dirname $0) make clean make -j 16 | tee make.out - python -m compiledb -p make.out -f -d $(pwd)/src --full-path + pip3 install --user --upgrade compiledb + python3 -m compiledb -p make.out -f -d $(pwd)/src --full-path rm -f make.out popd From 1ebe497ed9cf78bf207bab313939b63e909a6cd7 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sun, 19 Jun 2022 13:17:59 +0100 Subject: [PATCH 08/13] Add rc for using both pythons dynamically --- vimrc_python2_python3 | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 vimrc_python2_python3 diff --git a/vimrc_python2_python3 b/vimrc_python2_python3 new file mode 100644 index 00000000000000..3bec13663e0c6a --- /dev/null +++ b/vimrc_python2_python3 @@ -0,0 +1,2 @@ +set pythonthreedll=/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/Current/lib/libpython3.10.dylib +set pythondll=/Users/ben/.pyenv/versions/2.7.18/lib/libpython2.7.dylib From 4facf709a6c8df1bc743560ea43ae69537920489 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Wed, 3 Aug 2022 21:05:54 +0100 Subject: [PATCH 09/13] Vimspector: add a --clean target --- .vimspector.json | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.vimspector.json b/.vimspector.json index 1f3694fad47dd1..0c362c11f8e9fe 100644 --- a/.vimspector.json +++ b/.vimspector.json @@ -1,6 +1,19 @@ { "configurations": { - "Run - clean": { + "Run - Clean": { + "adapter": "CodeLLDB", + "configuration": { + "request": "launch", + "program": "${workspaceRoot}/src/vim", + "args": [ "--clean" ], + "cwd": "${workspaceRoot}", + "env": { + "VIMRUNTIME": "${workspaceRoot}/runtime" + }, + "expressions": "native" + } + }, + "Run - Nu NONE": { "adapter": "CodeLLDB", "configuration": { "request": "launch", From 803e27eea56a4deac6661c43e506c09f8b937f30 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 6 Aug 2022 16:56:19 +0100 Subject: [PATCH 10/13] configure_vimenv: develop mode to use asan/ubsan --- configure_vimenv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure_vimenv b/configure_vimenv index bc16d1302aca9a..2724be3a70e3f9 100755 --- a/configure_vimenv +++ b/configure_vimenv @@ -9,6 +9,7 @@ OPTS="--enable-rubyinterp=dynamic \ DEBUG_FLAGS="-g -gdwarf-4 -DDEBUG -O0 -fno-omit-frame-pointer" SAFETY_FLAGS='-DABORT_ON_INTERNAL_ERROR -DEXITFREE' +SANITISER_FLAGS='-fsanitize=address -fsanitize=undefined -fsanitize-recover=all' LD=lld export CFLAGS="${CFLAGS} -isystem /usr/local/include" @@ -52,7 +53,8 @@ while [[ -n "$1" ]]; do export CFLAGS="${CFLAGS} -g -O2 -march=native" ;; "--develop") - export CFLAGS="${CFLAGS} ${SAFETY_FLAGS}" + export CFLAGS="${CFLAGS} ${DEBUG_FLAGS} ${SAFETY_FLAGS} ${SANITISER_FLAGS}" + export LIBS="${LIBS} ${DEBUG_FLAGS} ${SAFETY_FLAGS} ${SANITISER_FLAGS}" ;; "--asan") export CFLAGS="${CFLAGS} ${DEBUG_FLAGS} ${SAFETY_FLAGS} -fsanitize=address" From 210f27488b51acb27ef45de361c7b885d1c096d0 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 8 Aug 2022 11:11:22 +0100 Subject: [PATCH 11/13] Vimspector: attach to larges pid (example) --- .vimspector.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.vimspector.json b/.vimspector.json index 0c362c11f8e9fe..c7256b2e952eeb 100644 --- a/.vimspector.json +++ b/.vimspector.json @@ -76,6 +76,26 @@ } }, + "Attach: max PID": { + "adapter": "CodeLLDB", + "variables": { + "pid": { + "shell": [ + "/bin/bash", + "-c", + "pgrep vim | sort | tail -1" + ] + } + }, + "configuration": { + "request": "attach", + "program": "${workspaceRoot}/src/vim", + "expressions": "native", + "stopOnEntry#json": "${StopOnEntry:true}", + "pid": "${pid}" + } + }, + "Attach: PID": { "adapter": "CodeLLDB", "configuration": { From 58378f3e5f36b2c68109253f897b19d4f3e4489d Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 11 Aug 2022 21:51:41 +0100 Subject: [PATCH 12/13] -march=native doesn't work on arm --- configure_vimenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure_vimenv b/configure_vimenv index 2724be3a70e3f9..8e94345725c23b 100755 --- a/configure_vimenv +++ b/configure_vimenv @@ -50,7 +50,7 @@ while [[ -n "$1" ]]; do export CFLAGS="${CFLAGS} ${DEBUG_FLAGS}" ;; "--relwithdebinfo") - export CFLAGS="${CFLAGS} -g -O2 -march=native" + export CFLAGS="${CFLAGS} -g -O2" ;; "--develop") export CFLAGS="${CFLAGS} ${DEBUG_FLAGS} ${SAFETY_FLAGS} ${SANITISER_FLAGS}" From 59790739d6fb04d54aef05f15e946e22218aeeae Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Sat, 20 Aug 2022 12:37:06 +0100 Subject: [PATCH 13/13] configure_vimenv: use -Og for relwithdebinfo --- configure_vimenv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure_vimenv b/configure_vimenv index 8e94345725c23b..577fe5da85c3b8 100755 --- a/configure_vimenv +++ b/configure_vimenv @@ -50,7 +50,7 @@ while [[ -n "$1" ]]; do export CFLAGS="${CFLAGS} ${DEBUG_FLAGS}" ;; "--relwithdebinfo") - export CFLAGS="${CFLAGS} -g -O2" + export CFLAGS="${CFLAGS} -g -Og" ;; "--develop") export CFLAGS="${CFLAGS} ${DEBUG_FLAGS} ${SAFETY_FLAGS} ${SANITISER_FLAGS}"