OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
8 #include "vm/os.h" | 8 #include "vm/os.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 // Print the error message into the buffer. | 28 // Print the error message into the buffer. |
29 va_list arguments; | 29 va_list arguments; |
30 va_start(arguments, format); | 30 va_start(arguments, format); |
31 vsnprintf(buffer + file_and_line_length, | 31 vsnprintf(buffer + file_and_line_length, |
32 sizeof(buffer) - file_and_line_length, | 32 sizeof(buffer) - file_and_line_length, |
33 format, | 33 format, |
34 arguments); | 34 arguments); |
35 va_end(arguments); | 35 va_end(arguments); |
36 | 36 |
37 // Print the buffer on stderr. | 37 // Print the buffer on stderr and/or syslog. |
38 fprintf(stderr, "%s\n", buffer); | 38 OS::PrintErr("%s\n", buffer); |
39 fflush(stderr); | 39 fflush(stderr); |
siva
2016/07/08 16:25:20
OS::PrintErr does a fflush of the stream, this ffl
rmacnak
2016/07/08 18:08:58
Done.
| |
40 | 40 |
41 // In case of failed assertions, abort right away. Otherwise, wait | 41 // In case of failed assertions, abort right away. Otherwise, wait |
42 // until the program is exiting before producing a non-zero exit | 42 // until the program is exiting before producing a non-zero exit |
43 // code through abort. | 43 // code through abort. |
44 // TODO(5411324): replace std::abort with OS::Abort so that we can handle | 44 // TODO(5411324): replace std::abort with OS::Abort so that we can handle |
45 // restoring of signal handlers before aborting. | 45 // restoring of signal handlers before aborting. |
46 if (kind_ == ASSERT) { | 46 if (kind_ == ASSERT) { |
47 OS::Abort(); | 47 OS::Abort(); |
48 } | 48 } |
49 static bool failed = false; | 49 static bool failed = false; |
50 if (!failed) { | 50 if (!failed) { |
51 atexit(&failed_exit); | 51 atexit(&failed_exit); |
52 } | 52 } |
53 failed = true; | 53 failed = true; |
54 } | 54 } |
55 | 55 |
56 } // namespace dart | 56 } // namespace dart |
OLD | NEW |