From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62635 invoked by alias); 25 Apr 2015 04:06:02 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 62610 invoked by uid 48); 25 Apr 2015 04:06:01 -0000 From: "pgmer6809 at yahoo dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/18328] New: gdb does not work properly with gcov to update statement coverage Date: Sat, 25 Apr 2015 04:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.7 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: pgmer6809 at yahoo dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q2/txt/msg00144.txt.bz2 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, . . 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.