Re: enabling symbols for debug in clinfo


Quentin Schulz
 

Hi Steve,

On 5/9/22 12:54, Monsees, Steven C (US) via lists.yoctoproject.org wrote:
Hello:
I'd like to build clinfo w/ "-g" option to do some debugging with GDB...
I am looking at: meta-openembedded/meta-oe/recipes-support/opencl/clinfo_2.2.18.04.06.bb
I created a "bbapend" file to modify the build recipes "Makefile.am" file prior to build, to introduce '-g' for CFLAGS & CPPFLAGS, i.e. at top of Makefile.am added:
AM_CFLAGS - -g
AM_CPPFLAGS = -g
I checked the build tree and see my modified "Makefile.am" updated as expected, the update occurs at the end of the install process, using do_install_append... so the build should have used my modified file... but I do not have symbols for the clinfo package when I go to use GDB.
The install task runs after the software has been built. It is therefore expected your changes aren't actually taken into account.

c.f. https://docs.yoctoproject.org/ref-manual/tasks.html#do-install, I guess it is not THAT obvious that it happens after compilation. Maybe a patch to the documentation would help clear things out.

You shouldn't need to modify the makefile and just add "-g" to TARGET_CFLAGS/ TARGET_CXXFLAGS or CFLAGS/CXXFLAGS in your recipe.

Also, I have never used it but we do have support for debuginfod which should make it easier to debug remotely without installing the binary with debug symbols, c.f. https://docs.yoctoproject.org/dev-manual/common-tasks.html#debugging-with-the-gnu-project-debugger-gdb-remotely

Cheers,
Quentin

Join yocto@lists.yoctoproject.org to automatically receive all group messages.