Re: [patch] Forbid "run" etc. for use_gdb_stub targets [Re: [patch] gdb.python/py-events.exp: Disable multi-inferior for gdbserver]

Jan Kratochvil
2011-10-28T17:40:36Z

On Thu, 27 Oct 2011 20:09:36 +0200, Pedro Alves wrote:
> Not sure what you mean. Is is that use_gdb_stub will be wrong?
> Maybe we can override it?

Done overriding both ways, to have use_gdb_stub always right.

Do you agree with it this way?

> > AFAIK there is currently no way to run the whole testsuite in extended
> > gdbserver mode.
[...]
> Missed those.

It was for kernel-based ugdb using extended-remote protocol, but I see now it
is not worth of a reusal for extended-remote FSF gdbserver run.
Re: ugdb for the gdb testsuite (failed)
http://sourceware.org/ml/archer/2010-q3/msg00147.html

> > + if {[regexp -nocase {^\s*(r|run|star|start|at|att|atta|attac|attach)\M} \
> > + $command]
> > + && [target_info exists use_gdb_stub]} {
> > + global gdbserver_protocol
> > +
> > + # gdbserver_start_extended runs as a part of non-extended configuration.
> > + if {![info exists gdbserver_protocol]
> > + || ![string match "extended-*" $gdbserver_protocol]} {
> > + error "gdbserver does not support $command without extended-remote"
> > + }
> > + }
>
> I think this should be:
>
> if {[info exists gdbserver_protocol]
> && ![string match "extended-*" $gdbserver_protocol]} {
> error "gdbserver does not support $command without extended-remote"
>
> We don't want to throw an error if gdbserver_protocol does not exist?

It was a leftover, thanks; anyway dropped this conditional now when
use_gdb_stub should be always correct now.

Thanks,
Jan

gdb/testsuite/
2011-10-28 Jan Kratochvil <jan.kratochvil@redhat.com>

* lib/gdb.exp (gdb_test_multiple): Forbid run, start or attach for
use_gdb_stub.
* lib/gdbserver-support.exp (gdbserver_start): Set use_gdb_stub for
gdb_protocol unset from the target board.
(gdbserver_start_extended): Set global gdbserver_protocol and
gdbserver_gdbport. Unset use_gdb_stub.

--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -601,6 +601,12 @@ proc gdb_test_multiple { command message user_code } {
error "Invalid newline in \"$message\" test"
}

+ if {[regexp -nocase {^\s*(r|run|star|start|at|att|atta|attac|attach)\M} \
+ $command]
+ && [target_info exists use_gdb_stub]} {
+ error "gdbserver does not support $command without extended-remote"
+ }
+
# TCL/EXPECT WART ALERT
# Expect does something very strange when it receives a single braced
# argument. It splits it along word separators and performs substitutions.
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -206,6 +206,7 @@ proc gdbserver_start { options arguments } {
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol]
} else {
+ set_currtarget_info use_gdb_stub 1
set protocol "remote"
}

@@ -337,9 +338,13 @@ proc gdbserver_reconnect { } {

# Start and connect to a gdbserver in extended mode.
proc gdbserver_start_extended { } {
+ global gdbserver_protocol
+ global gdbserver_gdbport
+
set res [gdbserver_start "--multi" ""]
set gdbserver_protocol "extended-[lindex $res 0]"
set gdbserver_gdbport [lindex $res 1]
+ unset_currtarget_info use_gdb_stub

return [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport]
}