Jakson Alves de Aquino <jalve...@gmail.com> wrote:

> Hi,
>
> When I am editing an Rnoweb file and start R with the
> Vim-R-plugin, Vim crashes:
>
> (gdb) bt
> #0  0x00000000005c75c8 in syn_current_attr (syncing=0, displaying=1, 
> can_spell=0x0, keep_state=0) at syntax.c:2101
> #1  0x00000000005c6da6 in get_syntax_attr (col=0, can_spell=0x0, 
> keep_state=0) at syntax.c:1854
> #2  0x0000000000586dcc in win_line (wp=0x8d3720, lnum=15, startrow=14, 
> endrow=28, nochange=1) at screen.c:4354
> #3  0x00000000005823bf in win_update (wp=0x8d3720) at screen.c:2011
> #4  0x000000000057f9d1 in update_screen (type=40) at screen.c:678
> #5  0x00000000005dfbed in set_shellsize (width=0, height=0, mustset=0) at 
> term.c:3174
> #6  0x00000000005df9d1 in shell_resized () at term.c:3036
> #7  0x0000000000548332 in handle_resize () at os_unix.c:487
> #8  0x000000000054820b in mch_inchar (buf=0xc3d558 "", maxlen=71, wtime=0, 
> tb_change_cnt=21) at os_unix.c:399
> #9  0x00000000005e403e in ui_inchar (buf=0xc3d558 "", maxlen=71, wtime=0, 
> tb_change_cnt=21) at ui.c:199
> #10 0x00000000004d05c2 in inchar (buf=0xc3d558 "", maxlen=215, wait_time=0, 
> tb_change_cnt=21) at getchar.c:3098
> #11 0x00000000004d01ae in vgetorpeek (advance=0) at getchar.c:2873
> #12 0x00000000004ce91c in vpeekc () at getchar.c:1875
> #13 0x00000000004ce9b7 in char_avail () at getchar.c:1925
> #14 0x0000000000591b48 in redrawing () at screen.c:10421
> #15 0x000000000057f4bb in update_screen (type=10) at screen.c:500
> #16 0x000000000062a6bc in main_loop (cmdwin=0, noexmode=0) at main.c:1237
> #17 0x000000000062a215 in main (argc=4, argv=0x7fffffffdc88) at main.c:1034
> (gdb)
>
> Rnoweb files combine LaTeX and R code. When R starts, it sends a
> message to Vim using the clientserver feature. The message is a
> list of loaded packages and Vim reacts to the message updating the
> syntax of R functions. To update the syntax of R code, Vim sources
> syntax scripts which add the new functions and then run the
> following command:
>
>     silent exe 'set filetype=' . &filetype
>
> I first noted the crash on Monday.
>
> I build Vim from mercurial repository and, to get the backtrace
> with gdb, I have configured the build with the command:
>
>     CFLAGS=-g ./configure --enable-pythoninterp=yes --enable-multibyte
>
> Thanks!

Hi

In the stack, I see update_screen() being called twice as
a result of a screen resize event. Maybe that's causing the
problem.

I don't know how to reproduce it.

Can you try to reproduce it after recompiling Vim with the
address sanitizer (asan)? It's only a matter of compiling
and linking with -fsanitize=address. It assumes that your
compiler is recent enough (gcc >= 4.8 or clang >= 3.3?)
You can do with the following patch:

diff -r 84171683fd66 src/Makefile
--- a/src/Makefile    Tue Jan 27 22:52:15 2015 +0100
+++ b/src/Makefile    Sat Jan 31 00:13:29 2015 +0100
@@ -616,6 +616,10 @@
 #PROFILE_LIBS = -pg
 #PROFILE_LIBS = -pg -lc

+# Uncomment the next two lines compile Vim with the address sanitizer.
+SANITIZER_CFLAGS = -g -O0 -fsanitize=address -fno-omit-frame-pointer
+SANITIZER_LIBS = $(SANITIZER_CFLAGS)
+
 # MEMORY LEAK DETECTION
 # Requires installing the ccmalloc library.
 # Configuration is in the .ccmalloc or ~/.ccmalloc file.
@@ -1342,7 +1346,7 @@
 PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS)
 POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(TCL_CFLAGS) $(EXTRA_DEFS)

-ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(LEAK_CFLAGS)
$(POST_DEFS)
+ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS)
$(SANITIZER_CFLAGS) $(LEAK_CFLAGS) $(POST_DEFS)

 # Exclude $CFLAGS for osdef.sh, for Mac 10.4 some flags don't work together
 # with "-E".
@@ -1374,6 +1378,7 @@
        $(TCL_LIBS) \
        $(RUBY_LIBS) \
        $(PROFILE_LIBS) \
+       $(SANITIZER_LIBS) \
        $(LEAK_LIBS)

 # abbreviations



Please also try to run vim with valgrind (without building with asan)
It may find other bugs than asan: uninitialized memory accesses
are not found by asan but they are found by valgrind.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui