public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18328] New: gdb does not work properly with gcov to update statement coverage
@ 2015-04-25  4:06 pgmer6809 at yahoo dot com
  2024-01-02 18:53 ` [Bug gdb/18328] " ssbssa at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: pgmer6809 at yahoo dot com @ 2015-04-25  4:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18328

            Bug ID: 18328
           Summary: gdb does not work properly with gcov to update
                    statement coverage
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: minor
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: pgmer6809 at yahoo dot com

Created attachment 8267
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8267&action=edit
Showing complete version info for linux, gdb, gcc, gcov, compile flags and

code snippet:
    array[x] = (int *) malloc (arraysize*sizeof (int));
    if (array[x] == NULL) {
      ;
      printf("Failed malloc for array size %d \n", arraysize);
      exit(-1);
  }
The executable program is sample
before the test the relevant lines in sample.c.gcov look like this:
       -:   36:  }
      101:   37:  for (x=0; x < arraysize; x++) {
      100:   38:    array[x] = (int *) malloc (arraysize*sizeof (int));
      100:   39:    if (array[x] == NULL) {
        -:   40:      ;
    #####:   41:      printf("Failed malloc for array size %d \n", arraysize);
    #####:   42:      exit(-1);
        -:   43:    }

then:
gdb sample
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation,
.
 <snip>
.
Type "apropos word" to search for commands related to "word"...
Reading symbols from sample...done.
(gdb) break 19
Breakpoint 1 at 0x400edd: file sample.c, line 19.
(gdb) run
Starting program: /home/greg/Programming/C_Code/sample 

Breakpoint 1, main (argc=1, argv=0x7fffffffe168) at sample.c:19
19      if (argc != 2) {
(gdb) jump 40
Continuing at 0x40107a.
Failed malloc for array size 0 
[Inferior 1 (process 7384) exited with code 0377]
(gdb) quit

Now an examination of sample.c.gcov yields
     101:   37:  for (x=0; x < arraysize; x++) {
      100:   38:    array[x] = (int *) malloc (arraysize*sizeof (int));
      100:   39:    if (array[x] == NULL) {
        -:   40:      ;
    #####:   41:      printf("Failed malloc for array size %d \n", arraysize);
        1:   42:      exit(-1);
        -:   43:    }
  Note that line 42's count has been updated but line 41's still shows that it
was never executed.

This looks like a bug in gdb or in gcov I am not sure which.

This is my first real try at using gdb, and so I am totally inexperienced with
it.

Greg Morse -- pgmer6809

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gdb/18328] gdb does not work properly with gcov to update statement coverage
  2015-04-25  4:06 [Bug gdb/18328] New: gdb does not work properly with gcov to update statement coverage pgmer6809 at yahoo dot com
@ 2024-01-02 18:53 ` ssbssa at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-02 18:53 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=18328

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to pgmer6809 from comment #0)
> (gdb) jump 40
> Continuing at 0x40107a.

I don't think the coverage code likes it if you jump around the code manually
like this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-02 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-25  4:06 [Bug gdb/18328] New: gdb does not work properly with gcov to update statement coverage pgmer6809 at yahoo dot com
2024-01-02 18:53 ` [Bug gdb/18328] " ssbssa at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).