class Testy { /* *Thisisusedtoverifythatthefixdoesn'tfilteroutfieldsthatit *shouldn't.7isanabitrarynumber,andthisisn'tadefinitive *test;thefixcouldconceivablyfilteroutthe89thfieldofaclass *namedFoo. *Toverifythatthispartofthistestworks,firstuncommentthefield8 *lineandverifythatthetestfails,andthenrenameafieldtoxxxand *verifythatthetestfails.
*/ int field1; int field2; int field3; int field4; int field5; int field6; finalstaticint field7 = 7; // Value is the number of fields. //int field8;
Testy() {
}
}
class BacktraceFieldTarg { publicstaticvoid gus() {
}
publicstaticvoid main(String[] args) throws Exception { new BacktraceFieldTest(args).startTests();
}
privatevoid printval(ArrayReference backTraceVal, int index) throws Exception {
ArrayReference val = (ArrayReference)backTraceVal.getValue(index);
println("BT: val at " + index + " = " + val);
// The segv used to happen here for index = 0 // Now all objects in the backtrace are objects.
Object xVal = (Object)val.getValue(0);
println("BT: xVal = " + xVal);
}
List allFields = ((ReferenceType)(lv.type())).allFields();
println("BT: allFields = " + allFields);
/* *Searchthroughthefieldsofeetoverifythat *java.lang.Throwable.backtraceisn'tthere.
*/ boolean backtrace_found = false;
Iterator iter = allFields.iterator(); while(iter.hasNext()) {
Field ff = (Field)iter.next(); if (ff.toString().equals("java.lang.Throwable.backtrace")) {
backtrace_found = true;
println("java.lang.Throwable.backtrace field not filtered out.");
/* *Ifyouwanttoexperiencethesegvthisbugcauses,change *thistestto1==1andrunitwithjdk1.4,build74orearlier
*/ if (1 == 1) { // The following code will show the segv that this can cause.
ObjectReference myVal = (ObjectReference)myFrame.getValue(lv);
println("BT: myVal = " + myVal);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.