diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-19 00:14:34 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-19 00:14:34 +0000 |
commit | 45c67cfec69f0e42623ed8fbd0f11a486e26f711 (patch) | |
tree | 1292f9b7b33e095d60e7cb8a46a139269f637d6f /native_client_sdk | |
parent | ccb97c17989516e9c6e7a1a625b6552d247f4df3 (diff) | |
download | chromium_src-45c67cfec69f0e42623ed8fbd0f11a486e26f711.zip chromium_src-45c67cfec69f0e42623ed8fbd0f11a486e26f711.tar.gz chromium_src-45c67cfec69f0e42623ed8fbd0f11a486e26f711.tar.bz2 |
[NaCl SDK] Improve low level logging system for nacl_io.
We still need a higher level logging system that goes do through
the C library but this facitity is very useful for debugging
and working on nacl_io.
R=binji@chromium.org
Review URL: https://codereview.chromium.org/243633007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/dbgprint.h | 16 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc | 8 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/library.dsc | 4 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/log.c (renamed from native_client_sdk/src/libraries/nacl_io/dbgprint.c) | 4 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/log.h | 35 | ||||
-rw-r--r-- | native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc | 4 |
6 files changed, 45 insertions, 26 deletions
diff --git a/native_client_sdk/src/libraries/nacl_io/dbgprint.h b/native_client_sdk/src/libraries/nacl_io/dbgprint.h deleted file mode 100644 index 91fcf58..0000000 --- a/native_client_sdk/src/libraries/nacl_io/dbgprint.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) 2013 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. */ - -#ifndef LIBRARIES_NACL_IO_DBGPRINT_H_ -#define LIBRARIES_NACL_IO_DBGPRINT_H_ - -#include "sdk_util/macros.h" - -EXTERN_C_BEGIN - -void dbgprintf(const char* format, ...) PRINTF_LIKE(1, 2); - -EXTERN_C_END - -#endif /* LIBRARIES_NACL_IO_DBGPRINT_H_ */ diff --git a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc index 2603158..f5f8089 100644 --- a/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc +++ b/native_client_sdk/src/libraries/nacl_io/httpfs/http_fs.cc @@ -17,10 +17,10 @@ #include <ppapi/c/pp_errors.h> -#include "nacl_io/dbgprint.h" #include "nacl_io/dir_node.h" #include "nacl_io/httpfs/http_fs_node.h" #include "nacl_io/kernel_handle.h" +#include "nacl_io/log.h" #include "nacl_io/osinttypes.h" #include "nacl_io/osunistd.h" #include "sdk_util/string_util.h" @@ -319,7 +319,7 @@ Error HttpFs::ParseManifest(const char* text) { mode = S_IFCHR; break; default: - dbgprintf("Unable to parse type %s for %s.\n", + LOG_ERROR("Unable to parse type %s for %s.\n", modestr.c_str(), name.c_str()); return EINVAL; @@ -332,7 +332,7 @@ Error HttpFs::ParseManifest(const char* text) { mode |= S_IRUSR | S_IRGRP | S_IROTH; break; default: - dbgprintf("Unable to parse read %s for %s.\n", + LOG_ERROR("Unable to parse read %s for %s.\n", modestr.c_str(), name.c_str()); return EINVAL; @@ -345,7 +345,7 @@ Error HttpFs::ParseManifest(const char* text) { mode |= S_IWUSR | S_IWGRP | S_IWOTH; break; default: - dbgprintf("Unable to parse write %s for %s.\n", + LOG_ERROR("Unable to parse write %s for %s.\n", modestr.c_str(), name.c_str()); return EINVAL; diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc index 14855cc..dbc2bb2 100644 --- a/native_client_sdk/src/libraries/nacl_io/library.dsc +++ b/native_client_sdk/src/libraries/nacl_io/library.dsc @@ -11,7 +11,6 @@ 'NAME' : 'nacl_io', 'TYPE' : 'lib', 'SOURCES' : [ - 'dbgprint.c', "devfs/dev_fs.cc", "devfs/jspipe_node.cc", "devfs/tty_event_emitter.cc", @@ -40,6 +39,7 @@ "kernel_wrap_glibc.cc", "kernel_wrap_newlib.cc", "kernel_wrap_win.cc", + "log.c", "memfs/mem_fs.cc", "memfs/mem_fs_node.cc", "nacl_io.cc", @@ -161,7 +161,6 @@ { 'FILES': [ "char_node.h", - "dbgprint.h", "devfs/dev_fs.h", "devfs/jspipe_node.h", "devfs/tty_event_emitter.h", @@ -192,6 +191,7 @@ "kernel_proxy.h", "kernel_wrap.h", "kernel_wrap_real.h", + "log.h", "memfs/mem_fs.h", "memfs/mem_fs_node.h", "nacl_io.h", diff --git a/native_client_sdk/src/libraries/nacl_io/dbgprint.c b/native_client_sdk/src/libraries/nacl_io/log.c index b8a5bdf..cc36cc7 100644 --- a/native_client_sdk/src/libraries/nacl_io/dbgprint.c +++ b/native_client_sdk/src/libraries/nacl_io/log.c @@ -2,7 +2,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "nacl_io/dbgprint.h" +#include "nacl_io/log.h" #include "nacl_io/kernel_wrap_real.h" @@ -11,7 +11,7 @@ #include <stdio.h> #include <string.h> -void dbgprintf(const char* format, ...) { +void nacl_io_log(const char* format, ...) { va_list args; size_t wrote; char* output; diff --git a/native_client_sdk/src/libraries/nacl_io/log.h b/native_client_sdk/src/libraries/nacl_io/log.h new file mode 100644 index 0000000..4e1a88e --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/log.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#ifndef LIBRARIES_NACL_IO_LOG_H_ +#define LIBRARIES_NACL_IO_LOG_H_ + +#include "sdk_util/macros.h" + +#define LOG_PREFIX "nacl_io: " + +#if defined(NACL_IO_LOGGING) +#define LOG_TRACE(format, ...) \ + nacl_io_log(LOG_PREFIX format "\n", ##__VA_ARGS__) +#else +#define LOG_TRACE(format, ...) +#endif + +#define LOG_ERROR(format, ...) \ + nacl_io_log(LOG_PREFIX "error: " format "\n", ##__VA_ARGS__) + +EXTERN_C_BEGIN + +/* + * Low level logging function for nacl_io log messages. + * + * This function sends its output directly to the IRT standard out + * file descriptor, which by default will apear on the standard out + * or chrome or sel_ldr. + */ +void nacl_io_log(const char* format, ...) PRINTF_LIKE(1, 2); + +EXTERN_C_END + +#endif /* LIBRARIES_NACL_IO_LOG_H_ */ diff --git a/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc b/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc index 3fcc7a0..946cdd4 100644 --- a/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc +++ b/native_client_sdk/src/libraries/nacl_io/real_pepper_interface.cc @@ -8,7 +8,7 @@ #include <stdio.h> #include <ppapi/c/pp_errors.h> -#include "nacl_io/dbgprint.h" +#include "nacl_io/log.h" namespace nacl_io { @@ -88,7 +88,7 @@ RealPepperInterface::RealPepperInterface(PP_Instance instance, if (iface) \ BaseClass##interface_ = new Real##BaseClass(iface); \ else \ - dbgprintf("nacl_io: interface missing: %s\n", InterfaceString); \ + LOG_ERROR("interface missing: %s\n", InterfaceString); \ } #include "nacl_io/pepper/all_interfaces.h" } |