Bug 12501 - Doesn't set pending breakpoint on inlined function
Summary: Doesn't set pending breakpoint on inlined function
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: 7.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-19 10:16 UTC by Teodor Petrov
Modified: 2013-10-09 09:05 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Teodor Petrov 2011-02-19 10:16:34 UTC
Here are two simplified test files:

***header.h
inline int func1()
{
    return 1000;
}
inline int func2()
{
    return 10;
}
***main.cpp
#include "header.h"
int main()
{
    func1();
    return 0;
}

To reproduce the bug execute the following commands:
g++ -g main.cpp -o test_break
gdb ./test_break
(gdb) break header.h:7

The result of the last command is "No line 7 in file "header.h"."

GDB thinks the code is unused, because the func2 is not used in the current symbols. This might not be the case if a shared library which uses func2 is loaded in the future, therefore GDB should not refuse to set a pending breakpoint.
Comment 1 Gary Benson 2013-10-09 09:05:14 UTC
This issue seems to have been fixed now (tested with 7.6.50.20131009-cvs):

  (gdb) b header.h:7
  No line 7 in file "header.h".
  Make breakpoint pending on future shared library load? (y or [n]) y
  
  Breakpoint 1 (header.h:7) pending.

I'm going to close this but please reopen if it still doesn't work for you.