using gdb with externalsrc
A message that is not in the archive (sent off-list or not yet received): [email protected]
We've got a component of an existing Yocto project under active development that we'd like to debug with gdb.?
We've added these features to get gdb and the debug symbol packages into the image:
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug"
IMAGE_FEATURES = "ssh-server-openssh dbg-pkgs"
We've added these variables to build the component under active development from the local code:
INHERIT += "externalsrc"
EXTERNALSRC_pn-[component] = "[local source code path]/[component]"
All seems well, as the build succeeds and the component in the image reflects local code changes. However, the component source code never makes it into the image, so it can't be referenced in gdb.
Is there a secret to using dbg-pkgs and EXTERNALSRC together??
Quoted 16 lines · Dave Kimble
We've got a component of an existing Yocto project under active development that we'd like to debug with gdb.
We’ve added these features to get gdb and the debug symbol packages into the image:
EXTRA_IMAGE_FEATURES= "debug-tweaks tools-debug"
IMAGE_FEATURES= "ssh-server-openssh dbg-pkgs"We’ve added these variables to build the component under active development from the local code:
INHERIT += "externalsrc"
EXTERNALSRC_pn-[component] = “[local source code path]/[component]”
Quoted 5 lines
All seems well, as the build succeeds and the component in the image reflects local code changes. However, the component source code never makes it into the image, so it can’t be referenced in gdb.
Is there a secret to using dbg-pkgs and EXTERNALSRC together?
Can you check if -dbg package for extrnalsrc component is installed ? secondly, does the debugging work if you dont isue externalsrc for this particular component.
Yes, I'm able to debug the externalsrc component. I can see variables, set breakpoints, step/next through the code etc. (so the symbols are valid). And local changes to the externalsrc component are reflected when I debug.
But I can't list the externalsrc component source code from within gdb (or find it anywhere in the image). The source for all of the other components is in the image (and I can list it in gdb). When I try to list the code for the externalsrc component, gdb prints this error message:
"[path on my build? machine]/sourceFile.c: No such file or directory."
If I don't use externalsrc at all, I can debug all of the components and list source code for all of them from within gdb.
So, I can't solve how to get the externalsrc source code into the image. I don't mind if I have to use "set substitute-path" from within gdb if externalsrc source files are put in a different place (although, it'd be ideal if they were put in the same place).
Thanks
________________________________________
From: Khem Raj <[email protected]>
Sent: Wednesday, July 15, 2015 1:49 PM
To: Dave Kimble
Cc: [email protected]
Subject: Re: [yocto] using gdb with externalsrc
Quoted 16 lines · Dave Kimble
We've got a component of an existing Yocto project under active development that we'd like to debug with gdb.
We've added these features to get gdb and the debug symbol packages into the image:
EXTRA_IMAGE_FEATURES= "debug-tweaks tools-debug"
IMAGE_FEATURES= "ssh-server-openssh dbg-pkgs"We've added these variables to build the component under active development from the local code:
INHERIT += "externalsrc"
EXTERNALSRC_pn-[component] = "[local source code path]/[component]"
Quoted 5 lines
All seems well, as the build succeeds and the component in the image reflects local code changes. However, the component source code never makes it into the image, so it can't be referenced in gdb.
Is there a secret to using dbg-pkgs and EXTERNALSRC together?
Can you check if -dbg package for extrnalsrc component is installed ? secondly, does the debugging work if you dont isue externalsrc for this particular component.
Quoted 9 lines · Dave Kimble
Yes, I'm able to debug the externalsrc component. I can see variables, set breakpoints, step/next through the code etc. (so the symbols are valid). And local changes to the externalsrc component are reflected when I debug.
But I can't list the externalsrc component source code from within gdb (or find it anywhere in the image). The source for all of the other components is in the image (and I can list it in gdb). When I try to list the code for the externalsrc component, gdb prints this error message:
"[path on my build machine]/sourceFile.c: No such file or directory."
is this path pointing to S which is externalsrc path or to B which is under build TMPDIR
and secondly, can you see compiler flags used during build for externalsrc ?
are you using master branch ?
what does show directories say
Quoted 9 lines
If I don't use externalsrc at all, I can debug all of the components and list source code for all of them from within gdb.
So, I can't solve how to get the externalsrc source code into the image. I don't mind if I have to use "set substitute-path" from within gdb if externalsrc source files are put in a different place (although, it'd be ideal if they were put in the same place).
sources are embedded in debug info, most probably when debug-split is done at that point there could be something going wrong where its not able to put the right path links
Quoted 13 lines · On Wednesday 15 July 2015 19:54:08 Khem Raj wrote:
Quoted 11 lines · Dave Kimble
Yes, I'm able to debug the externalsrc component. I can see variables, set breakpoints, step/next through the code etc. (so the symbols are valid). And local changes to the externalsrc component are reflected when I debug.
But I can't list the externalsrc component source code from within gdb (or find it anywhere in the image). The source for all of the other components is in the image (and I can list it in gdb). When I try to list the code for
the externalsrc component, gdb prints this error message:
"[path on my build machine]/sourceFile.c: No such file or directory."
Quoted 3 lines
is this path pointing to S which is externalsrc path or to B which is under build TMPDIR
and secondly, can you see compiler flags used during build for externalsrc ?
This sounds suspiciously like this bug that coincidentally I just filed yesterday:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=8015
As far as I can tell it has something to do with the source not being in the path we're passing to debugedit, but I'm not immediately sure how to fix it.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
The path is S (externalsrc path).
compiler flags:
i586-poky-linux-gcc -m32 -march=i586 --sysroot=[sysroot dir] -DHAVE_CONFIG_H -I. -I[externalsrc dir] -I.. -D_ANSC_LINUX -D_ANSC_USER -D_ANSC_LITTLE_ENDIAN_ -O2 -pipe -g -feliminate-unused-debug-types -c -o [component].o `test -f '[component source file]'
(gdb) show directories
Source directories searched: $cdir:$cwd
Would it work to do add a do_package_append() that just manually copies the sources?
________________________________________
From: Khem Raj <[email protected]>
Sent: Wednesday, July 15, 2015 8:54 PM
To: Dave Kimble
Cc: [email protected]
Subject: Re: [yocto] using gdb with externalsrc
Quoted 9 lines · Dave Kimble
Yes, I'm able to debug the externalsrc component. I can see variables, set breakpoints, step/next through the code etc. (so the symbols are valid). And local changes to the externalsrc component are reflected when I debug.
But I can't list the externalsrc component source code from within gdb (or find it anywhere in the image). The source for all of the other components is in the image (and I can list it in gdb). When I try to list the code for the externalsrc component, gdb prints this error message:
"[path on my build machine]/sourceFile.c: No such file or directory."
is this path pointing to S which is externalsrc path or to B which is under build TMPDIR
and secondly, can you see compiler flags used during build for externalsrc ?
are you using master branch ?
what does show directories say
Quoted 9 lines
If I don't use externalsrc at all, I can debug all of the components and list source code for all of them from within gdb.
So, I can't solve how to get the externalsrc source code into the image. I don't mind if I have to use "set substitute-path" from within gdb if externalsrc source files are put in a different place (although, it'd be ideal if they were put in the same place).
sources are embedded in debug info, most probably when debug-split is done at that point there could be something going wrong where its not able to put the right path links
One more piece of information that may or may not be relevant:
When I build normally, the logs generated for the component in question are these:
log.do_compile
log.do_configure
log.do_fetch
log.do_install
log.do_package
log.do_packagedata
log.do_package_write_rpm
log.do_patch
log.do_populate_lic
log.do_populate_sysroot
log.do_unpack
When I use externalsrc, the logs are these:
log.do_packagedata_setscene
log.do_package_write_rpm_setscene
log.do_populate_lic_setscene
log.do_populate_sysroot_setscene
The Yocto docs state "Building software from an external source tree means that the build system's normal fetch, unpack, and patch process is not used." That would leave several processes that don't have a log file. Are the logs put in a different place for an externalsrc component?
________________________________________
From: Dave Kimble
Sent: Thursday, July 16, 2015 11:20 AM
To: Khem Raj
Cc: [email protected]
Subject: RE: [yocto] using gdb with externalsrc
The path is S (externalsrc path).
compiler flags:
i586-poky-linux-gcc -m32 -march=i586 --sysroot=[sysroot dir] -DHAVE_CONFIG_H -I. -I[externalsrc dir] -I.. -D_ANSC_LINUX -D_ANSC_USER -D_ANSC_LITTLE_ENDIAN_ -O2 -pipe -g -feliminate-unused-debug-types -c -o [component].o `test -f '[component source file]'
(gdb) show directories
Source directories searched: $cdir:$cwd
Would it work to do add a do_package_append() that just manually copies the sources?
________________________________________
From: Khem Raj <[email protected]>
Sent: Wednesday, July 15, 2015 8:54 PM
To: Dave Kimble
Cc: [email protected]
Subject: Re: [yocto] using gdb with externalsrc
Quoted 9 lines · Dave Kimble
Yes, I'm able to debug the externalsrc component. I can see variables, set breakpoints, step/next through the code etc. (so the symbols are valid). And local changes to the externalsrc component are reflected when I debug.
But I can't list the externalsrc component source code from within gdb (or find it anywhere in the image). The source for all of the other components is in the image (and I can list it in gdb). When I try to list the code for the externalsrc component, gdb prints this error message:
"[path on my build machine]/sourceFile.c: No such file or directory."
is this path pointing to S which is externalsrc path or to B which is under build TMPDIR
and secondly, can you see compiler flags used during build for externalsrc ?
are you using master branch ?
what does show directories say
Quoted 9 lines
If I don't use externalsrc at all, I can debug all of the components and list source code for all of them from within gdb.
So, I can't solve how to get the externalsrc source code into the image. I don't mind if I have to use "set substitute-path" from within gdb if externalsrc source files are put in a different place (although, it'd be ideal if they were put in the same place).
sources are embedded in debug info, most probably when debug-split is done at that point there could be something going wrong where its not able to put the right path links