How do I debug quickfix's errorformat problems?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I debug quickfix's errorformat problems?

ivan.reche
The directory stack of my quickfix is not working properly. The directories are not getting prepended to the filename of the relevant error messages.

My build is done using GNU Make, which is displaying the Entering and Leaving directory messages just fine. Here is an example:

|| make[3]: Entering directory `/path/to/myfile'

myfile.c|1836 col 2| error: #error force error

How do I debug such problems?

Thanks in advance.

Vim's version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  3 2014 22:11:17)
Included patches: 1-131
Modified by Gentoo-7.4.131
Compiled by ifilgueiras@e6430-lin
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
-dnd             +modify_fname    +signs           +xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: x86_64-pc-linux-gnu-gcc   -L. -Wl,-O1 -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -Wl,-E  -Wl,-O1 -L/usr/local/lib -Wl,--as-needed -o vim    -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl   -lacl -lattr -lgpm -ldl  -L/usr/lib/x86_64-linux-gnu -lluajit-5.1 -Wl,-E -Wl,-O1 -Wl,--as-needed  -L/usr/lib64/perl5/5.16.3/x86_64-linux/CORE -lperl -lnsl -ldl -lm -lcrypt -lutil -lc -L/usr/lib64/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic   -Wl,-R -Wl,/usr/lib64 -L/usr/lib64 -lruby18 -lrt -ldl -lcrypt -lm  -L/usr/lib64  

errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared ide
ntifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn
file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file incl
uded from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]
from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:
%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory [`']%f',%X%*\a
[%*\d]: Leaving directory [`']%f',%D%*\a: Entering directory [`']%f',%X%*\a: Lea
ving directory [`']%f',%DMaking %*\a in %f,%f|%l| %m

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: How do I debug quickfix's errorformat problems?

Lech Lorens
On Saturday, January 4, 2014 7:11:28 PM UTC+1, [hidden email] wrote:
> The directory stack of my quickfix is not working properly. The directories are not getting prepended to the filename of the relevant error messages.
>
> My build is done using GNU Make, which is displaying the Entering and Leaving directory messages just fine. Here is an example:
>
> || make[3]: Entering directory `/path/to/myfile'
>
> myfile.c|1836 col 2| error: #error force error
>
> How do I debug such problems?

I would start by splitting the value of &efm to separate statements. This should place the expressions inside 'efm' below the first line, each on a separate line:
call append(1, split(&efm, '\v\\@<!%(\\\\)*\zs,'))

> Thanks in advance.
>
> Vim's version:
>

I already posted a fix on vim-dev a while ago but Bram hasn't been sending out any official patches for some time.
To prevent problems caused by line wrapping I tried breaking this into separate statements. Hope I didn't break anything:
set efm=[%\d%\+%\%.%\d%\+]%\ %f:%l%m
set efm+=%*[^"]"%f"%*\D%l: %m
set efm+="%f"%*\D%l: %m
set efm+=%-G%f:%l: (Each undeclared identifier is reported only once
set efm+=%-G%f:%l: for each function it appears in.)
set efm+=%-GIn file included from %f:%l:%c:
set efm+=%-GIn file included from %f:%l:%c\,
set efm+=%-GIn file included from %f:%l:%c
set efm+=%-GIn file included from %f:%l
set efm+=%-G%*[ ]from %f:%l:%c
set efm+=%-G%*[ ]from %f:%l:
set efm+=%-G%*[ ]from %f:%l\,
set efm+=%-G%*[ ]from %f:%l
set efm+=%f:%l:%c:%m
set efm+=%f(%l):%m
set efm+=%f:%l:%m
set efm+="%f"\, line %l%*\D%c%*[^ ] %m
set efm+=%D%*\a[%*\d]: Entering directory %*[`']%f'
set efm+=%X%*\a[%*\d]: Leaving directory %*[`']%f'
set efm+=%D%*\a: Entering directory %*[`']%f'
set efm+=%X%*\a: Leaving directory %*[`']%f'
set efm+=%DMaking %*\a in %f
set efm+=%f|%l| %m
set efm+=#%\d%\+%\s%\+%m(%.%\+%\ at%\ %f:%l
set efm+=#%\d%\+%\s%\+0x%\x%\+%\ in%\ %m(%.%\+%\ at%\ %f:%l

Obviously, look at the lines containing "Entering directory" and "Leaving directory".

HTH,
Lech

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: How do I debug quickfix's errorformat problems?

Gary Johnson-4
On 2014-01-05, Lech Lorens wrote:

> On Saturday, January 4, 2014 7:11:28 PM UTC+1, [hidden email] wrote:
> > The directory stack of my quickfix is not working properly. The
> > directories are not getting prepended to the filename of the
> > relevant error messages.
> >
> > My build is done using GNU Make, which is displaying the
> > Entering and Leaving directory messages just fine. Here is an
> > example:
> >
> > || make[3]: Entering directory `/path/to/myfile'
> >
> > myfile.c|1836 col 2| error: #error force error
> >
> > How do I debug such problems?
>
> I would start by splitting the value of &efm to separate
> statements. This should place the expressions inside 'efm' below
> the first line, each on a separate line:
> call append(1, split(&efm, '\v\\@<!%(\\\\)*\zs,'))
>
> > Thanks in advance.
> >
> > Vim's version:
> >
>
> I already posted a fix on vim-dev a while ago but Bram hasn't been
> sending out any official patches for some time.
> To prevent problems caused by line wrapping I tried breaking this
> into separate statements. Hope I didn't break anything:
> set efm=[%\d%\+%\%.%\d%\+]%\ %f:%l%m
> set efm+=%*[^"]"%f"%*\D%l: %m
> set efm+="%f"%*\D%l: %m
> set efm+=%-G%f:%l: (Each undeclared identifier is reported only once
> set efm+=%-G%f:%l: for each function it appears in.)
> set efm+=%-GIn file included from %f:%l:%c:
> set efm+=%-GIn file included from %f:%l:%c\,
> set efm+=%-GIn file included from %f:%l:%c
> set efm+=%-GIn file included from %f:%l
> set efm+=%-G%*[ ]from %f:%l:%c
> set efm+=%-G%*[ ]from %f:%l:
> set efm+=%-G%*[ ]from %f:%l\,
> set efm+=%-G%*[ ]from %f:%l
> set efm+=%f:%l:%c:%m
> set efm+=%f(%l):%m
> set efm+=%f:%l:%m
> set efm+="%f"\, line %l%*\D%c%*[^ ] %m
> set efm+=%D%*\a[%*\d]: Entering directory %*[`']%f'
> set efm+=%X%*\a[%*\d]: Leaving directory %*[`']%f'
> set efm+=%D%*\a: Entering directory %*[`']%f'
> set efm+=%X%*\a: Leaving directory %*[`']%f'
> set efm+=%DMaking %*\a in %f
> set efm+=%f|%l| %m
> set efm+=#%\d%\+%\s%\+%m(%.%\+%\ at%\ %f:%l
> set efm+=#%\d%\+%\s%\+0x%\x%\+%\ in%\ %m(%.%\+%\ at%\ %f:%l
>
> Obviously, look at the lines containing "Entering directory" and
> "Leaving directory".

I agree that putting each 'efm' rule on a separate line makes the
option value much easier to read and to tinker with.  You need to be
careful with the quoting of the values of :set, though.  Some of the
:set commands above won't work because the spaces, double-quotes (")
and backslashes have not been escaped.  See

    :help option-backslash

You may find it easier to concatenate the rules using :let instead
of :set simply because the quoting is easier, e.g.,

    let &efm .= ',%*[^"]"%f"%*\D%l: %m'

You will need to explicitly include the comma between rules when
using :let.

Patience helps.  I seldom get the quoting of new 'efm' rules right
on the first attempt.

Regards,
Gary

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.