diff mbox series

gcc-runtime: Move gdb pretty printer file to auto-load location

Message ID 20240129223250.42872-1-raj.khem@gmail.com
State Accepted, archived
Commit d24e16d192f21aa68b5274496efaba1d913f37c2
Headers show
Series gcc-runtime: Move gdb pretty printer file to auto-load location | expand

Commit Message

Khem Raj Jan. 29, 2024, 10:32 p.m. UTC
When debugging a C++ program on target using libcstdc++, gdb does not
find the pretty printer python support, this is because the init file is
installed into /usr/lib which is excluded from gdb's default list of
directories to load config's from, where as defaults to load from
datadir is still on, it therefore does not load this file

warning: File "/usr/lib/libstdc++.so.6.0.33-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".

This leaves the libstdc++ pretty-printers disabled even though added via
IMAGE_INSTALL += "gcc-runtime-dbg"

Add missing runtime dependency on datetime python module for the pretty
printer to work/load successfully.

Once the pretty-printer gdb file is moved out of libdir, it may become
empty therefore delete it if its empty.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-runtime.inc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Alexandre Belloni Jan. 30, 2024, 8:01 a.m. UTC | #1
This breaks on mingw:

https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/8517/steps/12/logs/stdio

On 29/01/2024 14:32:50-0800, Khem Raj wrote:
> When debugging a C++ program on target using libcstdc++, gdb does not
> find the pretty printer python support, this is because the init file is
> installed into /usr/lib which is excluded from gdb's default list of
> directories to load config's from, where as defaults to load from
> datadir is still on, it therefore does not load this file
> 
> warning: File "/usr/lib/libstdc++.so.6.0.33-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
> 
> This leaves the libstdc++ pretty-printers disabled even though added via
> IMAGE_INSTALL += "gcc-runtime-dbg"
> 
> Add missing runtime dependency on datetime python module for the pretty
> printer to work/load successfully.
> 
> Once the pretty-printer gdb file is moved out of libdir, it may become
> empty therefore delete it if its empty.
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/gcc/gcc-runtime.inc | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
> index 64b6168ba76..403ad76b5f2 100644
> --- a/meta/recipes-devtools/gcc/gcc-runtime.inc
> +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
> @@ -85,6 +85,8 @@ do_install () {
>  		cd ${B}/${TARGET_SYS}/$d/
>  		oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
>  	done
> +	install -d ${D}${datadir}/gdb/auto-load/${libdir}
> +	mv ${D}${libdir}/libstdc++.so.*-gdb.py ${D}${datadir}/gdb/auto-load/${libdir}
>  	if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
>  		install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include 
>  		mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
> @@ -99,6 +101,9 @@ do_install () {
>  	if [ -d ${D}${infodir} ]; then
>  		rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
>  	fi
> +	if [ -d ${D}${libdir} ]; then
> +		rmdir --ignore-fail-on-non-empty -p ${D}${libdir}
> +	fi
>  }
>  
>  do_install:append:class-target () {
> @@ -182,9 +187,11 @@ RRECOMMENDS:${PN}-dbg = ""
>  
>  # include python debugging scripts
>  FILES:${PN}-dbg += "\
> -    ${libdir}/libstdc++.*-gdb.py \
>      ${datadir}/gcc-${BINV}/python/libstdcxx \
> +    ${datadir}/gdb/auto-load \
>  "
> +# Needed by libstdcxx pretty printer
> +RDEPENDS:${PN}-dbg += "python3-datetime"
>  
>  FILES:libg2c = "${target_libdir}/libg2c.so.*"
>  SUMMARY:libg2c = "Companion runtime library for g77"
> -- 
> 2.43.0
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#194483): https://lists.openembedded.org/g/openembedded-core/message/194483
> Mute This Topic: https://lists.openembedded.org/mt/104038368/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index 64b6168ba76..403ad76b5f2 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -85,6 +85,8 @@  do_install () {
 		cd ${B}/${TARGET_SYS}/$d/
 		oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
 	done
+	install -d ${D}${datadir}/gdb/auto-load/${libdir}
+	mv ${D}${libdir}/libstdc++.so.*-gdb.py ${D}${datadir}/gdb/auto-load/${libdir}
 	if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
 		install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include 
 		mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
@@ -99,6 +101,9 @@  do_install () {
 	if [ -d ${D}${infodir} ]; then
 		rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
 	fi
+	if [ -d ${D}${libdir} ]; then
+		rmdir --ignore-fail-on-non-empty -p ${D}${libdir}
+	fi
 }
 
 do_install:append:class-target () {
@@ -182,9 +187,11 @@  RRECOMMENDS:${PN}-dbg = ""
 
 # include python debugging scripts
 FILES:${PN}-dbg += "\
-    ${libdir}/libstdc++.*-gdb.py \
     ${datadir}/gcc-${BINV}/python/libstdcxx \
+    ${datadir}/gdb/auto-load \
 "
+# Needed by libstdcxx pretty printer
+RDEPENDS:${PN}-dbg += "python3-datetime"
 
 FILES:libg2c = "${target_libdir}/libg2c.so.*"
 SUMMARY:libg2c = "Companion runtime library for g77"