Fix SEGV on Android x86_64.
PiperOrigin-RevId: 344348469 Change-Id: Ib5402c0d3ea33c2c40725756840e068ecafd5de4
This commit is contained in:
parent
8999616910
commit
9258528a78
@ -13,11 +13,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
|
|
||||||
#include "tensorflow/lite/minimal_logging.h"
|
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
#include "tensorflow/lite/minimal_logging.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace logging_internal {
|
namespace logging_internal {
|
||||||
namespace {
|
namespace {
|
||||||
@ -40,14 +41,17 @@ int GetPlatformSeverity(LogSeverity severity) {
|
|||||||
void MinimalLogger::LogFormatted(LogSeverity severity, const char* format,
|
void MinimalLogger::LogFormatted(LogSeverity severity, const char* format,
|
||||||
va_list args) {
|
va_list args) {
|
||||||
// First log to Android's explicit log(cat) API.
|
// First log to Android's explicit log(cat) API.
|
||||||
va_list args_for_android_log;
|
va_list args_copy;
|
||||||
va_copy(args_for_android_log, args);
|
va_copy(args_copy, args);
|
||||||
__android_log_vprint(GetPlatformSeverity(severity), "tflite", format, args);
|
__android_log_vprint(GetPlatformSeverity(severity), "tflite", format,
|
||||||
va_end(args_for_android_log);
|
args_copy);
|
||||||
|
va_end(args_copy);
|
||||||
|
|
||||||
// Also print to stderr for standard console applications.
|
// Also print to stderr for standard console applications.
|
||||||
fprintf(stderr, "%s: ", GetSeverityName(severity));
|
fprintf(stderr, "%s: ", GetSeverityName(severity));
|
||||||
vfprintf(stderr, format, args);
|
va_copy(args_copy, args);
|
||||||
|
vfprintf(stderr, format, args_copy);
|
||||||
|
va_end(args_copy);
|
||||||
fputc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user