This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] avoid GDB crash on inspection of pascal arrays
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 9 Mar 2010 09:16:51 +0400
- Subject: Re: [PATCH] avoid GDB crash on inspection of pascal arrays
- References: <001801cabee0$31499ca0$93dcd5e0$@muller@ics-cnrs.unistra.fr> <20100308185450.GK3081@adacore.com> <001201cabf17$43e1b960$cba52c20$@muller@ics-cnrs.unistra.fr>
> Formatting with the tab/spaces conversion is still a nightmare
> for me...
(you could get me started on a rambling about the rid^H^H^Huse of
tabs instead of spaces in our source code - I just can't get over
these tabs)
> I really don't know vi enough to reformat correctly an almost 100
> lines long block... Is there a neat way to do this just with vi
> or do I need something more powerful?
I think that the canonical tool for formatting is emacs. Each time
I mentioned the idea of getting rid of tabs, some said that the
formatting rules need to match what emacs does. For a GNU project,
it's probably fair.
Unfortunately, I don't remember emacs anymore. There has to be an
equivalent way in vim (auto-formatting with a single command), but
I don't know, so here is how I do it with vim:
1. Get rid of all tabs first, they get in the way of selecting
the columns I want to delete or add:
:set expandtab
select all the lines I want to reformat (shift-v)
while the selection is still active, enter
:'<,'>retab!
(the '<,'> should appear automatically after you pressed :)
2. Delete the columns you want to delete:
select the rectangle you want to delete (ctrl-v)
while the selection is active, press d
3. Re-introduce the tabs:
:set noexpandtab
re-select all the lines to be tabified (shift-v)
while the selection is active, enter:
:'<,'>retab!
Attached is a couple of patches:
p-valprint-reformat.diff: The reformat itself;
p-valprint-reformat-w: The same diff, but with -w, to show that there
were no other real change except the removal
of the curly braces.
Can you test p-valprint-reformat.diff and then commit if it's OK?
Cheers,
--
Joel