Commit Graph

894 Commits

Author SHA1 Message Date
Fumitoshi Ukai
da816ea706 Merge pull request #169 from mayah/windows-no-return
Add __declspec(noreturn) on Win
2017-03-07 12:44:37 +09:00
mayah
8fa778aa12 Add __declspec(noreturn) on Win
Currently cl.exe doesn't know LOG(FATAL) exits the program. Set
__declspec(noreturn).
2017-03-07 11:22:24 +09:00
Fumitoshi Ukai
ab6545470b Merge pull request #164 from yoshisatoyanagisawa/dcheck_always_on
DCHECK_ALWAYS_ON to make D* enabled under NDEBUG
2017-02-09 11:04:00 +09:00
Yoshisato Yanagisawa
027332ffac DCHECK_ALWAYS_ON to make D* enabled under NDEBUG
The macro NDEBUG could be automatically defined for release build on
some build environments (e.g. MSVC).  If we use NDEBUG as a key to
distinguish using DCHECK as CHECK (I call this DCHECK is enabled) or
not, we cannot make DCHECK enabled for release build on such
environments.

Considering people use a program with glog for presubmit testing or
dogfooding, they should need to do release build with DCHECK enabled.
2017-02-08 17:23:37 +09:00
Mike Percy
f581614a78 Use thread local for libunwind GetStackTrace()
Previously, the implementation of google::GetStackTrace() that uses
libunwind uses a global variable that enforces that only one thread may
invoke libunwind at a time. However, libunwind is thread-safe. The
comment above the variable indicates that it is to protect against
reentrancy issues.

Instead of using a global variable, it would be much better to use a
thread-local variable to protect against these reentrancy issues. That
should provide the needed reentrancy protection while allowing multiple
threads to get stack traces at the same time.

It also allows for the removal of the atomic CAS operations on the
variable.

Resolves #160.
2017-01-27 21:24:11 -08:00
Sergiu Deitsch
96a09ae01a fixed cygwin compilation errors 2017-01-17 12:47:11 +01:00
Sergiu Deitsch
b3dea50f33 cmake: do not hardcode relative install directories 2017-01-10 11:34:42 +01:00
Sergiu Deitsch
f2157a387b cmake: changed project name from google-glog to glog
This fixes the default install location on Windows. Specifically,
find_package works now out-of-the box with the default
CMAKE_INSTALL_PREFIX.
2017-01-10 11:15:18 +01:00
Pádraig Brady
dacd296796 rate limit calls to posix_fadvise()
There can be a large kernel overhead involved in POSIX_FADV_DONTNEED.
There is no point in calling this per item logged, so rate limit
to at most once per 2MiB written.

With a simple test program that logs 100K items at WARNING level:

Before:

  $ time strace -c -e fadvise64 log.test \
    -log_dir=/dev/shm -logtofiles=true -logtostderr=false
  % time     seconds  usecs/call     calls    errors syscall
  ------ ----------- ----------- --------- --------- ----------------
  100.00   12.522509         125     99957           fadvise64
  ------ ----------- ----------- --------- --------- ----------------
  real    0m52.671s
  user    0m2.194s
  sys     0m44.022s

After:

  $ time strace -c -e fadvise64 log.test \
    -log_dir=/dev/shm -logtofiles=true -logtostderr=false

  % time     seconds  usecs/call     calls    errors syscall
  ------ ----------- ----------- --------- --------- ----------------
  100.00    0.000759         152         5           fadvise64
  ------ ----------- ----------- --------- --------- ----------------
  real    0m4.206s
  user    0m1.436s
  sys     0m3.153s

Fixes issue #84
2016-12-09 19:45:34 +00:00
Ricardo Ribalda Delgado
5da5f2cac5 configure.ac: Allow user to disable gflags
Under some circumstances like cross-compilation, the user might not want
to enable support for gflags.

This patch allows support for --without-gflags

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
2016-10-20 15:59:19 +02:00
Fumitoshi Ukai
b6a5e0524c Update github.com/sergiud in AUTHORS/CONTRIBUTORS 2016-10-20 15:53:26 +09:00
Fumitoshi Ukai
9581b3fb9b Merge pull request #132 from sergiud/cmake-disable-unittests
cmake: allow to disable building unit tests
2016-10-19 16:40:55 +09:00
Sergiu Deitsch
60375e0bd4 cmake: allow to disable building unit tests
This commit introduces a CMake `BUILD_TESTING` boolean option that
allows to disable unit tests. This is especially useful in superbuilds
where typically only the main library is built. By default, this option
is enabled.
2016-10-19 09:32:21 +02:00
Fumitoshi Ukai
cf36dabd8e Merge pull request #127 from MinGW-caffe/master
try to avoid the error "conflicting declaration 'typedef DWORD pthread_t'" etc. in MinGW
2016-10-19 16:29:34 +09:00
Fumitoshi Ukai
5080258031 Add MiniLight to AUTHORS/CONTRIBUTORS 2016-10-19 16:28:53 +09:00
Fumitoshi Ukai
bf766fac4f Merge pull request #123 from yying/master
Set sinks_ to NULL after deletion in LogDestination::DeleteLogDestinations
2016-10-19 16:10:39 +09:00
Fumitoshi Ukai
ff5fa62a5f Add Andy Ying to AUTHORS/CONTRIBUTORS 2016-10-19 16:09:41 +09:00
Fumitoshi Ukai
7cff62028c Merge pull request #116 from pcc/fix2
Fix autotools build.
2016-10-19 16:06:38 +09:00
Fumitoshi Ukai
f5cc8631a4 Merge pull request #98 from willyd/relocatable
Added $<BUILD_INTERFACE> to gflags include directory
2016-10-19 16:02:49 +09:00
Fumitoshi Ukai
b3a1dc359d Add Guillaume Dumont to AUTHORS/CONTRIBUTORS 2016-10-19 15:59:24 +09:00
Fumitoshi Ukai
dee7c8c36e Merge pull request #129 from sergiud/cmake-PIC
cmake: enable position independent code (PIC)
2016-10-19 15:52:32 +09:00
Fumitoshi Ukai
fc61880361 Merge pull request #130 from sergiud/cmake-warning-fix
cmake: fixed clang warning propagation to gcc
2016-10-19 15:51:45 +09:00
Sergiu Deitsch
e6c26b2b94 cmake: fixed clang warning propagation to gcc 2016-10-07 11:03:19 +02:00
Sergiu Deitsch
e05f325668 cmake: enable position independent code (PIC) 2016-10-07 10:54:14 +02:00
MiniLight
9c584dd2ed try to avoid the error "conflicting declaration 'typedef DWORD
pthread_t'" etc.
2016-10-03 08:00:09 +08:00
Andy Ying
a00dfdfc53 NULL sinks_ after deletion to prevent dangling pointer 2016-09-11 01:16:32 -04:00
Ezequiel Lara Gomez
47af307fa6 Added fixed log name support
See https://code.google.com/p/google-glog/issues/detail?id=209 - this is an updated version of that patch.

It adds a flag that allows to switch behavior from base_filename + filename_extension + time_pid_string to base_filename + filename_extension, while still defaulting to the current behavior to avoid breakage in existing code. This change would allow easier log rotation schemes and better control on what's written on disk.
2016-09-08 10:52:39 +01:00
Fumitoshi Ukai
0472b91c5d Add Peter Collingbourne <pcc@google.com> to CONTRIBUTORS 2016-07-14 10:47:13 +09:00
Fumitoshi Ukai
f174cba02c Merge pull request #115 from pcc/fix1
symbolize: Calculate a module's zero VA using program headers.
2016-07-14 10:44:18 +09:00
Peter Collingbourne
8e98eb2a5a Fix autotools build.
It looks like commit 3c49b93 modified the auto-generated file src/config.h.in
to add a definition of macro GOOGLE_GLOG_DLL_DECL. One of the autotools
reverts this change upon running "make", causing the build to fail when a
source file includes demangle.h.

To fix the problem, revert the change to src/config.h.in and include
glog/logging.h from demangle.h which provides a definition of that macro.
2016-06-22 18:48:32 -07:00
Peter Collingbourne
a93a4511ec symbolize: Calculate a module's zero VA using program headers.
Previously we were using a module's "start address", i.e. the
address at which the module's executable region was mapped, as the
zero virtual address, i.e. the address from which the DSO's virtual
addresses are calculated. This works fine for DSOs created by the
bfd and gold linkers, which will emit a PT_LOAD directive into the
program header which loads the executable region at virtual address
(p_vaddr) and file offset (p_offset) 0.

However, the lld linker may place a read-only region before the
executable region, meaning that both p_vaddr and p_offset for the
executable region are non-zero. This means that any symbols resolved
by the symbolizer are resolved to an incorrect virtual address. To
correctly calculate the address corresponding to virtual address zero,
we need to take into account p_vaddr and p_offset.

Specifically, the calculation starts with the "base address", i.e. the
start address minus the file offset. To get from the base address to
virtual address zero, we first add p_offset. This gives us the mapped
address of the start of the segment, or in other words the mapped
address corresponding to the virtual address of the segment. (Note
that this is distinct from the start address, as p_offset is not
guaranteed to be page aligned.) We then subtract p_vaddr, which takes
us to virtual address zero.
2016-06-22 18:41:43 -07:00
dimhotepus
4544e968ab Cache strlen outside of cycles (PVS-Studio) 2016-04-30 14:24:12 +03:00
Fumitoshi Ukai
de6149ef8e Merge pull request #101 from yasushi-saito/master
Allow permission line in /proc/self/map to be "rwx", not just "r-x".
2016-04-15 17:05:30 +09:00
Fumitoshi Ukai
202b395c04 Merge pull request #91 from abdasgupta/master
Added support for PowerPC.
2016-04-13 14:00:49 +09:00
Fumitoshi Ukai
2a7423b346 Merge pull request #82 from sergiud/cmake-imported-target
Better support and documentation for CMake projects that consume glog
2016-04-13 13:59:08 +09:00
Yaz Saito on W541
d630221933 Allow permission line in /proc/self/map to be "rwx", not just "r-x". At
least in Ubuntu14, a binary file that's writable by the process owner
has permission "rwx", not "r-x".
2016-04-11 14:35:42 -07:00
Guillaume Dumont
45901a359f Added $<BUILD_INTERFACE> to gflags include to avoid including the gflags include dir in the glog-targets.cmake 2016-04-05 14:02:42 -04:00
Fumitoshi Ukai
f176cc8454 Merge pull request #96 from mayah/update-windows
Update src/windows/glog/logging.h to ToT
2016-03-31 17:50:09 +09:00
mayah
821d3e806e Run src/windows/preprocess.sh
src/windows/glog/logging.h is not generated by the current source.
Let me run src/windows/preprocess.sh and update the source.
2016-03-31 17:29:36 +09:00
Abhishek Dasgupta
b27d0420fb Added support for PowerPC. 2016-03-21 11:28:53 +00:00
Alexander Scheuermann
d68736bc1d Respect configured docdir
Avoid overriding the configured docdir inside the Makefile.
$(datarootdir)/doc/ may differ from $(prefix)/share/doc/
2016-03-04 08:55:28 +01:00
Sergiu Dotenco
c7e35f834c added CMake usage instructions 2016-01-08 15:31:10 +01:00
Sergiu Dotenco
780efcc857 cmake: allow to refer to imported glog target as glog::glog 2016-01-08 14:55:58 +01:00
Sergey Sharybin
f94a49c571 Resolve missing prototype warning
Makes compilation process less noisy even when using string compiler flags.
2015-12-31 17:55:37 +05:00
Fumitoshi Ukai
4d391fe692 use namespace GFLAGS_NAMESPACE instead namespace gflags
only signalhandler_unittest.cc uses "using namespace gflags".
others use "using namespace GFLAGS_NAMESPACE", so
signalhandler_unittest.cc does the same way.

fixes #62
2015-12-17 16:31:55 +09:00
Fumitoshi Ukai
a63f466c48 win: use _fdopen instead of fdopen
The POSIX function fdopen is deprecated.
Use the ISO C++ conformant _fdopen instead.
https://msdn.microsoft.com/library/ms235351.aspx

fixes #73
2015-12-17 15:40:25 +09:00
Fumitoshi Ukai
1256d28554 win: FAILED macro can't be used with HANDLE.
FAILED macro is for HRESULT, not for HANDLE.
FindFirstFile returns INVALID_HANDLE_VALUE when error or not found.
https://msdn.microsoft.com/library/windows/desktop/aa364418(v=vs.85).aspx

fixes #79
2015-12-17 15:36:40 +09:00
Fumitoshi Ukai
0312301143 avoid calling new/malloc in signalhandler.
FlushLogFilesUnsafe would be called in FailureSignalHandler,
so should avoid calling new/malloc, which are not signal safe.

fixes #78
2015-12-17 15:26:15 +09:00
Fumitoshi Ukai
de75983a81 Merge pull request #74 from yoshisatoyanagisawa/fix_sigabrt_action
Reset SIGABRT action only if FailureSignalHandler is installed.
2015-11-27 13:18:55 +09:00
Yoshisato Yanagisawa
cda16b3443 Reset SIGABRT action only if FailureSignalHandler is installed.
When I set my own signal handler to SIGABRT, it did not executed
with CHECK.  That is because SIGABRT handler is reset to default
just before glog calls abort.
Let me make it reset only if the handler is what glog installed
i.e. FailureSignalHandler.
2015-11-26 16:19:22 +09:00