Mercurial > hg > graal-jvmci-8
comparison src/share/vm/utilities/debug.hpp @ 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 | da91efe96a93 |
children | b8f261ba79c6 96a337d307bd |
comparison
equal
deleted
inserted
replaced
6998:49f0841607b7 | 6999:679e6584c177 |
---|---|
27 | 27 |
28 #include "prims/jvm.h" | 28 #include "prims/jvm.h" |
29 #include "utilities/globalDefinitions.hpp" | 29 #include "utilities/globalDefinitions.hpp" |
30 | 30 |
31 #include <stdarg.h> | 31 #include <stdarg.h> |
32 | |
33 #ifdef GRAAL | |
34 // Scopes a value that may be of interest in a crash log. | |
35 class DebugScopedValue { | |
36 protected: | |
37 DebugScopedValue *_parent; | |
38 const char* _file; | |
39 int _line; | |
40 public: | |
41 DebugScopedValue(const char* file, int line); | |
42 ~DebugScopedValue(); | |
43 void print(outputStream* st); | |
44 virtual void print_on(outputStream* st) = 0; | |
45 DebugScopedValue* parent() { return _parent; } | |
46 }; | |
47 | |
48 class DebugScopedScalar : DebugScopedValue { | |
49 private: | |
50 void* _value; | |
51 public: | |
52 DebugScopedScalar(const char* file, int line, void* v) : DebugScopedValue(file, line), _value(v) {} | |
53 void print_on(outputStream* st); | |
54 }; | |
55 #define DS_SCALAR(val) DebugScopedScalar __dss__(__FILE__, __LINE__, (void*) val) | |
56 #define DS_SCALAR1(name, val) DebugScopedScalar name(__FILE__, __LINE__, (void*) val) | |
57 #else | |
58 #define DS_SCALAR(name) do {} while (0) | |
59 #define DS_SCALAR1(name, val) do {} while (0) | |
60 #endif | |
32 | 61 |
33 // Simple class to format the ctor arguments into a fixed-sized buffer. | 62 // Simple class to format the ctor arguments into a fixed-sized buffer. |
34 class FormatBufferBase { | 63 class FormatBufferBase { |
35 protected: | 64 protected: |
36 char* _buf; | 65 char* _buf; |