From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 2/4] [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp for remote target
Date: Fri, 10 Mar 2023 16:34:31 +0100 [thread overview]
Message-ID: <20230310153433.6265-2-tdevries@suse.de> (raw)
In-Reply-To: <20230310153433.6265-1-tdevries@suse.de>
With test-case gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
and target board remote-gdbserver-on-localhost, I run into:
...
FAIL: $exp: runto: run to main
...
I can easily fix this using "gdb_load_shlib $binfile_lib", but then run into:
...
(gdb) print all_good^M
$1 = false^M
(gdb) FAIL: $exp: print all_good
info pretty-printer^M
...
Sysroot is set to "target:", so gdb downloads the shared library from the target
(Using $so as shorthand for
libpy-autoloaded-pretty-printers-in-newobjfile-event.so):
...
Reading /home/remote-target/$so from remote target...^M
...
and internally refers to it as "target:/home/remote-target/$so".
In load_auto_scripts_for_objfile, gdb gives up trying to auto-load scripts
for $so once it checks for is_target_filename.
Fix this by declaring auto-load unsupported if sysroot starts with "target:".
Tested on x86_64-linux.
---
...aded-pretty-printers-in-newobjfile-event.exp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
index eefa99c8fa1..3f6d8199c46 100644
--- a/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
+++ b/gdb/testsuite/gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp
@@ -60,11 +60,28 @@ set remote_python_event_handler_file\
gdb_test_no_output "source ${remote_python_event_handler_file}" "load python file"
gdb_load ${binfile}
+gdb_load_shlib $binfile_lib
if { ![runto_main] } {
return
}
+if { [is_remote target ] } {
+ set target_sysroot 0
+ gdb_test_multiple "show sysroot" "" {
+ -re -wrap "\r\nThe current system root is \"target:.*\"\\." {
+ set target_sysroot 1
+ }
+ -re -wrap "" {
+ }
+ }
+
+ if { $target_sysroot } {
+ unsupported "sysroot start with target: -- auto-load not supported"
+ return
+ }
+}
+
# Check that the new_objfile handler saw the pretty-printer.
gdb_test "print all_good" " = true"
--
2.35.3
next prev parent reply other threads:[~2023-03-10 15:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 15:34 [pushed 1/4] [gdb/testsuite] Fix gdb.python/py-event-load.exp " Tom de Vries
2023-03-10 15:34 ` Tom de Vries [this message]
2023-03-10 15:34 ` [pushed 3/4] [gdb/testsuite] Fix gdb.python/py-cmd.exp Tom de Vries
2023-03-10 15:34 ` [pushed 4/4] [gdb/testsuite] Fix gdb.python/py-completion.exp Tom de Vries
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=20230310153433.6265-2-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).