From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67024 invoked by alias); 30 Jul 2015 20:09:41 -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 66997 invoked by uid 48); 30 Jul 2015 20:09:40 -0000 From: "kevinb at redhat dot com" To: gdb-prs@sourceware.org Subject: [Bug symtab/18746] New: Cannot set breakpoint on nested function or subprogram Date: Thu, 30 Jul 2015 20:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kevinb at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: 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 target_milestone 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-q3/txt/msg00132.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18746 Bug ID: 18746 Summary: Cannot set breakpoint on nested function or subprogram Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: kevinb at redhat dot com Target Milestone: --- Created attachment 8462 --> https://sourceware.org/bugzilla/attachment.cgi?id=8462&action=edit nested.c Consider this program (which is also an attachment): --- nested.c --- int main () { static int a = 1, b = 2, c = 3; int d = 4, e = 5, f = 6; void p (void) { c = 7; f = 8; __builtin_printf ("%d %d %d %d\n", b, c, e, f); } p (); a = 101; b = 102; c = 103; d = 104; e = 105; f = 106; p (); return 0; } --- end nested.c --- It can be compiled as follows: gcc -o nested -g nested.c I would like to place a breakpoint on p(), which is nested within main(). This is what I've tried: 1) Placing a breakpoint on p without qualification does not work: (gdb) b p Function "p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n 2) Placing a breakpoint on main::p doesn't work: (gdb) b main::p Function "main::p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (I see the same behavior when I try main:p too.) 3a) However, the completion mechanism seems to think that p is a viable candidate for a breakpoint: (gdb) b p p printf printf@plt 3b) But, as in (1), when we try it (by hitting here), it does not work: Function "p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n 4) Perhaps p will be visible if we run to a breakpoint in main? (Nope.) (gdb) b main Breakpoint 1 at 0x400525: file nested.c, line 5. (gdb) run Starting program: /mesquite2/.ironwood2/1158876/nested Breakpoint 1, main () at nested.c:5 5 int d = 4, e = 5, f = 6; (gdb) b p Function "p" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) -- You are receiving this mail because: You are on the CC list for the bug.