public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed 1/4] [gdb/testsuite] Fix gdb.python/py-event-load.exp for remote target
@ 2023-03-10 15:34 Tom de Vries
  2023-03-10 15:34 ` [pushed 2/4] [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp " Tom de Vries
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom de Vries @ 2023-03-10 15:34 UTC (permalink / raw)
  To: gdb-patches

Fix test-case gdb.python/py-event-load.exp for target board
remote-gdbserver-on-localhost using gdb_download_shlib.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.python/py-event-load.exp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.python/py-event-load.exp b/gdb/testsuite/gdb.python/py-event-load.exp
index ac2331cdd8b..1375cf675d0 100644
--- a/gdb/testsuite/gdb.python/py-event-load.exp
+++ b/gdb/testsuite/gdb.python/py-event-load.exp
@@ -36,20 +36,21 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 set testfile2 py-events-shlib
 set srcfile2 ${testfile2}.c
 set binfile2 [standard_output_file ${testfile2}.so]
-set binfile2_dlopen [shlib_target_file ${testfile2}.so]
 if {[gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" \
 	 ${binfile2} {debug}] != ""} {
     untested "failed to compile shared library"
     return -1
 }
 
+set binfile2_dlopen [gdb_download_shlib $binfile2]
+
 clean_restart $testfile
 
 if {![runto_main]} {
     return
 }
 
-gdb_test_no_output "set var libname = \"$binfile2_dlopen\""
+gdb_test_no_output "set var libname = \"$binfile2_dlopen\"" "set var libname"
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/py-event-load.py]
 gdb_test_no_output "source ${pyfile}" "load python file"

base-commit: 6349d27e30a6495830e27c64271168e921c622a0
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed 2/4] [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp for remote target
  2023-03-10 15:34 [pushed 1/4] [gdb/testsuite] Fix gdb.python/py-event-load.exp for remote target Tom de Vries
@ 2023-03-10 15:34 ` Tom de Vries
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2023-03-10 15:34 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed 3/4] [gdb/testsuite] Fix gdb.python/py-cmd.exp
  2023-03-10 15:34 [pushed 1/4] [gdb/testsuite] Fix gdb.python/py-event-load.exp for remote target Tom de Vries
  2023-03-10 15:34 ` [pushed 2/4] [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp " Tom de Vries
@ 2023-03-10 15:34 ` Tom de Vries
  2023-03-10 15:34 ` [pushed 4/4] [gdb/testsuite] Fix gdb.python/py-completion.exp Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2023-03-10 15:34 UTC (permalink / raw)
  To: gdb-patches

[ Using $pp as shorthand for the pagination prompt
"--Type <RET> for more, q to quit, c to continue without paging--". ]

The test-case gdb.python/py-cmd.exp passes, but the handling of the
test_multiline command output looks a bit odd:
...
(gdb) test_multiline
test_multiline output
  ...
test_multiline output
$ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline
q
test_multiline
Quit
(gdb) test_multiline
test_multiline output
  ...
test_multiline output
$ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline: q
...

What happens is:
- a test_multiline command is issued
- some output is printed, followed by a pagination prompt
- the test-case concludes that pagination occurred, and produces a PASS
- "q\n" is replied to the pagination prompt
- without waiting for response to the "q\n", another test_multiline command is
  issued
- in response to the "q\n" we get "Quit\n(gdb) "
- some output is printed, followed by a pagination prompt
- the test-case concludes that there's a valid response to the "q\n", and
  produces a PASS, consuming the second pagination prompt, but without a reply.

My conclusion is that the second test_multiline command is unintentional, so fix
this by removing it.

Without it, we have the more straightforward:
...
(gdb) test_multiline
test_multiline output
  ...
test_multiline output
$ppPASS: gdb.python/py-cmd.exp: verify pagination from test_multiline
q
Quit
(gdb) PASS: gdb.python/py-cmd.exp: verify pagination from test_multiline: q
...

This also fixes the following warning with target board native-gdbserver:
...
WARNING: Timed out waiting for EOF in server after monitor exit
...

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.python/py-cmd.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index 016ea445f10..12b52e4fd61 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -291,7 +291,7 @@ gdb_test_multiple "test_multiline" $test {
 
 send_gdb "q\n"
 set test "verify pagination from test_multiline: q"
-gdb_test_multiple "test_multiline" $test {
+gdb_test_multiple "" $test {
     -re "Error occurred in Python" {
 	fail $test
     }
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed 4/4] [gdb/testsuite] Fix gdb.python/py-completion.exp
  2023-03-10 15:34 [pushed 1/4] [gdb/testsuite] Fix gdb.python/py-event-load.exp for remote target Tom de Vries
  2023-03-10 15:34 ` [pushed 2/4] [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp " Tom de Vries
  2023-03-10 15:34 ` [pushed 3/4] [gdb/testsuite] Fix gdb.python/py-cmd.exp Tom de Vries
@ 2023-03-10 15:34 ` Tom de Vries
  2 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2023-03-10 15:34 UTC (permalink / raw)
  To: gdb-patches

With test-case gdb.python/py-completion.exp and target board
native-extended-gdbserver I get this warning:
...
(gdb) PASS: gdb.python/py-completion.exp: discard #2
completefilecommandcond $outputs/gdb.python/py-completion/py-completion-t^G\
  PASS: gdb.python/py-completion.exp: completefilecommandcond completion
Remote debugging from host ::1, port 53346^M
monitor exit^M
not implemented^M
(gdb) WARNING: Timed out waiting for EOF in server after monitor exit
...

Fix this by adding the missing "discard #3", such that we have instead:
...
(gdb) PASS: gdb.python/py-completion.exp: discard #2
completefilecommandcond $outputs/gdb.python/py-completion/py-completion-t^G\
  PASS: gdb.python/py-completion.exp: completefilecommandcond completion
 ^M
not implemented^M
(gdb) PASS: gdb.python/py-completion.exp: discard #3
Remote debugging from host ::1, port 36278^M
monitor exit^M
(gdb)
...

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.python/py-completion.exp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/testsuite/gdb.python/py-completion.exp b/gdb/testsuite/gdb.python/py-completion.exp
index b3acebf66a1..23f981e944a 100644
--- a/gdb/testsuite/gdb.python/py-completion.exp
+++ b/gdb/testsuite/gdb.python/py-completion.exp
@@ -72,6 +72,8 @@ if { [readline_is_used] && ![is_remote host] } {
 	}
     }
 
+    # Discarding again
+    gdb_test " " ".*" "discard #[incr discard]"
 }
 
 # Start gdb over again to clear out current state.  This can interfere
-- 
2.35.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-10 15:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 15:34 [pushed 1/4] [gdb/testsuite] Fix gdb.python/py-event-load.exp for remote target Tom de Vries
2023-03-10 15:34 ` [pushed 2/4] [gdb/testsuite] Fix py-autoloaded-pretty-printers-in-newobjfile-event.exp " Tom de Vries
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

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).