* [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
@ 2002-04-01 13:55 Daniel Jacobowitz
2002-04-01 15:19 ` Fernando Nasser
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2002-04-01 13:55 UTC (permalink / raw)
To: gdb-patches, fnasser
At the current time, GCJ emits a call to _Jv_InitClass in the prologue of
jmisc.main. That's right, a function call in the prologue. What this means
to us is that if an argument does not have a second home in the function,
and it is passed in a register, we'll never be able to print it inside the
function. It will be clobbered by the time we stop outside of the prologue.
The only reason the test passed on i386 was because the incoming argument
was actually located on the stack (and thus survived the function call).
[this is especially nasty because failing to print a Java array makes GDB
very sad. It loops for hours, walking up the stack (very slowly because of
thread_db). We then kill gdb, which may or may not kill jmisc, so the
testsuite tends to leave zombies lying around.]
This patch adds a use of the argument after the prologue, so that it will
still be available to print. OK to commit?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2002-04-01 Daniel Jacobowitz <drow@mvista.com>
* gdb.java/jmisc.java: Add ``void foo (int len)''. Call it.
* gdb.java/jmisc.exp (ptype jmisc): Update to match.
Index: gdb.java/jmisc.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.exp,v
retrieving revision 1.2
diff -u -p -r1.2 jmisc.exp
--- jmisc.exp 2001/03/06 08:21:58 1.2
+++ jmisc.exp 2002/04/01 21:45:07
@@ -70,7 +70,7 @@ if ![set_lang_java] then {
send_gdb "ptype jmisc\n"
gdb_expect {
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
+ -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t\]+void foo\\(int\\);\[\r\n\ \t\]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
-re ".*$gdb_prompt $" { fail "ptype jmisc" }
timeout { fail "ptype jmisc (timeout)" ; return }
}
Index: gdb.java/jmisc.java
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.java,v
retrieving revision 1.1
diff -u -p -r1.1 jmisc.java
--- jmisc.java 2000/07/24 04:34:52 1.1
+++ jmisc.java 2002/04/01 21:45:07
@@ -1,7 +1,12 @@
public class jmisc
{
+ public static void foo (int len)
+ {
+ return;
+ }
public static void main (String[] args)
{
+ foo (args.length);
return;
}
}
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
2002-04-01 13:55 [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC Daniel Jacobowitz
@ 2002-04-01 15:19 ` Fernando Nasser
0 siblings, 0 replies; 8+ messages in thread
From: Fernando Nasser @ 2002-04-01 15:19 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, Anthony Green
Anthony,
Do you have any objections?
Regards,
Fernando
Daniel Jacobowitz wrote:
>
> At the current time, GCJ emits a call to _Jv_InitClass in the prologue of
> jmisc.main. That's right, a function call in the prologue. What this means
> to us is that if an argument does not have a second home in the function,
> and it is passed in a register, we'll never be able to print it inside the
> function. It will be clobbered by the time we stop outside of the prologue.
> The only reason the test passed on i386 was because the incoming argument
> was actually located on the stack (and thus survived the function call).
>
> [this is especially nasty because failing to print a Java array makes GDB
> very sad. It loops for hours, walking up the stack (very slowly because of
> thread_db). We then kill gdb, which may or may not kill jmisc, so the
> testsuite tends to leave zombies lying around.]
>
> This patch adds a use of the argument after the prologue, so that it will
> still be available to print. OK to commit?
>
> --
> Daniel Jacobowitz Carnegie Mellon University
> MontaVista Software Debian GNU/Linux Developer
>
> 2002-04-01 Daniel Jacobowitz <drow@mvista.com>
>
> * gdb.java/jmisc.java: Add ``void foo (int len)''. Call it.
> * gdb.java/jmisc.exp (ptype jmisc): Update to match.
>
> Index: gdb.java/jmisc.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.exp,v
> retrieving revision 1.2
> diff -u -p -r1.2 jmisc.exp
> --- jmisc.exp 2001/03/06 08:21:58 1.2
> +++ jmisc.exp 2002/04/01 21:45:07
> @@ -70,7 +70,7 @@ if ![set_lang_java] then {
>
> send_gdb "ptype jmisc\n"
> gdb_expect {
> - -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
> + -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t\]+void foo\\(int\\);\[\r\n\ \t\]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
> -re ".*$gdb_prompt $" { fail "ptype jmisc" }
> timeout { fail "ptype jmisc (timeout)" ; return }
> }
> Index: gdb.java/jmisc.java
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.java,v
> retrieving revision 1.1
> diff -u -p -r1.1 jmisc.java
> --- jmisc.java 2000/07/24 04:34:52 1.1
> +++ jmisc.java 2002/04/01 21:45:07
> @@ -1,7 +1,12 @@
> public class jmisc
> {
> + public static void foo (int len)
> + {
> + return;
> + }
> public static void main (String[] args)
> {
> + foo (args.length);
> return;
> }
> }
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
@ 2002-04-01 19:43 Michael Elizabeth Chastain
2002-04-01 19:49 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-01 19:43 UTC (permalink / raw)
To: drow, fnasser, gdb-patches
Daniel Jacobowitz writes:
> [this is especially nasty because failing to print a Java array makes GDB
> very sad. It loops for hours, walking up the stack (very slowly because of
> thread_db). We then kill gdb, which may or may not kill jmisc, so the
> testsuite tends to leave zombies lying around.]
Maybe my view of the world is a little twisted, but I think a test case
is good when it makes gdb lose its mind. I am in favor of changing the
test suite to work around bugs in compilers and other tools that are
outside our responsibility but gdb is inside our responsibility.
> This patch adds a use of the argument after the prologue, so that it will
> still be available to print. OK to commit?
I would rather keep the original test and file a bug report. Perhaps
clone the test so that you can test the behavior that you want to test
as well as banging on the broken behavior.
My two cents,
Michael C
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
2002-04-01 19:43 Michael Elizabeth Chastain
@ 2002-04-01 19:49 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2002-04-01 19:49 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: fnasser, gdb-patches
On Mon, Apr 01, 2002 at 09:42:59PM -0600, Michael Elizabeth Chastain wrote:
> Daniel Jacobowitz writes:
> > [this is especially nasty because failing to print a Java array makes GDB
> > very sad. It loops for hours, walking up the stack (very slowly because of
> > thread_db). We then kill gdb, which may or may not kill jmisc, so the
> > testsuite tends to leave zombies lying around.]
>
> Maybe my view of the world is a little twisted, but I think a test case
> is good when it makes gdb lose its mind. I am in favor of changing the
> test suite to work around bugs in compilers and other tools that are
> outside our responsibility but gdb is inside our responsibility.
>
> > This patch adds a use of the argument after the prologue, so that it will
> > still be available to print. OK to commit?
>
> I would rather keep the original test and file a bug report. Perhaps
> clone the test so that you can test the behavior that you want to test
> as well as banging on the broken behavior.
That's a good view of the world. It's not practical in this case
unless you're volunteering to fix it, though :) This bug causes a
testsuite run via | tee <file> to hang forever. Testsuites are no good
if we can't run them! Bug reports are good for tracking, but I would
prefer filing a bug on the fact that Java will print unreasonably long
arrays (i.e. corrupt length field).
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
@ 2002-04-01 20:01 Michael Elizabeth Chastain
2002-04-01 20:48 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-01 20:01 UTC (permalink / raw)
To: drow; +Cc: fnasser, gdb-patches
Okay, I'll volunteer, but I don't have any PPC hardware. If you
send me a binary test program, will I be able to get somewhere with a
powerpc-unknown-eabi cross gdb?
I will see if I can at least make gdb throw up instead of going into a
silent death spiral.
Michael C
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
2002-04-01 20:01 Michael Elizabeth Chastain
@ 2002-04-01 20:48 ` Daniel Jacobowitz
2002-04-01 23:08 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2002-04-01 20:48 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: fnasser, gdb-patches
On Mon, Apr 01, 2002 at 10:01:44PM -0600, Michael Elizabeth Chastain wrote:
> Okay, I'll volunteer, but I don't have any PPC hardware. If you
> send me a binary test program, will I be able to get somewhere with a
> powerpc-unknown-eabi cross gdb?
>
> I will see if I can at least make gdb throw up instead of going into a
> silent death spiral.
I can't think how. Running Java programs requires a threads package,
as best I can tell - if it's possible without, I can't see how...
Actually, though, I figured out where the problem lies. I'll spare you
the investigation and try to fix it myself.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
2002-04-01 20:48 ` Daniel Jacobowitz
@ 2002-04-01 23:08 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2002-04-01 23:08 UTC (permalink / raw)
To: Michael Elizabeth Chastain, fnasser, gdb-patches
On Mon, Apr 01, 2002 at 11:48:14PM -0500, Daniel Jacobowitz wrote:
> On Mon, Apr 01, 2002 at 10:01:44PM -0600, Michael Elizabeth Chastain wrote:
> > Okay, I'll volunteer, but I don't have any PPC hardware. If you
> > send me a binary test program, will I be able to get somewhere with a
> > powerpc-unknown-eabi cross gdb?
> >
> > I will see if I can at least make gdb throw up instead of going into a
> > silent death spiral.
>
> I can't think how. Running Java programs requires a threads package,
> as best I can tell - if it's possible without, I can't see how...
>
> Actually, though, I figured out where the problem lies. I'll spare you
> the investigation and try to fix it myself.
Here's a revised testsuite patch. This one only adds tests, doesn't
remove any. The patch to fix the others will be in my next message.
This one better, Michael?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2002-04-01 Daniel Jacobowitz <drow@mvista.com>
* gdb.java/jmisc.java: Add ``void foo (String[] args)''. Call it.
* gdb.java/jmisc2.java: New test.
* gdb.java/jmisc.exp (ptype jmisc): Update to match ``foo''. Add
test for jmisc2.
Index: testsuite/gdb.java/jmisc2.java
===================================================================
RCS file: N/A
diff -u /dev/null testsuite/gdb.java/jmisc2.java
--- /dev/null Wed Dec 31 19:00:00 1969
+++ testsuite/gdb.java/jmisc2.java Tue Apr 2 02:03:47 2002
@@ -0,0 +1,7 @@
+public class jmisc2
+{
+ public static void main (String[] args)
+ {
+ return;
+ }
+}
Index: testsuite/gdb.java/jmisc.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.exp,v
retrieving revision 1.2
diff -u -p -r1.2 jmisc.exp
--- testsuite/gdb.java/jmisc.exp 2001/03/06 08:21:58 1.2
+++ testsuite/gdb.java/jmisc.exp 2002/04/02 07:04:23
@@ -34,6 +34,14 @@ if { [compile_java_from_source ${srcfil
return -1
}
+set testfile2 "jmisc2"
+set srcfile2 ${srcdir}/$subdir/${testfile2}.java
+set binfile2 ${objdir}/${subdir}/${testfile2}
+if { [compile_java_from_source ${srcfile2} ${binfile2} "-g"] != "" } {
+ untested "Couldn't compile ${srcfile2}"
+ return -1
+}
+
# Set the current language to java. This counts as a test. If it
# fails, then we skip the other tests.
@@ -70,7 +78,7 @@ if ![set_lang_java] then {
send_gdb "ptype jmisc\n"
gdb_expect {
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
+ -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t\]+void foo\\(java\.lang\.String\\\[]\\);\[\r\n\ \t\]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
-re ".*$gdb_prompt $" { fail "ptype jmisc" }
timeout { fail "ptype jmisc (timeout)" ; return }
}
@@ -87,5 +95,29 @@ if ![set_lang_java] then {
-re "\\\$2 = \{length: 0\}\[\r\n\ \t]+$gdb_prompt $" { pass "p *args" }
-re ".*$gdb_prompt $" { fail "p *args" }
timeout { fail "p *args (timeout)" ; return }
+ }
+}
+
+# Start a clean gdb on jmisc2
+set testfile ${testfile2}
+set srcfile ${srcfile2}
+set binfile ${binfile2}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+if ![set_lang_java] then {
+ runto ${testfile}.main
+
+ # On architectures where arguments are passed in registers (not on the
+ # stack), if the argument to main is dead, GCJ's call to _Jv_Init may
+ # corrupt the argument pointer. Make sure GDB doesn't crash printing
+ # the (possibly corrupt) pointer.
+ send_gdb "p *args\n"
+ gdb_expect {
+ -re ".*$gdb_prompt $"
+ { pass "p *args a second time" }
+ timeout { fail "p *args a second time (timeout)" ; return }
}
}
Index: testsuite/gdb.java/jmisc.java
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jmisc.java,v
retrieving revision 1.1
diff -u -p -r1.1 jmisc.java
--- testsuite/gdb.java/jmisc.java 2000/07/24 04:34:52 1.1
+++ testsuite/gdb.java/jmisc.java 2002/04/02 07:04:23
@@ -1,7 +1,12 @@
public class jmisc
{
+ public static void foo (String[] args)
+ {
+ return;
+ }
public static void main (String[] args)
{
+ foo (args);
return;
}
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC
@ 2002-04-02 8:24 Michael Elizabeth Chastain
0 siblings, 0 replies; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2002-04-02 8:24 UTC (permalink / raw)
To: drow, fnasser, gdb-patches
Indeed, I like this better. I also like the comment about the corruption
so that someone, some time, can have a clue when they start debugging it.
Michael C
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-04-02 16:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-01 13:55 [RFA/testsuite] Tweak gdb.java/jmisc.java to pass on PowerPC Daniel Jacobowitz
2002-04-01 15:19 ` Fernando Nasser
2002-04-01 19:43 Michael Elizabeth Chastain
2002-04-01 19:49 ` Daniel Jacobowitz
2002-04-01 20:01 Michael Elizabeth Chastain
2002-04-01 20:48 ` Daniel Jacobowitz
2002-04-01 23:08 ` Daniel Jacobowitz
2002-04-02 8:24 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox