This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12750] New: Fail to restore breakpoints on static functionswith namespace


http://sourceware.org/bugzilla/show_bug.cgi?id=12750

           Summary: Fail to restore breakpoints on static functions with
                    namespace
           Product: gdb
           Version: 7.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: stephane.chauveau@caps-entreprise.com


Created attachment 5714
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5714
Code sample

A breakpoint set on a static function within a namespace is automatically
qualified with the filename. For example, for the static function xxx::fun2()
in the file main.cc , the breakpoint description becomes

  main.cc:xxx::fun2

Unfortunately, gdb fails to parse that syntax and so cannot restore those
breakpoints after a 'run' 

The attached file provides a small example. 

Breakpoints can be successfully set on both the global function xxx::fun1 and
the static function xxx::fun2

#   (gdb) break main 
#   Breakpoint 1 at 0x4005bc: file main.cc, line 20.
#   (gdb) run
#   20        xxx::fun1() ;
#   (gdb) break xxx::fun1
#   Breakpoint 2 at 0x40059c: file main.cc, line 9.
#   (gdb) break xxx::fun2
#   Breakpoint 3 at 0x4005ac: file main.cc, line 13.
#   (gdb) cont 
#   Breakpoint 2, xxx::fun1 () at main.cc:9
#   (gdb) cont 
#   Breakpoint 3, xxx::fun2 () at main.cc:13
#   (gdb) cont 
#   Program exited normally.

However, gdb fails to restore the breakpoint on xxx::fun2 when the process is
restarted:

#   (gdb) run
#   Starting program: /udd/schauvea/GDB/a.out 
#   Error in re-setting breakpoint 3: Can't find member of namespace, class, # 
 struct, or union named "main.cc:xxx::fun2"
#   Hint: try 'main.cc:xxx::fun2<TAB> or 'main.cc:xxx::fun2<ESC-?>
#   (Note leading single quote.)
#   
#   Breakpoint 1, main () at main.cc:20
#   20        xxx::fun1() ;

The new command 'save breakpoints' shows that the breakpoint description is
main.cc:xxx::fun2 which is not accepted by gdb:

#   (gdb) save breakpoints /dev/stdout
#   break main
#   break xxx::fun1
#   break main.cc:xxx::fun2
#   disable
#   Saved to file '/dev/stdout'.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]