Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
@ 2003-04-08 22:27 Kevin Buettner
  2003-04-08 22:44 ` Elena Zannoni
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Kevin Buettner @ 2003-04-08 22:27 UTC (permalink / raw)
  To: gdb-patches

I'm testing gdb against a simulator and I'm seeing the following in
the gdb.log output:

    (gdb) run
    Starting program: .../gdb/testsuite/gdb.base/args 1 3
    Don't know how to run.  Try "help target".
    (gdb) FAIL: gdb.base/args.exp: correct args printed

My first inclination was to simply skip this test for simulator
targets, but I decided that there's no reason not to run it.  I've
added a bit of code to invoke gdb_load for simulator targets and
wrapped it up in a proc so that it'll be easier to augment as other
targets are identified which can use a similar mechanism.

Comments?  (This is reasonably obvious, so I'll check this in a day or
so if there are no objections.)

	* gdb.base/args.exp: Invoke gdb_load for simulator targets. 
	Modify regexps to match extra output after program exit in a
	simulator.

Index: gdb.base/args.exp
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/args.exp,v
retrieving revision 1.3
diff -u -p -r1.3 args.exp
--- args.exp	2003/03/27 22:01:24	1.3
+++ args.exp	2003/04/08 22:04:40
@@ -31,6 +31,15 @@ if [target_info exists noargs] {
     return;
 }
 
+# No loading needs to be done when the target is `exec'.  Some targets
+# require that the program be loaded, however.
+proc args_load {} {
+    global binfile
+    if [target_info exists is_simulator] {
+	gdb_load ${binfile}
+    }
+}
+
 set testfile "args"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
@@ -47,8 +56,9 @@ set GDBFLAGS "--args $binfile 1 3"
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
+args_load
 gdb_test "run" \
-	"Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \
+	"Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally.*" \
 	"correct args printed"
 
 #
@@ -58,8 +68,9 @@ set GDBFLAGS "--args $binfile 1 '' 3"
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
+args_load
 gdb_test "run" \
-	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \
+	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally.*" \
 	"correct args printed, one empty"
 
 #
@@ -69,8 +80,9 @@ set GDBFLAGS "--args $binfile 1 '' '' 3"
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
+args_load
 gdb_test "run" \
-	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \
+	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally.*" \
 	"correct args printed, two empty"
 
 set GDBFLAGS $old_gdbflags


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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-08 22:27 [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets Kevin Buettner
@ 2003-04-08 22:44 ` Elena Zannoni
  2003-04-09 14:21 ` Andrew Cagney
  2003-04-16 20:32 ` Kevin Buettner
  2 siblings, 0 replies; 8+ messages in thread
From: Elena Zannoni @ 2003-04-08 22:44 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

Kevin Buettner writes:
 > I'm testing gdb against a simulator and I'm seeing the following in
 > the gdb.log output:
 > 
 >     (gdb) run
 >     Starting program: .../gdb/testsuite/gdb.base/args 1 3
 >     Don't know how to run.  Try "help target".
 >     (gdb) FAIL: gdb.base/args.exp: correct args printed
 > 
 > My first inclination was to simply skip this test for simulator
 > targets, but I decided that there's no reason not to run it.  I've
 > added a bit of code to invoke gdb_load for simulator targets and
 > wrapped it up in a proc so that it'll be easier to augment as other
 > targets are identified which can use a similar mechanism.
 > 
 > Comments?  (This is reasonably obvious, so I'll check this in a day or
 > so if there are no objections.)
 > 

Ah, thanks for fixing this Kevin. I remembered now that Michael Snyder
complained about the same problem, and I forgot to go back and fix it.

elena


 > 	* gdb.base/args.exp: Invoke gdb_load for simulator targets. 
 > 	Modify regexps to match extra output after program exit in a
 > 	simulator.
 > 
 > Index: gdb.base/args.exp
 > ===================================================================
 > RCS file: /cvs/cvsfiles/devo/gdb/testsuite/gdb.base/args.exp,v
 > retrieving revision 1.3
 > diff -u -p -r1.3 args.exp
 > --- args.exp	2003/03/27 22:01:24	1.3
 > +++ args.exp	2003/04/08 22:04:40
 > @@ -31,6 +31,15 @@ if [target_info exists noargs] {
 >      return;
 >  }
 >  
 > +# No loading needs to be done when the target is `exec'.  Some targets
 > +# require that the program be loaded, however.
 > +proc args_load {} {
 > +    global binfile
 > +    if [target_info exists is_simulator] {
 > +	gdb_load ${binfile}
 > +    }
 > +}
 > +
 >  set testfile "args"
 >  set srcfile ${testfile}.c
 >  set binfile ${objdir}/${subdir}/${testfile}
 > @@ -47,8 +56,9 @@ set GDBFLAGS "--args $binfile 1 3"
 >  gdb_exit
 >  gdb_start
 >  gdb_reinitialize_dir $srcdir/$subdir
 > +args_load
 >  gdb_test "run" \
 > -	"Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \
 > +	"Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally.*" \
 >  	"correct args printed"
 >  
 >  #
 > @@ -58,8 +68,9 @@ set GDBFLAGS "--args $binfile 1 '' 3"
 >  gdb_exit
 >  gdb_start
 >  gdb_reinitialize_dir $srcdir/$subdir
 > +args_load
 >  gdb_test "run" \
 > -	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \
 > +	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally.*" \
 >  	"correct args printed, one empty"
 >  
 >  #
 > @@ -69,8 +80,9 @@ set GDBFLAGS "--args $binfile 1 '' '' 3"
 >  gdb_exit
 >  gdb_start
 >  gdb_reinitialize_dir $srcdir/$subdir
 > +args_load
 >  gdb_test "run" \
 > -	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \
 > +	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally.*" \
 >  	"correct args printed, two empty"
 >  
 >  set GDBFLAGS $old_gdbflags


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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-08 22:27 [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets Kevin Buettner
  2003-04-08 22:44 ` Elena Zannoni
@ 2003-04-09 14:21 ` Andrew Cagney
  2003-04-09 16:07   ` Kevin Buettner
  2003-04-16 20:32 ` Kevin Buettner
  2 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-04-09 14:21 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> I'm testing gdb against a simulator and I'm seeing the following in
> the gdb.log output:
> 
>     (gdb) run
>     Starting program: .../gdb/testsuite/gdb.base/args 1 3
>     Don't know how to run.  Try "help target".
>     (gdb) FAIL: gdb.base/args.exp: correct args printed
> 
> My first inclination was to simply skip this test for simulator
> targets, but I decided that there's no reason not to run it.  I've
> added a bit of code to invoke gdb_load for simulator targets and
> wrapped it up in a proc so that it'll be easier to augment as other
> targets are identified which can use a similar mechanism.
> 
> Comments?  (This is reasonably obvious, so I'll check this in a day or
> so if there are no objections.)
> 
> 	* gdb.base/args.exp: Invoke gdb_load for simulator targets. 
> 	Modify regexps to match extra output after program exit in a
> 	simulator.

What's the extra output?  That part may be a bug.

Andrew



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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-09 14:21 ` Andrew Cagney
@ 2003-04-09 16:07   ` Kevin Buettner
  2003-04-09 16:15     ` Andrew Cagney
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin Buettner @ 2003-04-09 16:07 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

On Apr 9, 10:21am, Andrew Cagney wrote:

> > 	* gdb.base/args.exp: Invoke gdb_load for simulator targets. 
> > 	Modify regexps to match extra output after program exit in a
> > 	simulator.
> 
> What's the extra output?  That part may be a bug.

When running on a simulator, I see:

    (gdb) target sim
    Connected to the simulator.
    (gdb) load gdb.base/args
    (gdb) run
    Starting program: .../gdb.base/args 1 3
    3
    .../gdb.base/args
    1
    3

    Program exited normally.
    [Switching to process 0]
    Current language:  auto; currently asm
    (gdb) 

When running with a native gdb, I see:

    (gdb) run
    Starting program: .../gdb.base/args 1 3
    3
    .../gdb.base/args
    1
    3

    Program exited normally.
    (gdb) 

The extra output is the bit about switching to process 0 and reporting
the current language.  I figured it was a feature, but it may well be
a bug.  (It seems pretty harmless...)

Kevin


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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-09 16:07   ` Kevin Buettner
@ 2003-04-09 16:15     ` Andrew Cagney
  2003-04-13 19:46       ` Michael Snyder
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-04-09 16:15 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> On Apr 9, 10:21am, Andrew Cagney wrote:
> 
> 
>> > 	* gdb.base/args.exp: Invoke gdb_load for simulator targets. 
>> > 	Modify regexps to match extra output after program exit in a
>> > 	simulator.
> 
>> 
>> What's the extra output?  That part may be a bug.
> 
> 
> When running on a simulator, I see:
> 
>     (gdb) target sim
>     Connected to the simulator.
>     (gdb) load gdb.base/args
>     (gdb) run
>     Starting program: .../gdb.base/args 1 3
>     3
>     .../gdb.base/args
>     1
>     3
> 
>     Program exited normally.
>     [Switching to process 0]
>     Current language:  auto; currently asm
>     (gdb) 
> 
> When running with a native gdb, I see:
> 
>     (gdb) run
>     Starting program: .../gdb.base/args 1 3
>     3
>     .../gdb.base/args
>     1
>     3
> 
>     Program exited normally.
>     (gdb) 
> 
> The extra output is the bit about switching to process 0 and reporting
> the current language.  I figured it was a feature, but it may well be
> a bug.  (It seems pretty harmless...)

I recall that mysteriously appearing at some stage.  I don't think it is 
a feature since `Switching to process 0' doesn't make any sense - if the 
program exited normally then there are no processes.

I suspect that it is related to the SIM trying to simultaneously be an 
embedded board (which can't exit) and a normal UNIX process (which does 
exit).

I'd KFAIL it for now.  I'm expecting to work on SIM's shortly so will 
actually look at it.

Andrew



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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-09 16:15     ` Andrew Cagney
@ 2003-04-13 19:46       ` Michael Snyder
  2003-04-15  1:41         ` Elena Zannoni
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Snyder @ 2003-04-13 19:46 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Kevin Buettner, gdb-patches

Andrew Cagney wrote:
> 
> > On Apr 9, 10:21am, Andrew Cagney wrote:
> >
> >
> >> >    * gdb.base/args.exp: Invoke gdb_load for simulator targets.
> >> >    Modify regexps to match extra output after program exit in a
> >> >    simulator.
> >
> >>
> >> What's the extra output?  That part may be a bug.
> >
> >
> > When running on a simulator, I see:
> >
> >     (gdb) target sim
> >     Connected to the simulator.
> >     (gdb) load gdb.base/args
> >     (gdb) run
> >     Starting program: .../gdb.base/args 1 3
> >     3
> >     .../gdb.base/args
> >     1
> >     3
> >
> >     Program exited normally.
> >     [Switching to process 0]
> >     Current language:  auto; currently asm
> >     (gdb)
> >
> > When running with a native gdb, I see:
> >
> >     (gdb) run
> >     Starting program: .../gdb.base/args 1 3
> >     3
> >     .../gdb.base/args
> >     1
> >     3
> >
> >     Program exited normally.
> >     (gdb)
> >
> > The extra output is the bit about switching to process 0 and reporting
> > the current language.  I figured it was a feature, but it may well be
> > a bug.  (It seems pretty harmless...)
> 
> I recall that mysteriously appearing at some stage.  I don't think it is
> a feature since `Switching to process 0' doesn't make any sense - if the
> program exited normally then there are no processes.
> 
> I suspect that it is related to the SIM trying to simultaneously be an
> embedded board (which can't exit) and a normal UNIX process (which does
> exit).

I'd be more inclined to attribute it to some recent change
in infrun or close associates.  It thinks the inferior_pid
has changed.


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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-13 19:46       ` Michael Snyder
@ 2003-04-15  1:41         ` Elena Zannoni
  0 siblings, 0 replies; 8+ messages in thread
From: Elena Zannoni @ 2003-04-15  1:41 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Andrew Cagney, Kevin Buettner, gdb-patches

Michael Snyder writes:
 > Andrew Cagney wrote:
 > > 
 > > > On Apr 9, 10:21am, Andrew Cagney wrote:
 > > >
 > > >
 > > >> >    * gdb.base/args.exp: Invoke gdb_load for simulator targets.
 > > >> >    Modify regexps to match extra output after program exit in a
 > > >> >    simulator.
 > > >
 > > >>
 > > >> What's the extra output?  That part may be a bug.
 > > >
 > > >
 > > > When running on a simulator, I see:
 > > >
 > > >     (gdb) target sim
 > > >     Connected to the simulator.
 > > >     (gdb) load gdb.base/args
 > > >     (gdb) run
 > > >     Starting program: .../gdb.base/args 1 3
 > > >     3
 > > >     .../gdb.base/args
 > > >     1
 > > >     3
 > > >
 > > >     Program exited normally.
 > > >     [Switching to process 0]
 > > >     Current language:  auto; currently asm
 > > >     (gdb)
 > > >
 > > > When running with a native gdb, I see:
 > > >
 > > >     (gdb) run
 > > >     Starting program: .../gdb.base/args 1 3
 > > >     3
 > > >     .../gdb.base/args
 > > >     1
 > > >     3
 > > >
 > > >     Program exited normally.
 > > >     (gdb)
 > > >
 > > > The extra output is the bit about switching to process 0 and reporting
 > > > the current language.  I figured it was a feature, but it may well be
 > > > a bug.  (It seems pretty harmless...)
 > > 
 > > I recall that mysteriously appearing at some stage.  I don't think it is
 > > a feature since `Switching to process 0' doesn't make any sense - if the
 > > program exited normally then there are no processes.
 > > 
 > > I suspect that it is related to the SIM trying to simultaneously be an
 > > embedded board (which can't exit) and a normal UNIX process (which does
 > > exit).
 > 
 > I'd be more inclined to attribute it to some recent change
 > in infrun or close associates.  It thinks the inferior_pid
 > has changed.


That line is printed when we stop (normal_stop) and if
target_has_execution.  Maybe when the target exits, it used to pop
the target stack to a layer for which target_has_execution was 0? It
could be that now that doesn't happen anymore.

What's the target once it stops?

elena


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

* Re: [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets
  2003-04-08 22:27 [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets Kevin Buettner
  2003-04-08 22:44 ` Elena Zannoni
  2003-04-09 14:21 ` Andrew Cagney
@ 2003-04-16 20:32 ` Kevin Buettner
  2 siblings, 0 replies; 8+ messages in thread
From: Kevin Buettner @ 2003-04-16 20:32 UTC (permalink / raw)
  To: gdb-patches

I ended up committing the following patch.  (My original patch modified
some rexexps to match extra output after program exit in a simulator.  The
patch below does not do this.)

	* gdb.base/args.exp: Invoke gdb_load for simulator targets.

Index: gdb.base/args.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/args.exp,v
retrieving revision 1.5
diff -u -p -r1.5 args.exp
--- gdb.base/args.exp	20 Mar 2003 14:42:15 -0000	1.5
+++ gdb.base/args.exp	16 Apr 2003 20:28:52 -0000
@@ -31,6 +31,15 @@ if [target_info exists noargs] {
     return;
 }
 
+# No loading needs to be done when the target is `exec'.  Some targets
+# require that the program be loaded, however.
+proc args_load {} {
+    global binfile
+    if [target_info exists is_simulator] {
+	gdb_load ${binfile}
+    }
+}
+
 set testfile "args"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
@@ -47,6 +56,7 @@ set GDBFLAGS "--args $binfile 1 3"
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
+args_load
 gdb_test "run" \
 	"Starting program.*args(\\.exe)? 1 3.*3\r\n.*args\r\n1\r\n3.*Program exited normally." \
 	"correct args printed"
@@ -58,6 +68,7 @@ set GDBFLAGS "--args $binfile 1 '' 3"
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
+args_load
 gdb_test "run" \
 	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' 3.*4\r\n.*args\r\n1\r\n''\r\n3.*Program exited normally." \
 	"correct args printed, one empty"
@@ -69,6 +80,7 @@ set GDBFLAGS "--args $binfile 1 '' '' 3"
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
+args_load
 gdb_test "run" \
 	"Starting program.*args(\\.exe)? 1 \\\\'\\\\' \\\\'\\\\' 3.*5\r\n.*args\r\n1\r\n''\r\n''\r\n3.*Program exited normally." \
 	"correct args printed, two empty"


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

end of thread, other threads:[~2003-04-16 20:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 22:27 [RFC] gdb.base/args.exp: Invoke gdb_load for simulator targets Kevin Buettner
2003-04-08 22:44 ` Elena Zannoni
2003-04-09 14:21 ` Andrew Cagney
2003-04-09 16:07   ` Kevin Buettner
2003-04-09 16:15     ` Andrew Cagney
2003-04-13 19:46       ` Michael Snyder
2003-04-15  1:41         ` Elena Zannoni
2003-04-16 20:32 ` Kevin Buettner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox