1450 } |
1450 } |
1451 |
1451 |
1452 |
1452 |
1453 void FrameValues::print() { |
1453 void FrameValues::print() { |
1454 _values.sort(compare); |
1454 _values.sort(compare); |
1455 intptr_t* v0 = _values.at(0).location; |
1455 JavaThread* thread = JavaThread::current(); |
1456 intptr_t* v1 = _values.at(_values.length() - 1).location; |
1456 |
|
1457 // Sometimes values like the fp can be invalid values if the |
|
1458 // register map wasn't updated during the walk. Trim out values |
|
1459 // that aren't actually in the stack of the thread. |
|
1460 int min_index = 0; |
|
1461 int max_index = _values.length() - 1; |
|
1462 intptr_t* v0 = _values.at(min_index).location; |
|
1463 while (!thread->is_in_stack((address)v0)) { |
|
1464 v0 = _values.at(++min_index).location; |
|
1465 } |
|
1466 intptr_t* v1 = _values.at(max_index).location; |
|
1467 while (!thread->is_in_stack((address)v1)) { |
|
1468 v1 = _values.at(--max_index).location; |
|
1469 } |
1457 intptr_t* min = MIN2(v0, v1); |
1470 intptr_t* min = MIN2(v0, v1); |
1458 intptr_t* max = MAX2(v0, v1); |
1471 intptr_t* max = MAX2(v0, v1); |
1459 intptr_t* cur = max; |
1472 intptr_t* cur = max; |
1460 intptr_t* last = NULL; |
1473 intptr_t* last = NULL; |
1461 for (int i = _values.length() - 1; i >= 0; i--) { |
1474 for (int i = max_index; i >= min_index; i--) { |
1462 FrameValue fv = _values.at(i); |
1475 FrameValue fv = _values.at(i); |
1463 while (cur > fv.location) { |
1476 while (cur > fv.location) { |
1464 tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur); |
1477 tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur); |
1465 cur--; |
1478 cur--; |
1466 } |
1479 } |