< prev index next >
src/share/vm/utilities/debug.hpp
Print this page
rev 13108 : imported patch move_format_buffer
rev 13109 : imported patch move_pns
rev 13110 : imported patch target_macros
rev 13111 : imported patch flip_depend
*** 23,123 ****
*/
#ifndef SHARE_VM_UTILITIES_DEBUG_HPP
#define SHARE_VM_UTILITIES_DEBUG_HPP
! #include "utilities/globalDefinitions.hpp"
! #include "prims/jvm.h"
! #include <stdarg.h>
!
! // Simple class to format the ctor arguments into a fixed-sized buffer.
! class FormatBufferBase {
! protected:
! char* _buf;
! inline FormatBufferBase(char* buf) : _buf(buf) {}
! public:
! static const int BufferSize = 256;
! operator const char *() const { return _buf; }
! };
!
! // Use resource area for buffer
! class FormatBufferResource : public FormatBufferBase {
! public:
! FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
! };
!
! class FormatBufferDummy {};
!
! // Use stack for buffer
! template <size_t bufsz = FormatBufferBase::BufferSize>
! class FormatBuffer : public FormatBufferBase {
! public:
! inline FormatBuffer(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
! // since va_list is unspecified type (can be char*), we use FormatBufferDummy to disambiguate these constructors
! inline FormatBuffer(FormatBufferDummy dummy, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
! inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
! inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
! inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
!
! char* buffer() { return _buf; }
! int size() { return bufsz; }
!
! private:
! FormatBuffer(const FormatBuffer &); // prevent copies
! char _buffer[bufsz];
!
! protected:
! inline FormatBuffer();
! };
!
! template <size_t bufsz>
! FormatBuffer<bufsz>::FormatBuffer(const char * format, ...) : FormatBufferBase(_buffer) {
! va_list argp;
! va_start(argp, format);
! jio_vsnprintf(_buf, bufsz, format, argp);
! va_end(argp);
! }
!
! template <size_t bufsz>
! FormatBuffer<bufsz>::FormatBuffer(FormatBufferDummy dummy, const char * format, va_list ap) : FormatBufferBase(_buffer) {
! jio_vsnprintf(_buf, bufsz, format, ap);
! }
!
! template <size_t bufsz>
! FormatBuffer<bufsz>::FormatBuffer() : FormatBufferBase(_buffer) {
! _buf[0] = '\0';
! }
!
! template <size_t bufsz>
! void FormatBuffer<bufsz>::print(const char * format, ...) {
! va_list argp;
! va_start(argp, format);
! jio_vsnprintf(_buf, bufsz, format, argp);
! va_end(argp);
! }
!
! template <size_t bufsz>
! void FormatBuffer<bufsz>::printv(const char * format, va_list argp) {
! jio_vsnprintf(_buf, bufsz, format, argp);
! }
!
! template <size_t bufsz>
! void FormatBuffer<bufsz>::append(const char* format, ...) {
! // Given that the constructor does a vsnprintf we can assume that
! // _buf is already initialized.
! size_t len = strlen(_buf);
! char* buf_end = _buf + len;
!
! va_list argp;
! va_start(argp, format);
! jio_vsnprintf(buf_end, bufsz - len, format, argp);
! va_end(argp);
! }
!
! // Used to format messages.
! typedef FormatBuffer<> err_msg;
// assertions
#ifndef ASSERT
#define vmassert(p, ...)
#else
--- 23,37 ----
*/
#ifndef SHARE_VM_UTILITIES_DEBUG_HPP
#define SHARE_VM_UTILITIES_DEBUG_HPP
! #include "utilities/breakpoint.hpp"
! #include "utilities/compilerWarnings.hpp"
! #include "utilities/macros.hpp"
! #include <stddef.h>
// assertions
#ifndef ASSERT
#define vmassert(p, ...)
#else
*** 309,320 ****
// returns an address which is guaranteed to generate a SIGSEGV on read,
// for test purposes, which is not NULL and contains bits in every word
NOT_PRODUCT(void* get_segfault_address();)
void pd_ps(frame f);
- void pd_obfuscate_location(char *buf, size_t buflen);
-
- class outputStream;
- void print_native_stack(outputStream* st, frame fr, Thread* t, char* buf, int buf_size);
#endif // SHARE_VM_UTILITIES_DEBUG_HPP
--- 223,231 ----
// returns an address which is guaranteed to generate a SIGSEGV on read,
// for test purposes, which is not NULL and contains bits in every word
NOT_PRODUCT(void* get_segfault_address();)
+ class frame;
void pd_ps(frame f);
#endif // SHARE_VM_UTILITIES_DEBUG_HPP
< prev index next >