public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/18746] New: Cannot set breakpoint on nested function or subprogram
@ 2015-07-30 20:09 kevinb at redhat dot com
  2023-10-06  9:53 ` [Bug symtab/18746] " vries at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: kevinb at redhat dot com @ 2015-07-30 20:09 UTC (permalink / raw)
  To: gdb-prs

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.


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

* [Bug symtab/18746] Cannot set breakpoint on nested function or subprogram
  2015-07-30 20:09 [Bug symtab/18746] New: Cannot set breakpoint on nested function or subprogram kevinb at redhat dot com
@ 2023-10-06  9:53 ` vries at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2023-10-06  9:53 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I've tried with lldb 11.0.1, and "break p" works.

-- 
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:[~2023-10-06  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-30 20:09 [Bug symtab/18746] New: Cannot set breakpoint on nested function or subprogram kevinb at redhat dot com
2023-10-06  9:53 ` [Bug symtab/18746] " vries at gcc dot gnu.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).