This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: getlocalvartable test falure
- From: Kyle Galloway <kgallowa at redhat dot com>
- To: java at gcc dot gnu dot org
- Date: Thu, 22 Feb 2007 14:19:47 -0500
- Subject: Re: getlocalvartable test falure
- References: <17884.26374.648591.317903@zebedee.pink>
Andrew Haley wrote:
FYI. Failure attached.
Andrew.
Running /home/aph/gcc/trunk/libjava/testsuite/libjava.jni/jni.exp ...
Running /home/aph/gcc/trunk/libjava/testsuite/libjava.jvmti/jvmti-interp.exp ...
LD_LIBRARY_PATH=. /home/aph/gcc/trunk/obj-i686-pc-linux-gnu/i686-pc-linux-gnu/./libjava/gij -cp /home/aph/gcc/trunk/libjava/testsuite/libjava.jvmti/interp/getlocalvartable.jar getlocalvartable
[snip]
Interestingly, this failure does not occur on x86_64, only on 32-bit
machines. The cause of this was that the Allocate calls for signature
and generic signature of the var table were using the wrong size
arguments. I have fixed this. I have also included fix to get rid of
the compile warnings, since these are related to the same block of
code. I also noticed that the test case itself was not calling
Deallocate on these same strings, and have included a fix for that as
well. The additional changes I consider trivial, but I can easily apply
the separately if that is desired.
Thanks,
Kyle
ChangeLog
2007-02-22 Kyle Galloway <kgallowa@redhat.com>
* jvmti.cc (_Jv_JVMTI_GetLocalVariableTable): Fix sizes in Allocate
calls and use a string pointer to
avoid build warnings.
* testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
(Java_getlocalvartable_do_1getlocalvartable_1tests): Deallocate
allocated strings.
Index: libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc
===================================================================
--- libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc (revision 122201)
+++ libjava/testsuite/libjava.jvmti/interp/natgetlocalvartable.cc (working copy)
@@ -53,8 +53,11 @@
{
printf ("Slot: %d\n", static_cast<int> (var_table[j].slot));
printf (" Name: %s\n", var_table[j].name);
+ jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table[j].name));
printf (" Sig: %s\n", var_table[j].signature);
+ jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table[j].signature));
printf (" Gen Sig: %s\n", var_table[j].generic_signature);
+ jvmti->Deallocate (reinterpret_cast<unsigned char *> (var_table[j].generic_signature));
printf (" Start Loc: %ld\n", static_cast<long> (var_table[j].start_location));
printf (" Length: %d\n", static_cast<int> (var_table[j].length));
}
Index: libjava/jvmti.cc
===================================================================
--- libjava/jvmti.cc (revision 122201)
+++ libjava/jvmti.cc (working copy)
@@ -997,23 +997,23 @@
table_slot)
>= 0)
{
+ char **str_ptr = &(*locals)[table_slot].name;
jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
- reinterpret_cast<unsigned char **>
- (&(*locals)[table_slot].name));
+ reinterpret_cast<unsigned char **> (str_ptr));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].name, name);
-
- jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
- reinterpret_cast<unsigned char **>
- (&(*locals)[table_slot].signature));
+
+ str_ptr = &(*locals)[table_slot].signature;
+ jerr = env->Allocate (static_cast<jlong> (strlen (sig) + 1),
+ reinterpret_cast<unsigned char **> (str_ptr));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].signature, sig);
-
- jerr = env->Allocate (static_cast<jlong> (strlen (name) + 1),
- reinterpret_cast<unsigned char **>
- (&(*locals)[table_slot].generic_signature));
+
+ str_ptr = &(*locals)[table_slot].generic_signature;
+ jerr = env->Allocate (static_cast<jlong> (strlen (generic_sig) + 1),
+ reinterpret_cast<unsigned char **> (str_ptr));
if (jerr != JVMTI_ERROR_NONE)
return jerr;
strcpy ((*locals)[table_slot].generic_signature, generic_sig);