After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787809 - Locate source files in debug sessions
Locate source files in debug sessions
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: plugins
3.26.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-09-17 22:03 UTC by Alberto Fanjul
Modified: 2017-09-22 05:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use fullname to locate files (2.84 KB, patch)
2017-09-17 22:06 UTC, Alberto Fanjul
none Details | Review
translate /run/build-runtime paths (3.84 KB, patch)
2017-09-22 04:38 UTC, Alberto Fanjul
committed Details | Review

Description Alberto Fanjul 2017-09-17 22:03:03 UTC
Debugging programs with debug info avaliable for dependencies, Builder cannot resolve correctly the path of source files
Comment 1 Alberto Fanjul 2017-09-17 22:04:18 UTC
gdb plugin is using the 'file' property from mi protocol to locate sources, doing a translate to resolve the path, but mi protocol provides a 'fullname' property with an absolute path for sources

Is not clear when 'fullname' is not avaliable but seems safe to use 'fullname' property and 'file' if 'fullname' is not avaliable.
Comment 2 Alberto Fanjul 2017-09-17 22:06:04 UTC
Created attachment 359951 [details] [review]
Use fullname to locate files

I have tested from host debugging sessions and flatpak debuggings sessions, and the patch seems to work
Comment 3 Christian Hergert 2017-09-17 22:07:17 UTC
Review of attachment 359951 [details] [review]:

As mentioned on IRC, this is insufficient due to the path being non-existent outside of a given runtime (such as flatpak). It needs to translate the file using ide_runtime_translate_file().
Comment 4 Alberto Fanjul 2017-09-21 09:16:12 UTC
   runner = dzl_signal_group_get_target (self->runner_signals);
   if (runner != NULL)
     runtime = ide_runner_get_runtime (runner);

Didn't know how to retrieve the runtime, but in my wip I has almost there

This is another step to contribute. You need to do things yourself and see the final result and compare with yours is the best way to learn.

Let's go for other fixes!
Comment 5 Alberto Fanjul 2017-09-21 11:04:37 UTC
For host runtime this is fixed.

For flatpak, I'm debugging a flatpak app created with meson template

debugger returns me 

/run/build-runtime/gtk3/gtk/gtkapplication.c as fullname source

entering into the flatpak environment

flatpak-builder --run ~/.cache/gnome-builder/flatpak/staging/hello-world/flatpak\:org.gnome.Sdk-x86_64-master org.gnome.HelloWorld.flatpak.json /bin/bash

I can only find 

/usr/lib/debug/source/gtk3/gtk/gtkapplication.c

and there's no /run/build-runtime directory
Comment 6 Alberto Fanjul 2017-09-22 04:38:02 UTC
Created attachment 360239 [details] [review]
translate /run/build-runtime paths

Fix the translation of /run/build-runtime paths

It navigates to many points in sources that do not match real source, like

gtk_application_get_type

which I guess is code autogenerated by gtk. I don't think we can fix that
Comment 7 Christian Hergert 2017-09-22 05:07:46 UTC
LGTM, pushed with a quick style fix.