comparison src/share/vm/utilities/debug.cpp @ 6999:679e6584c177

added ScopedDebugValue to add values of interest to hs_err crash logs
author Doug Simon <doug.simon@oracle.com>
date Wed, 21 Nov 2012 19:23:43 +0100
parents 4202510ee0fe
children 291ffc492eb6
comparison
equal deleted inserted replaced
6998:49f0841607b7 6999:679e6584c177
858 } 858 }
859 } 859 }
860 #endif 860 #endif
861 861
862 #endif // !PRODUCT 862 #endif // !PRODUCT
863
864 #ifdef GRAAL
865
866 DebugScopedValue::DebugScopedValue(const char* file, int line) {
867 _file = file;
868 _line = line;
869 Thread* thread = Thread::current();
870 if (thread != NULL && thread->is_Java_thread()) {
871 JavaThread* javaThread = (JavaThread*) thread;
872 _parent = javaThread->debug_scope();
873 javaThread->set_debug_scope(this);
874 } else {
875 _parent = NULL;
876 }
877 }
878
879 DebugScopedValue::~DebugScopedValue() {
880 Thread* thread = Thread::current();
881 if (thread != NULL && thread->is_Java_thread()) {
882 JavaThread* javaThread = (JavaThread*) thread;
883 javaThread->set_debug_scope(_parent);
884 _parent = NULL;
885 }
886 }
887
888 void DebugScopedValue::print(outputStream* st) {
889 st->print("%s:%d: ", _file, _line);
890 print_on(st);
891 }
892
893 void DebugScopedScalar::print_on(outputStream* st) {
894 st->print("int: %d, char: %c, long: %ld, hex: %p", _value, _value, _value, _value);
895 }
896 #endif