gcov on gdb

Daniel Jacobowitz drow@mvista.com
Tue Jan 7 04:26:00 GMT 2003


On Mon, Jan 06, 2003 at 09:26:26PM -0500, Elena Zannoni wrote:
> 
> I have run gcov on a testsuite run of gdb on my laptop (stock RHL 7.2).
> It is really easy, in case somebody wants to try, you just need to compile
> gdb like this:
> 
> make CFLAGS='-O0 -fprofile-arcs -ftest-coverage'
> 
> then, after the run, you'll notice all these *.bb, *.bbg, *.da files
> in your objdir.  For each source file, then you can say 'gcov blah.c'
> and this will produce the actually interesting data, in the form of a
> copy of the source file (with a .gcov extension) with each line
> annotated with the number of times it was executed, or with '###' if
> it was never run.

I've done this once.  I was trying to write a full-coverage (or mostly
full coverage...) testsuite for c-typeprint.c; I'll get back to that
One Of These Days.

> For instance:
> [ezannoni@localhost gdb]$ gcov stabsread.c
>  52.76% of 2280 source lines executed in file /home/ezannoni/sources/src/gdb/stabsread.c
> Creating stabsread.c.gcov.
> 
> In doing so, I've noticed that a lot of lines in the stabread.c file
> are never executed because they are old functions (1996) to support
> cfront.  I think we could obsolete this stuff.  I've not found anything
> in a google search for cfront that was more recent than 1995.
> 
> Anyway, I think the gcov data is too bulky to post. But it could be a good
> way to spot stuff that is old, or stuff that is untested.

I think this is a really, really, really good idea.  I can absolutely
guarantee that the C++ language support won't work with CFront any
more, and I've never seen a complaint, so I'm inclined to think it
doesn't have current users (or current users interested in GDB).

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gdb mailing list