summaryrefslogtreecommitdiffstats
path: root/runtime/indenter.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-11-05 16:12:57 -0800
committerIan Rogers <irogers@google.com>2013-11-06 12:00:14 -0800
commitfa82427c68b09f4aedbee319dc71579afbfc66f5 (patch)
treeb8ae1c7be4a00dce290887ee857be5e466a0902b /runtime/indenter.h
parent6b98c91275d4361d1b74effad36995cc2d687a55 (diff)
downloadart-fa82427c68b09f4aedbee319dc71579afbfc66f5.tar.gz
art-fa82427c68b09f4aedbee319dc71579afbfc66f5.tar.bz2
art-fa82427c68b09f4aedbee319dc71579afbfc66f5.zip
Fix oatdump and valgrind.
Bug: 11531382 Move allocation instrumentation out of runtime into instrumentation. Don't attempt to suspend threads in unstarted runtimes. Make indentation support sputc returning eof, on which it will sync and try again. A further failure likely means the disk is full. Move the dump-oat output directory to be art as now there's too much output to fit all the dump-oat data in our standard /tmp. Change-Id: I8ea848ace318552c180e2efa46570288ff1ca62c
Diffstat (limited to 'runtime/indenter.h')
-rw-r--r--runtime/indenter.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/runtime/indenter.h b/runtime/indenter.h
index c432e1ba8d..d055d4e3f4 100644
--- a/runtime/indenter.h
+++ b/runtime/indenter.h
@@ -17,6 +17,7 @@
#ifndef ART_RUNTIME_INDENTER_H_
#define ART_RUNTIME_INDENTER_H_
+#include "base/logging.h"
#include "base/macros.h"
#include <streambuf>
@@ -30,16 +31,28 @@ class Indenter : public std::streambuf {
private:
int_type overflow(int_type c) {
- if (c != std::char_traits<char>::eof()) {
- if (indent_next_) {
- for (size_t i = 0; i < count_; ++i) {
- out_sbuf_->sputc(text_);
+ if (UNLIKELY(c == std::char_traits<char>::eof())) {
+ out_sbuf_->pubsync();
+ return c;
+ }
+ if (indent_next_) {
+ for (size_t i = 0; i < count_; ++i) {
+ int_type r = out_sbuf_->sputc(text_);
+ if (UNLIKELY(r != text_)) {
+ out_sbuf_->pubsync();
+ r = out_sbuf_->sputc(text_);
+ CHECK_EQ(r, text_) << "Error writing to buffer. Disk full?";
}
}
- out_sbuf_->sputc(c);
- indent_next_ = (c == '\n');
}
- return std::char_traits<char>::not_eof(c);
+ indent_next_ = (c == '\n');
+ int_type r = out_sbuf_->sputc(c);
+ if (UNLIKELY(r != c)) {
+ out_sbuf_->pubsync();
+ r = out_sbuf_->sputc(c);
+ CHECK_EQ(r, c) << "Error writing to buffer. Disk full?";
+ }
+ return r;
}
int sync() {