public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "kevinb at redhat dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-18746-4717@http.sourceware.org/bugzilla/> (raw)

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 <Enter> 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.


             reply	other threads:[~2015-07-30 20:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 20:09 kevinb at redhat dot com [this message]
2023-10-06  9:53 ` [Bug symtab/18746] " vries at gcc dot gnu.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-18746-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: link
Be 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).