From: bugzilla@busybox.net
To: buildroot@uclibc.org
Subject: [Buildroot] [Bug 14026] New: gdb pretty printers import script sets incorrect path
Date: Sat, 15 Jun 2024 14:59:21 +0000 [thread overview]
Message-ID: <bug-14026-163@https.bugs.busybox.net/> (raw)
https://bugs.busybox.net/show_bug.cgi?id=14026
Bug ID: 14026
Summary: gdb pretty printers import script sets incorrect path
Product: buildroot
Version: 2021.02.3
Hardware: All
OS: Linux
Status: RESOLVED
Severity: normal
Priority: P5
Component: Other
Assignee: unassigned@buildroot.uclibc.org
Reporter: dennis.peeten@heliox-energy.com
CC: buildroot@uclibc.org, yann.morin.1998@free.fr
Target Milestone: ---
Status: RESOLVED
Resolution: MOVED
CC: yann.morin.1998@free.fr
Created attachment 9056
--> https://bugs.busybox.net/attachment.cgi?id=9056&action=edit
gdb-pretty-printers-import-script-workaround.patch
gcc-10.3.0
libstdc++ 6.0.28
python 3.9
gdb 10.3
How to reproduce:
- build firmware with:
BR2_GCC_VERSION_10_X=y
BR2_GCC_VERSION="10.3.0"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_HOST_GDB_TUI=y
BR2_PACKAGE_HOST_GDB_PYTHON3=y
BR2_GDB_VERSION_10=y
BR2_GDB_VERSION="10.1"
BR2_PACKAGE_GDB_ARCH_SUPPORTS=y
BR2_PACKAGE_GDB=y
BR2_PACKAGE_GDB_SERVER=y
BR2_PACKAGE_HOST_PYTHON3=y
- cross compile c++ application with debug symbols.
- remotely debug application on the target.
- print the value of an stl object.
Expected:
A human readable value.
Actually:
Dumps the implementation details of the stl objects.
gdb also prints this error:
Traceback (most recent call last):
File
"/opt/heliox/some-board-sdk/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libstdc++.so.6.0.28-gdb.py",
line 61, in <module>
from libstdcxx.v6 import register_libstdcxx_printers
ModuleNotFoundError: No module named 'libstdcxx'
Root cause:
The script that fails is the python import script. It is supplied by
gcc/libstdc++ and is generated from this template:
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/python/hook.in
The script is supposed to set the path to the libstdcxx python module, import
it and register the printers with gdb.
It has the correct info to do so, however it manages to mess it up in my case.
The script contains two hard-coded paths:
pythondir = '/opt/heliox/some-board-sdk/share/gcc-10.3.0/python/'
libdir = '/opt/heliox/some-board-sdk/arm-buildroot-linux-gnueabihf/lib'
The pythondir is the exact path needed for the import. Replacing the whole
script with just:
sys.path.insert(0, '/opt/heliox/some-board-sdk/share/gcc-10.3.0/python/')
from libstdcxx.v6 import register_libstdcxx_printers
register_libstdcxx_printers(gdb.current_objfile())
Fixes my problem.
The error occurs when the script tries to construct a relative path from libdir
to pythondir and append that to the directory of the object file being debugged
(/opt/heliox/some-board-sdk/arm-buildroot-linux-gnueabihf/sysroot/lib/libstdc++.so.6)
This results in a non existent path:
/opt/heliox/some-board-sdk/arm-buildroot-linux-gnueabihf/sysroot/lib/../../share/gcc-10.3.0/python
I don't know enough python to understand why a new path needs to be
constructed, however it seems to me that the path calculation is wrong;
it should calculate the relative path from object dir to pythondir and append
that to the object dir.
For now I added a patch with a workaround (see attached file).
Kind regards,
Dennis Peeten.
--- Comment #1 from Yann E. MORIN <yann.morin.1998@free.fr> ---
Thank you for your report.
The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
https://gitlab.com/buildroot.org/buildroot/-/issues
We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.
Thank you!
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
reply other threads:[~2024-06-15 14:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-14026-163@https.bugs.busybox.net/ \
--to=bugzilla@busybox.net \
--cc=buildroot@uclibc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox