[v2,1/5] image: add image-combined-dbg helper class

Message ID 1522776217-23250-2-git-send-email-kamensky@cisco.com
State New
Headers show
Series
  • systemtap adding sysroot, cross compiling of user land related scripts
Related show

Commit Message

Victor Kamensky April 3, 2018, 5:23 p.m.
There is IMAGE_GEN_DEBUGFS="1" variable that enables build of
additional rootfs-dbg and additional archive that contains
complimentary symbols files for a given image. But the issue
with this resulting directory and tarball that before use it
has to be combined with original image content. It is required
since all cross debugging tools like gdb, perf, and systemtap
need file system that contains both target executables/libraries
and their symbols. Those tools need to find executable/library
first and through it debuglink note find corresponding symbols
file.

image-combined-dbg when added to USER_CLASSES just copies
final resulting rootfs back into rootfs-dbg creating combined
target and debug symbols rootfs that can be used for debugging
directly.

Signed-off-by: Victor Kamensky <kamensky@cisco.com>

---
 meta/classes/image-combined-dbg.bbclass | 9 +++++++++
 meta/classes/image.bbclass              | 1 +
 2 files changed, 10 insertions(+)
 create mode 100644 meta/classes/image-combined-dbg.bbclass

-- 
2.7.4

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Richard Purdie April 3, 2018, 5:43 p.m. | #1
On Tue, 2018-04-03 at 10:23 -0700, Victor Kamensky wrote:
> There is IMAGE_GEN_DEBUGFS="1" variable that enables build of
> additional rootfs-dbg and additional archive that contains
> complimentary symbols files for a given image. But the issue
> with this resulting directory and tarball that before use it
> has to be combined with original image content. It is required
> since all cross debugging tools like gdb, perf, and systemtap
> need file system that contains both target executables/libraries
> and their symbols. Those tools need to find executable/library
> first and through it debuglink note find corresponding symbols
> file.
> 
> image-combined-dbg when added to USER_CLASSES just copies
> final resulting rootfs back into rootfs-dbg creating combined
> target and debug symbols rootfs that can be used for debugging
> directly.
> 
> Signed-off-by: Victor Kamensky <kamensky@cisco.com>
> ---
>  meta/classes/image-combined-dbg.bbclass | 9 +++++++++
>  meta/classes/image.bbclass              | 1 +
>  2 files changed, 10 insertions(+)
>  create mode 100644 meta/classes/image-combined-dbg.bbclass
> 
> diff --git a/meta/classes/image-combined-dbg.bbclass
> b/meta/classes/image-combined-dbg.bbclass
> new file mode 100644
> index 0000000..a709adf
> --- /dev/null
> +++ b/meta/classes/image-combined-dbg.bbclass
> @@ -0,0 +1,9 @@
> +IMAGE_PREPROCESS_COMMAND_append = " combine_dbg_image; "
> +
> +combine_dbg_image () {
> +        if [ "$IMAGE_GEN_DEBUGFS" = "1" -a -e ${IMAGE_ROOTFS}-dbg ];

Can you not just use ${IMAGE_GEN_DEBUGFS} and drop the export?

Cheers,

Richard

Patch

diff --git a/meta/classes/image-combined-dbg.bbclass b/meta/classes/image-combined-dbg.bbclass
new file mode 100644
index 0000000..a709adf
--- /dev/null
+++ b/meta/classes/image-combined-dbg.bbclass
@@ -0,0 +1,9 @@ 
+IMAGE_PREPROCESS_COMMAND_append = " combine_dbg_image; "
+
+combine_dbg_image () {
+        if [ "$IMAGE_GEN_DEBUGFS" = "1" -a -e ${IMAGE_ROOTFS}-dbg ]; then
+                # copy target files into -dbg rootfs, so it can be used for
+                # debug purposes directly
+                tar -C ${IMAGE_ROOTFS} -cf - . | tar -C ${IMAGE_ROOTFS}-dbg -xf -
+        fi
+}
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 1636eed..5ee9c55 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -268,6 +268,7 @@  fakeroot python do_image () {
     from oe.utils import execute_pre_post_process
 
     d.setVarFlag('REPRODUCIBLE_TIMESTAMP_ROOTFS', 'export', '1')
+    d.setVarFlag('IMAGE_GEN_DEBUGFS', 'export', '1')
     pre_process_cmds = d.getVar("IMAGE_PREPROCESS_COMMAND")
 
     execute_pre_post_process(d, pre_process_cmds)