Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding overrides support for Command-T. #3

Closed
wants to merge 2 commits into from

Conversation

jhuttner
Copy link

Hey Wincent,

Joseph Huttner here; we communicated some over e-mail and your site's support forums. Cutting to the chase, I took your advice from the thread and incorporated it into this pull request I am sending you.

https://wincent.com/issues/1710

To use the functionality, create a .command-t.yaml file in the dir where you launch VIM, and use the following syntax:

overrides: {
  a : path/to/some/file.php,
  b : path/to/another/file.php,
  cto : .command-t.yaml
} 

@wincent
Copy link
Owner

wincent commented Oct 25, 2010

One other suggestion; the read_overrides method probably needs a rescue section (don't want to break Command-T if the overrides file is unreadable or corrupt).

@jhuttner
Copy link
Author

Good point, Wincent. I will add that.

wincent added a commit that referenced this pull request Jul 4, 2022
So I can see backtraces on Arch:

    yay -S gdb

Core dump files get written to `/var/lib/systemd/coredump/`, owned as
root, and zstd-compressed, so to read them, you have to do something
like:

    # unzstd /var/lib/systemd/coredump/core.nvim.1000.008a013d9f0d4e769d9dbcfdd9d9584a.13538.1656944479000000.std
    # chmod 666 /var/lib/systemd/coredump/core.nvim.1000.008a013d9f0d4e769d9dbcfdd9d9584a.13538.1656944479000000
    $ gdb nvim /var/lib/systemd/coredump/core.nvim.1000.008a013d9f0d4e769d9dbcfdd9d9584a.13538.1656944479000000
    (gdb) bt

Which shows (excerpted):

    Core was generated by `nvim'.
    Program terminated with signal SIGSEGV, Segmentation fault.

    warning: Section `.reg-xstate/13538' in core file too small.
    #0  match_thread (thread_args=0x55d4e0213230) at matcher.c:393
    393             haystack_t *match = args->corpus->haystacks[i];
    [Current thread is 1 (Thread 0x7fcda9b93740 (LWP 13538))]
    (gdb) bt
    #0  match_thread (thread_args=0x55d4e0213230) at matcher.c:393
    #1  0x00007fcda9e0f5ff in commandt_matcher_run (matcher=0x55d4e07eb9e0, needle=0x7fcda9e110f7 "stuff")
        at matcher.c:211
    #2  0x00007fcda9e0fb28 in commandt_temporary_demo_function () at matcher.c:312
    #3  0x00007fcda9bce309 in lj_vm_ffi_call () at buildvm_x86.dasc:2701
    #4  0x00007fcda9bf3b5e in lj_ccall_func (L=<optimized out>, cd=<optimized out>)
        at /build/luajit/src/luajit-2.0-4c2441c/src/lj_ccall.c:1167
    ...
wincent added a commit that referenced this pull request Jul 7, 2022
I'm on macOS right now, so not sure how this will look in GCC, but at
least with clang/lldb we find the smoking gun pretty directly here.

First, without `-O0`

    lldb --file nvim
    (lldb) r
    Process 33400 stopped
    * thread #3, stop reason = EXC_BAD_ACCESS (code=1, address=0x7669746967750013)
        frame #0: 0x0000000103411c08 commandt.so`commandt_calculate_match + 52
    commandt.so`commandt_calculate_match:
    ->  0x103411c08 <+52>: ldr    x8, [x8, #0x8]
        0x103411c0c <+56>: adds   x8, x8, #0x1
        0x103411c10 <+60>: cset   w8, eq
        0x103411c14 <+64>: mov    w9, #0x1
    Target 0: (nvim) stopped.
    (lldb) bt
    * thread #3, stop reason = EXC_BAD_ACCESS (code=1, address=0x29)
      * frame #0: 0x0000000103411c08 commandt.so`commandt_calculate_match + 52
        frame #1: 0x0000000103413174 commandt.so`match_thread + 252
        frame #2: 0x00000001be24826c libsystem_pthread.dylib`_pthread_start + 148

Same with `-O0`:

    Process 33773 stopped
    * thread #3, stop reason = EXC_BAD_ACCESS (code=1, address=0x7669746967750093)
        frame #0: 0x0000000103411c08 commandt.so`commandt_calculate_match(haystack=0x766974696775008b, matcher=0x0000600002166800) at match.c:132:38
       129       matchinfo_t m;
       130       /* long i; */
       131       float score = 1.0;
    -> 132       int compute_bitmasks = haystack->bitmask == UNSET_BITMASK;
       133       m.haystack = haystack;
       134       m.needle_p = matcher->needle;
       135       m.needle_length = matcher->needle_length;
    Target 0: (nvim) stopped.
wincent added a commit that referenced this pull request Jul 10, 2022
Logging shows we're skipping the "watch" key:

    reading object with key count: 3
    skipping key: watcher
    skipping key: watch
    skipping key: version

causing us to `abort()` on line 530:

    frame #3: 0x0000000104a1d18f commandt.so`commandt_watchman_watch_project(root="/Users/wincent/code/command-t", socket=30) at watchman.c:530:9

Length might be off (if it includes NULL terminator), causing us to fail
to spot the key.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants