public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "pgmer6809 at yahoo dot com" <sourceware-bugzilla@sourceware.org> 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 [thread overview] Message-ID: <bug-18328-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2015-04-25 4:06 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-04-25 4:06 pgmer6809 at yahoo dot com [this message] 2024-01-02 18:53 ` [Bug gdb/18328] " ssbssa at sourceware dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-18328-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).