gdb has incorrect paths for source files in library compiled with -flto

Bug #1699058 reported by Tim Yorke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

After building a binary that linked in a library (both main project and library were compiled/linked with -flto), I found that gdb could not find some source files in the library. This is using the latest release (6-2017-q1-update)

The "info sources" returned invalid paths - it seemed that the relative path to the source file from the libraries perspective is being wrongly used/interpreted as a relative path from the main project's perspective.

For example, if the file in the library is at ../source/file_in_library.cpp (relative to c:/library/build), then an "info sources" command to gdb would list that file as "c:/main_project/build/../source/file_in_library.cpp" (no file with that path), when it should be "c:/library/build/../source/file_in_library.cpp".

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

Hi Tim,

Thanks for the report.

Can you check a build without -flto if 'info sources' gives the right path? Looking at your report, I'm guessing you're on Windows. Any chance you could give it a try with -flto on Linux?

Thanks,
Tejas.

Revision history for this message
Tim Yorke (tim-yorke) wrote :

Hi Tejas,

It seems to be purely dependant on whether or not the library project is built with -flto. The use of -flto on the main project doesn't affect the issue.

You're right - I'm using Windows 10. I'll try and build this using the linux sub-system..

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

Hi Tim,

Thanks for the details.

Am I right in understanding from your description above that if you don't build the libs with -flto, gdb correctly shows the paths?

Also, will you be able to share with us a narrowed down set of sources so that we can use to reproduce the issue you're seeing on our side?

Thanks,
Tejas.

Revision history for this message
Tim Yorke (tim-yorke) wrote :

   "Am I right in understanding from your description above that if you don't build the libs with -flto, gdb correctly shows the paths?"

That's correct.

   "Also, will you be able to share with us a narrowed down set of sources so that we can use to reproduce the issue you're seeing on our side?"

Okay, I'll try and come up with something over the next few days.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.