[Bug 18772] New: Breakpoint reports invalid locations and breaks incorrectly

Bug ID 18772
Summary Breakpoint reports invalid locations and breaks incorrectly
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter sheeftz@gmail.com
Classification Unclassified

I have a very different behaviour of lldb and gdb on pretty common piece of
code:
GuiProfile.cpp fragment:

...
void ProfileNameEdit::OnShow()
{
    SetText(Profiles::current()->name); // this is 10th line
}
...

(lldb) b GuiProfile.cpp:10
Breakpoint 2: 33 locations.

(gdb) b GuiProfile.cpp:10
Breakpoint 1 at 0x6d6e8c: GuiProfile.cpp:10. (4 locations)

Note 33 vs 4 locations.

The actual problem is that lldb breakpoint breaks where it should not. It
breaks on unrelated line of unrelated file far away from actual code.

Andrew Shevchenko changed bug 18772

Andrew Shevchenko changed bug 18772

What Removed Added
Status RESOLVED REOPENED
Resolution FIXED

Comment # 6 on bug 18772 from Andrew Shevchenko

(In reply to comment #4)
> Hey Andrew,
> 
> Can you reproduce it with a small program that you could attach here?

I could not reproduce it with simple code.
I tried to simplify my code step by step, but it appears that number of
reported locations depends on text of some include files and the actual line
number but not actual code. This means if insert some empty lines, number of
reported locations changes. I can get a single location, put some empty lines
before and get 33 locations on same piece of code, then remove some includes
and get 1 location again. It's very unstable.
I can share my includes and .a lib to link. It can be reproduced easy with it.

> Also, do you get different results when compiling with gcc (maybe a gcc
> 4.8.x?)

Unfortunately, gcc could not compile my code. The bug is fixed in gcc-4.9. I
was not able to find prebuilt gcc-4.9 package for Ubunut saucy.

> On Ubuntu, which release are you on?  And is it x86_64 or x86?
x86_64

> If you can also include the command line options that you are using, that
> would be great.
-c -Xclang -include-pch -Xclang -pipe -stdlib=libc++ -g -std=c++11 -fPIE