Commit Graph

445 Commits

Author SHA1 Message Date
Shinichiro Hamaji
64041397b3 Use static to define CheckStackTrace on non-GNU (#429)
for `&CheckStackAddress`, VisualStudio emits address of a trampoline like PLT, 
not the actual address of `CheckStackTrace`.

We need address of `CheckStackTrace` to guess the address range of the function.
`static` function seems to return the actual address of the function.

Fixes #421
2019-02-02 10:13:43 +09:00
Shinichiro Hamaji
7f91846ca1 Stop using auto_ptr (#428)
Stop using auto_ptr

std::unique_ptr requires -std=c++11. just use raw pointer.
2019-02-01 17:35:02 +09:00
Peter Mutsaers
e5588de96d remove time from raw logging 2019-01-29 23:38:03 +01:00
Shinichiro Hamaji
ed1ef7c4db Apply #397 to glog/logging.h.in
windows/glog/logging.h is expected to be generated by
src/windows/preprocess.sh and should not be modified directly.
2019-01-24 09:25:43 +09:00
Ky Waegel
342fa2674c
Use push/pop macro when supressing warning
* Same as PR #397 , but for the `.in` file. Useful for some unusual cross-platform build environments (e.g. WSL).
2019-01-22 10:59:05 -08:00
Shinichiro Hamaji
6d6d31872e Run src/windows/preprocess.sh 2019-01-22 20:58:13 +09:00
Haakan Younes
5d46e1bcfc Add demangle support for ABI tags. (#416)
Support ABI tags after <local-source-name> in demangle.cc.
Update the reference URL.

Fixes #50
2019-01-07 15:30:23 +09:00
Thomas Anderson
7fcb278d1e Fix demangling template parameter packs (#414)
* Fix demangling template parameter packs

Clang 4.0.1-10 and gcc 7.3.0 both mangle the function "void add<int>(int)" as
"_Z3addIJiEEvDpT_".  The template parameter pack is of the form
J <template-arg>* E

The opening character for a param pack could be either I or J, as libiberty
follows [1].  This change simply adds the J case.

[1] fbd263526a/libiberty/cp-demangle.c (L3209)
2019-01-07 15:26:08 +09:00
Sergiu Deitsch
0e4ce7c0c0
Merge pull request #410 from jackwish/fix/build/cleanup
build: cleanup temps and remove NEWS
2019-01-01 01:27:42 +01:00
Victor Costan
0989ffadb8 Fix unused variable warning in GCC. 2018-12-25 16:54:08 -08:00
王振华 (WANG Zhenhua)
5a22c3cdc0 build: remove automake temporaries 2018-12-19 11:54:06 +00:00
NeroBurner
e0cabc5404 remove register keyword from unittest 2018-12-13 08:15:52 +01:00
Sergiu Deitsch
702c533ce0
Merge pull request #397 from kwaegel/patch-1
Use push/pop macro when supressing warning
2018-12-12 10:18:17 +01:00
Roman Gershman
6adf6d7ae5 fix debug build using gcc -fsanitize=undefined (#374) 2018-12-12 10:16:49 +01:00
Ky Waegel
615d0b9712
Use push/pop macro when supressing warning
* Previous implementation did not correctly restore the warning state if initially disabled.
2018-11-27 17:35:07 -08:00
Taiju Tsuiki
781096619d Upstream Chromium local changes to symbolize.cc (#391)
* Upstream Chromium local changes to symbolize.cc

Chromium has its own fork of symbolize.cc and symbolize.h, and it has
several not-yet-upstreamed changes, that are not specific to Chromium.

This patch upstreams such a changes.

  Fixed google::FindSymbol reading past end of a section
  3dae0a2d7d

  Fix -INT_MIN integer overflow in itoa_r().
  ac4d28e9cb

  Add print_unsymbolized_stack_traces gn arg.
  6a2726776f

  Switch to standard integer types in base/.
  9b6f42934e

* Add a build option to print unsymbolized traces

This PRINT_UNSYMBOLIZED_STACK_TRACES option to cmake, and
--enable-unsymbolized-traces option to autoconf.
2018-11-21 11:14:38 +09:00
tzik
1081df6e5c Make symbolize.cc thread safe even on shared fds
ReadFromOffset in symbolize.cc used to call lseek() + read() to read
data from fd. However, the fd may be reused for multiple symbolize
requests from multiple threads, and causes a race around the fd read
offset.

This updates it to use pread() to resolve the race.
2018-11-13 12:55:09 +09:00
Sergiu Deitsch
e364e754a6
Merge pull request #367 from bsilver8192/master
Don't crash on some forms of invalid ELF files
2018-10-23 21:50:06 +02:00
Taras Zaporozhets
a9393f0909 Fix mistype in comment 2018-10-17 15:54:37 +03:00
Hemant
41a6a7880e
Fix warnings
Fixed these warnings:

src/logging_unittest.cc: At global scope:
src/logging_unittest.cc:1081:13: warning: 'void MyCheck(bool, bool)' defined but not used [-Wunused-function]
 static void MyCheck(bool a, bool b) {
             ^~~~~~~
src/logging_unittest.cc:1078:13: warning: 'void MyFatal()' defined but not used [-Wunused-function]
 static void MyFatal() {
             ^~~~~~~
2018-10-12 13:25:19 +01:00
Brian Silverman
91e3fdcefc Don't crash on some forms of invalid ELF files
With a few tweaks, it will fail to look up symbol names in these cases
instead.
2018-09-18 17:08:27 -07:00
Jacob Trimble
a606c3187b Allow getpwuid_r to return missing entry.
If the getpwuid_r method doesn't find an entry with the given ID, it
will still return success (0), but the *result will be set to NULL.
This checks the |result| value so it won't crash if it doesn't find
the entry.

This normally shouldn't ever happen, but it can somehow happen on
iOS simulators.
2018-07-27 10:58:18 -07:00
Dzung Hoang
87b82b2362 fix errors with BUILD_SHARED_LIBS=ON for Visual Studio 2017 2018-07-16 02:10:05 -05:00
Sergiu Deitsch
3267f3e1a8
Merge pull request #331 from NeroBurner/fix_windows_logging_ut
Fix windows logging ut
2018-06-29 12:31:45 +02:00
NeroBurner
5fa1d59065 tests: fix compilation with C++17
Remove throw() commands as they were deprecated with C++11 and are
removed with C++17
2018-06-21 14:05:09 +02:00
Artem Dinaburg
f39f78c7cc Define constants for _open and silence some warnings 2018-06-20 12:50:50 +02:00
Artem Dinaburg
b54793d232 Windows has the fc utility to compare files instead of diff 2018-06-20 12:50:50 +02:00
Artem Dinaburg
62c3e3cd56 The %p format is implementation defined. Compare it via a special token,
just like the null pointer test.
2018-06-20 12:50:50 +02:00
NeroBurner
364fad5649 port: remove unused includes 2018-06-01 14:50:12 +02:00
NeroBurner
800bd423e4 port: split localtime_r definition and impl 2018-06-01 14:50:12 +02:00
NeroBurner
7450a8b345 mingw-w64: check if localtime_r exists
- check in cmake if localtime_r exists
- if localtime_r is missing (MSVC, mingw-w64 on linux) redefine it using
  localtime_s
2018-06-01 14:50:11 +02:00
NeroBurner
0797f7382b mingw-w64: fix port.h pthread recreation 2018-06-01 14:50:10 +02:00
NeroBurner
d354e2e8f9 mingw-w64: fix dbghelp on case sensitive systems
- fix dbhelp.h include
- fix dbghelp check and link
2018-06-01 14:50:07 +02:00
NeroBurner
06a8ee0976 logging: fix basetsd on case sensitive sytems 2018-06-01 14:50:06 +02:00
Ruslan Baratov
d064ab8d0a Fix build for Android API < 21 2018-04-22 23:54:24 +03:00
Sergiu Deitsch
2f493d292c
Merge pull request #302 from Nazg-Gul/missing-prototype
Resolve missing prototype warning
2018-03-21 13:45:06 +01:00
Sergiu Deitsch
11afec2795
Merge pull request #303 from Nazg-Gul/reincluded-config
Fix redefined warnings from config.h
2018-03-21 13:44:44 +01:00
samuela
838753987f
Make int conversion explicit and fix clang warning 2018-03-20 18:03:46 -07:00
Sergey Sharybin
418f9020e3 Fix redefined warnings from config.h
The issue was caused by config.h header being included from both
header files and implementation files.

Proposed solution is to have regular header guard in the generated
config.h. Benefit of this solution is that it's least intrusive.
Downside is that it only solves issue for CMake build system, and
autoconf one is not fixed since header template is automatically
generated by autoheader who does not add header guard.
2018-03-20 11:14:06 +01:00
Sergey Sharybin
e35bb111c3 konsole family of terminfo supports colored output
Glog was missing colored output when running in terminal
who is set to konsole* TERM, even though the terminal
itself supports colored output.

Add extra terminfo to the check function, so now output
from Glog is properly colored.
2018-03-20 09:49:07 +01:00
Sergiu Deitsch
a97d6b0e1c
Symbolizer support for mingw and cygwin (#208)
* added dbghelp symbolizer support for mingw and cygwin
* fixed compiler errors in case <stdint.h> is not available
* cmake: check whether SymFromAddr actually works
2018-02-27 21:03:20 +01:00
Rodrigo Queiro
3106945d8d Add workaround for Bazel build on macOS
This works around https://github.com/bazelbuild/bazel/issues/3979,
and so closes #282.
2018-01-16 17:06:15 +01:00
Sergiu Deitsch
f3bd836de4
Merge pull request #281 from sergiud/msvc-error-define
Fixed undeclared identifier error
2018-01-02 02:21:51 +01:00
Sergiu Deitsch
85d49f7a47 logging_unittest: fixed undeclared identifier error (fixes #267) 2018-01-02 02:18:00 +01:00
Fumitoshi Ukai
2063b38708
Merge pull request #261 from pcc/fix3
Compute base addresses from program headers while reading /proc/self/maps.
2017-11-10 16:55:27 +09:00
Peter Collingbourne
c4d37a78cc Compute base addresses from program headers while reading /proc/self/maps.
We previously had logic to compute the base address from program
headers as part of symbolization. The problem is that we need a correct
base address earlier in order to adjust a PC into the image's address
space, as these addresses can appear in unsymbolized output.

There was previously an assumption that only the mapping that
was lowest in the address space did not need to be adjusted. This
assumption is not guaranteed (for example, the kernel may choose to
map an ET_DYN lowest) and in fact turned out to be wrong in binaries
linked with lld because the first mapping is read-only.

The solution is to move the program header reading logic into the
code that reads /proc/self/maps.

There is a change in semantics for clients that install a callback
using the InstallSymbolizeOpenObjectFileCallback function. Any such
clients will need to return a correct base address from the callback
by reading program headers using code similar to that in the function
OpenObjectFileContainingPcAndGetStartAddress.
2017-11-08 14:15:02 -08:00
Sergiu Deitsch
bac8811710
Merge pull request #106 from dimhotepus/master
Cache strlen outside of cycles (PVS-Studio)
2017-11-04 16:22:21 +01:00
Kenny Yu
4764ca65f5 Annotate LOG_EVERY_N macros as a benign race for TSAN
Summary:
Issue #80 points out several places in glog where TSAN discovers
false positives. One of these places is in the `LOG_EVERY_N` macros.
These macros are implemented by maintaining a static unprotected
integer counter, and TSAN will report data races on these counters.

Here is a minimum example to reproduce the data race:

```

void logging() {
  for (int i = 0; i < 300; ++i) {
    LOG_EVERY_N(INFO, 2) << "foo";
  }
}

int main() {
  auto t1 = std::thread(logging);
  auto t2 = std::thread(logging);
  t1.join();
  t2.join();
  return 0;
}
```

And here is the TSAN report:

```
WARNING: ThreadSanitizer: data race (pid=776850)
  Write of size 4 at 0x558de483f684 by thread T2:
    #0 logging()
    #1 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>)
    #2 std::_Bind_simple<void (*())()>::operator()()
    #3 std:🧵:_Impl<std::_Bind_simple<void (*())()> >::_M_run()
    #4 execute_native_thread_routine

  Previous write of size 4 at 0x558de483f684 by thread T1:
    #0 logging()
    #1 void std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>)
    #2 std::_Bind_simple<void (*())()>::operator()()
    #3 std:🧵:_Impl<std::_Bind_simple<void (*())()> >::_M_run()
    #4 execute_native_thread_routine

  Location is global '<null>' at 0x000000000000 (main+0x00000011c684)

  Thread T2 (tid=776857, running) created by main thread at:
    #0 pthread_create
    #1 __gthread_create
    #2 std:🧵:_M_start_thread(std::shared_ptr<std:🧵:_Impl_base>, void (*)())
    #3 main

  Thread T1 (tid=776856, running) created by main thread at:
    #0 pthread_create
    #1 __gthread_create
    #2 std:🧵:_M_start_thread(std::shared_ptr<std:🧵:_Impl_base>, void (*)())
    #3 main

SUMMARY: ThreadSanitizer: data race in logging()
```

To avoid noisy TSAN reports and also avoid adding a performance hit, this
change will mark these counters as benign races so that TSAN will not report
them. This change will only have an effect if we are compiling with TSAN;
there are no changes if we are not building with TSAN.

With this change, the above example no longer reports a data race when built
and run with TSAN.
2017-11-03 17:32:47 -07:00
Fumitoshi Ukai
9f8a9a9a0d Shell escape arguments to /bin/mail. 2017-10-31 13:04:26 +09:00
Shinichiro Hamaji
56b81ea796 Style fixes for consistency 2017-10-20 16:11:31 +09:00
Shinichiro Hamaji
ebf81ac476 Merge pull request #245 from DariuszOstolski/issue211
Fix username lookup in case of missing USER environment variable
2017-10-20 16:09:28 +09:00
Dariusz Ostolski
4912af30f9 #253: Use MS preprocessor idiom to disable warning 2017-10-18 20:56:49 +02:00
Shinichiro Hamaji
d0531421fd Merge pull request #226 from sergiud/zero-allocation-log-failure
Zero allocation fix
2017-10-12 00:25:02 +09:00
Sergiu Deitsch
2fe6508e53 fixed gcc logging failure 2017-10-11 00:45:08 +02:00
Dariusz Ostolski
2d3cf2681d Fix username lookup in case of missing USER environment variable 2017-09-19 22:23:53 +02:00
Shinichiro Hamaji
2a6df66252 Merge pull request #228 from sergiud/dll-export-fix
Fix for missing exports (fixes #227)
2017-08-10 00:06:08 +09:00
Sergiu Deitsch
1bfae38300 added missing exports (fixes #227) 2017-08-09 15:21:32 +02:00
Shinichiro Hamaji
246a5896f1 Merge pull request #225 from jray272/remove-log-every-n-assert
Fix LOG_EVERY_N with clang -Wunused-local-typedef
2017-08-09 16:35:05 +09:00
Jim Ray
dd19fb2466 Remove GOOGLE_GLOG_COMPILE_ASSERT
This compile time assert is no longer used anywhere in glog. Remove
it.
2017-08-09 00:09:16 -07:00
Jim Ray
8b3023f7e4 Fix LOG_EVERY_N with clang -Wunused-local-typedef
Glog uses a pre-C++11 compile time assert to verify the validity of
the severity parameter for LOG_EVERY_N. Unfortunately, some compilers
will complain about the usage of LOG_EVERY_N with
"-Wunused-local-typedef" due to the way the compile time assert is
constructed. This makes it impossible to use LOG_EVERY_N with this
warning treated as an error.

The fix simply removes the assert entirely. This is safe to do since
you can't put anything invalid into the severity parameters without
generating a compile error elsewhere. This has been safe to do ever
since the GLOG_ prefixes were added as part of 6febec361e.

Fixes #223
2017-08-06 00:17:50 -07:00
Jim Ray
8ed1668cdb Update Windows logging.h based on 2df0ca34aa
Commit changes to src/windows/glog/logging.h that were missed in
2df0ca34aa. Because a change to src/glog/logging.h.in was made,
src/windows/preprocess.sh needed to be run.
2017-08-06 00:13:30 -07:00
Shinichiro Hamaji
a808e435b7 Merge pull request #157 from sergiud/cygwin-support
Cygwin support
2017-07-06 15:00:06 +09:00
Shinichiro Hamaji
a835da8e08 Merge pull request #158 from sergiud/zero-allocation
[RFC] reduce heap memory allocations to zero
2017-07-06 14:58:37 +09:00
Shinichiro Hamaji
96f6656551 Merge pull request #145 from pixelb/rate-limit-posix-fadvise
rate limit calls to posix_fadvise()
2017-07-06 14:52:13 +09:00
Hans-Andreas Engel
2df0ca34aa reduce memory allocations to zero 2017-07-06 00:02:38 +02:00
Andrew Schwartzmeyer
d1f49ba5aa Support signal handler on Windows 2017-06-27 10:50:20 -07:00
Andrew Schwartzmeyer
7f95ecfdc7 Link to DbgHelp using pre-processor directive
This method ensure that all users of glog get automatically linked to
the DbgHelp library without needing to set compiler flags.
2017-06-27 10:50:20 -07:00
Andrew Schwartzmeyer
e2caf9876e Export GetStackTrace
Necessary when building with BUILD_SHARED_LIBS=1.
2017-06-27 10:50:20 -07:00
Andrew Schwartzmeyer
f1d64f7deb Support symbolizer and demangler on Windows 2017-06-27 10:50:20 -07:00
Andrew Schwartzmeyer
e5d36443c6 Support stacktrace on Windows 2017-06-26 18:47:34 -07:00
Andrew Schwartzmeyer
9c1d0e6f6e Copy stacktrace_generic-inl.h for Windows 2017-06-26 16:21:10 -07:00
Shinichiro Hamaji
a6266db97a Add a hack for naive include scanners 2017-05-09 17:35:18 +09:00
Shinichiro Hamaji
ee9d487782 Define OS_LINUX only if it's not defined yet 2017-05-09 17:22:38 +09:00
Shinichiro Hamaji
c4814b729a symbolize: Allow 4kB stack consumption on PPC64 2017-05-09 17:21:16 +09:00
Shinichiro Hamaji
f278d734c1 x86 stacktrace: Use __builtin_frame_address if possible 2017-05-09 17:14:15 +09:00
Shinichiro Hamaji
0d78884a22 Relax test for symbolize
Don't rely on an internal-linkage extern "C" function having an
unmangled name. This isn't required by the ABI, and in fact is not
valid for a conforming compiler(!). Instead, allow symbolization to
produce either a mangled or an unmangled name here.
2017-05-09 17:14:15 +09:00
Shinichiro Hamaji
7314fa3f86 Use LOG(FATAL) instead of CHECK(false) 2017-05-09 17:14:12 +09:00
Shinichiro Hamaji
f012836db1 Run src/windows/preprocess.sh 2017-05-09 16:41:58 +09:00
Ning Ren
0d8c6340f8 CHECK_NOTNULL works with smart pointers when compiled in C++11. 2017-04-20 15:32:24 -07: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
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
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
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
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
7cff62028c Merge pull request #116 from pcc/fix2
Fix autotools build.
2016-10-19 16:06:38 +09: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
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
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
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
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
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
Robert Hencke
c10e6ec19c Fix double-free in unit test on Windows.
The LOG_SYSRESULT refers to result twice.  Since, in this test,
result expands to FindClose(handle), the handle was being freed twice.
2015-09-06 09:53:22 -04:00
Fumitoshi Ukai
85e5c6edad Merge pull request #47 from sergiud/master
Allow to disable multithreading support using CMake
2015-08-12 16:09:02 +09:00
Fumitoshi Ukai
a94afc6807 Merge pull request #26 from theopolis/feature-mode-flag
[#23] Add logfile_mode to control logfile permissions
2015-08-12 16:05:28 +09:00
Teddy Reed
58438d398f [#23] Add logfile_mode to control logfile permissions 2015-08-10 16:49:33 -07:00
Sergiu Dotenco
cb5487d901 cmake: allow to disable multithreading support
This commit additionally enables threading for win32 by default.
2015-08-08 21:26:17 +02:00
Fumitoshi Ukai
f7691955e8 Merge pull request #35 from bsilver8192/fix-mocklog-unused-arguments
Fix mocklog unused arguments
2015-08-06 17:17:55 +09:00
Fumitoshi Ukai
254db0ae1b Merge pull request #34 from bsilver8192/fix-macro-redefinition
Fix redefinition of _XOPEN_SOURCE.
2015-08-06 17:15:44 +09:00
Fumitoshi Ukai
cd37eec302 Merge pull request #20 from UbimoLTD/patch-1
Don't call RAW_VLOG with locking vmodule_lock

SetVLOGLevel locks vmodule_lock however RAW_VLOG at the end also implicitly locks it via InitVLOG3__.
This causes deadlock/segfault.

fixes #29
2015-08-06 17:09:02 +09:00
Fumitoshi Ukai
8db3ff0b75 Merge pull request #12 from ukai/fix_leak
delete LogDestination::sinks_ at DeleteLogDestinations(). 

fixes #8
2015-08-06 16:57:51 +09:00
Fumitoshi Ukai
fe136448ff Merge pull request #7 from sergiud/master
Add CMake support. closes #4
2015-08-06 16:53:55 +09:00
Sergiu Dotenco
5aee7c7899 added missing include 2015-07-15 22:35:00 +02:00
Sergiu Dotenco
856ff81a82 fixed vc 14.0 ctp 6 compilation error 2015-07-15 22:34:59 +02:00
Sergiu Dotenco
b561c94b19 determine gflags namespace automatically 2015-07-15 22:34:59 +02:00
Sergiu Dotenco
f9def39a46 do not redefine snprintf if it's already available 2015-07-15 22:34:58 +02:00
Sergiu Dotenco
fa4c5b50a9 do not redefine stl logging macros 2015-07-15 22:34:58 +02:00
Sergiu Dotenco
ea628ae809 allow to define TEST_SRC_DIR as a macro 2015-07-15 22:34:58 +02:00
Sergiu Dotenco
3325258036 allow to use __declspec(noreturn) 2015-07-15 22:34:57 +02:00
Sergiu Dotenco
3d9fea9e84 export the Demangle function 2015-07-15 22:34:57 +02:00
Sergiu Dotenco
3c49b93201 added cmake support 2015-07-15 22:34:44 +02:00
Brian Silverman
beb55fa825 Fix redefinition of _XOPEN_SOURCE.
Under Debian Jessie, I get a warning about redefining _XOPEN_SOURCE
which is easy to fix.
2015-06-16 16:50:57 -07:00
Brian Silverman
180eaff781 Fix unused arguments warning in ScopedMockLog. 2015-06-16 16:50:01 -07:00
romange
2c5038470b Update vlog_is_on.cc
SetVLOGLevel locks vmodule_lock however RAW_VLOG at the end also implicitly locks it via InitVLOG3__.

This causes deadlock/segfault.
2015-04-30 20:28:32 +03:00
Fumitoshi Ukai
ed072a55b8 don't remove sinks_ elements. 2015-04-11 00:05:05 +09:00
Abhishek Parmar
701dd7120d Guard GOOGLE_PREDICT_TRUE|FALS with #ifndef to avoid collision with other google opensource projects like protobuf. 2015-04-08 10:19:06 -07:00
Fumitoshi Ukai
9c2acaaa49 delete LogDestination::sinks_ at DeleteLogDestinations().
fixes #8 AddLogSink memory leak
2015-03-27 17:23:20 +09:00
Fumitoshi Ukai
1b0b08c8dd Merge pull request #10 from jmr/std_vector
LOG_STRING: use std::vector and std::string.
2015-03-27 16:43:58 +09:00
Jesse Rosenstock
162a8ef4ea LOG_STRING: use std::vector and std::string.
Previously, plain vector and string were used.
This assumed that there were "using" directives or
declarations before the macro was used.  This will
not always be the case.
2015-03-26 14:25:14 -04:00
Michael Tanner
66088e4787 Adds color output support for tmux terminals 2015-03-23 10:56:04 +00:00
tbennun
7553b4193d Fix x64/Debug build on MSVS 2015-03-13 07:56:59 +02:00
78da3bf8fe Fixes for the latest MSVS.
- ssize_t
Since Windows does not have ssize_t, we need to include BaseTsd.h and
use SSIZE_t instead.

- include algorithm
MSVS 2013 requests developers to include algorithm when they use
std::min.

By yyanagisawa



git-svn-id: https://google-glog.googlecode.com/svn/trunk@143 eb4d4688-79bd-11dd-afb4-1d65580434c0
2014-08-19 00:36:29 +00:00
09e8dd6289 Add libc++ support
Similar patch was provided in
    
https://code.google.com/p/google-glog/issues/detail?id=121


git-svn-id: https://google-glog.googlecode.com/svn/trunk@142 eb4d4688-79bd-11dd-afb4-1d65580434c0
2014-03-05 05:20:24 +00:00
a5ffa88413 Build issues in demangle.cc
git-svn-id: https://google-glog.googlecode.com/svn/trunk@141 eb4d4688-79bd-11dd-afb4-1d65580434c0
2014-03-02 01:37:08 +00:00
8367470aa5 Adding a callback mechanism to allow users of google.glog to provide
their own implementation of  OpenObjectFileContainingPcAndGetStartAddress.

GTTF: Make stack trace symbolization code recognize more symbols.
One example is __libc_start_main (easy to check), there may be more.

Include the correct elf header on OpenBSD and Android.

Fix Coverity NO_EFFECT defect. Comparing unsigned greater than or equal zero is always true.



git-svn-id: https://google-glog.googlecode.com/svn/trunk@140 eb4d4688-79bd-11dd-afb4-1d65580434c0
2014-03-01 00:33:41 +00:00
a0073e504b Add StrError and replace posix_strerror_r calls
For now, we do not remove the declaration of posix_strerror_r,
but we might remove it in future.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@139 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-10-31 05:39:43 +00:00
0242c8e94d Fix VC build by adding GOOGLE_GLOG_DLL_DECL
git-svn-id: https://google-glog.googlecode.com/svn/trunk@138 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-10-31 05:36:25 +00:00
a0bf19d0df A style fix for C++11
This patch is given by Nico (thanks!)



git-svn-id: https://google-glog.googlecode.com/svn/trunk@137 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-07-29 06:27:17 +00:00
1518f230c6 Reduce dynamic allocation from 3 to 1 per log message
This patch was contributed in

https://code.google.com/p/google-glog/issues/detail?id=131

by engel. Thanks!


git-svn-id: https://google-glog.googlecode.com/svn/trunk@136 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-05-29 14:10:49 +00:00
478a80caa0 Attempt to improve mingw-w64 support
- Set -Isrc/windows for mingw
- Check existence of sigaction, pread, and pwrite
- Provide alternative implementation of pread and pwrite
- Eliminate symlink code for OS_WINDOWS
- Don't check /proc/self/fd if the OS isn't linux
- Don't use MSVC specific declarations in port.h for mingw



git-svn-id: https://google-glog.googlecode.com/svn/trunk@135 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-02-18 10:56:53 +00:00
a106e61178 Support unordered_(map|set) by stl_logging
git-svn-id: https://google-glog.googlecode.com/svn/trunk@134 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-02-18 10:45:46 +00:00
069ee58a09 Fix Mac test failure
We need only the first line from signalhandler.out3


git-svn-id: https://google-glog.googlecode.com/svn/trunk@131 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-02-01 05:46:37 +00:00
e6af5ea5f1 Make sure stderr is not buffered.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@130 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-31 04:39:54 +00:00
fdc710e355 Add dllimport and dllexport for new symbols
git-svn-id: https://google-glog.googlecode.com/svn/trunk@129 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-31 03:49:40 +00:00
35ba669307 Revert http://code.google.com/p/google-glog/source/detail?r=127
Casting to (void) was bad because the return value of DCHECK_NOTNULL
cannot be used.



git-svn-id: https://google-glog.googlecode.com/svn/trunk@128 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-31 03:48:24 +00:00
3297f04c13 Remove warning of DCHECK_NOTNULL
http://code.google.com/p/google-glog/issues/detail?id=87


git-svn-id: https://google-glog.googlecode.com/svn/trunk@127 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-25 07:59:25 +00:00
c4c25e85fd Make glog ABI compatible with gflags
The ABI incompatibility is bad when 

- Build glog without gflags (glog package in most distributions doesn't 
  depend on gflags) 
- Use both glog and gflags 


git-svn-id: https://google-glog.googlecode.com/svn/trunk@125 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-25 05:44:43 +00:00
3b59339f08 Follow up for the color log patch
- Rename colorstderr => colorlogtostderr
- Remove duplicated code
- Set colorlogtostderr=0 in the unittest



git-svn-id: https://google-glog.googlecode.com/svn/trunk@124 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-23 05:27:13 +00:00
ff96a5a827 Output logs with colors to stderr
This patch is provided by

http://code.google.com/p/google-glog/issues/detail?id=48

Thanks!



git-svn-id: https://google-glog.googlecode.com/svn/trunk@123 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-23 05:25:56 +00:00
5fc80272da Re-generate logging.h for windows
Thanks Kamil for your report!



git-svn-id: https://google-glog.googlecode.com/svn/trunk@122 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-22 09:12:56 +00:00
74ae299924 Allow users to re-initialize glog
http://code.google.com/p/google-glog/issues/detail?id=83
http://code.google.com/p/google-glog/issues/detail?id=125
http://code.google.com/p/google-glog/issues/detail?id=142



git-svn-id: https://google-glog.googlecode.com/svn/trunk@121 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-10 07:46:20 +00:00
e8327746ef Move LogMessageData from .h to .cc
git-svn-id: https://google-glog.googlecode.com/svn/trunk@120 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-10 07:19:05 +00:00
3aa45ed56e Eliminate use of strstream based on internal changes
http://code.google.com/p/google-glog/issues/detail?id=110


git-svn-id: https://google-glog.googlecode.com/svn/trunk@119 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-09 16:06:21 +00:00
44c4b29de4 Fix glog/stl_logging for clang
git-svn-id: https://google-glog.googlecode.com/svn/trunk@118 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-09 13:59:45 +00:00
047426cf97 Run autoreconf on ubuntu precise
git-svn-id: https://google-glog.googlecode.com/svn/trunk@117 eb4d4688-79bd-11dd-afb4-1d65580434c0
2013-01-09 13:26:44 +00:00
96dac4fd02 Fixed files to support FreeBSD amd64 based on patches at:
http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/glog/files/

Since FreeBSD do not have gettid system call unlikely to MacOSX, I
modified utilities.h not to use that on FreeBSD:
* FreeBSD lacks gettid syscall.
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/syscalls.master?rev=1.276;content-type=text%2Fplain
* MacOSX gettid == 286.
http://www.opensource.apple.com/source/xnu/xnu-1504.3.12/bsd/kern/syscalls.master
   
As for the fix of stacktrace, we use a different approach.
Even in FreeBSD, package gcc44/gcc46 has unwind.h.
As a result, checking unwind.h should be natural solution.

This patch was given by yyanagisawa



git-svn-id: https://google-glog.googlecode.com/svn/trunk@116 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-11-22 12:09:13 +00:00
711fcd27de Don't #undef GLOG_MSVC_*
They are necessary because GLOG_MSVC_* will be expanded at DCHECK



git-svn-id: https://google-glog.googlecode.com/svn/trunk@115 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-07-17 10:51:15 +00:00
4f6088bc72 Reduce compiler warnings on Windows and MacOSX
DCHECK* causes "warning C4127: conditional expression is constant".

If compiled with -DWIN32_LEAN_AND_MEAN,
port.h: warning C4005: 'WIN32_LEAN_AND_MEAN': macro redefinition.

On MacOSX,
warning: "_END_GOOGLE_NAMESPACE_" redefined
warning: "_START_GOOGLE_NAMESPACE_" redefined
because config.h is included
 from base/commandlineflags.h:51
 from logging.cc:60
and
 from utilities.h:81
 from logging.cc:32
or so.

Contributed by ukai@



git-svn-id: https://google-glog.googlecode.com/svn/trunk@114 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-07-12 06:37:47 +00:00
7c613d6190 Fix LOG_SYSRESULT
result is expected to be GetLastError() or WSAGetLastError(), so
we have to convert it to HRESULT by HRESULT_FROM_WIN32 for FAILED()
macro.
Use FormatMesssageA (ANSI version). since glog may not work with
Unicode string.

Contributed by ukai@



git-svn-id: https://google-glog.googlecode.com/svn/trunk@113 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-07-03 05:25:54 +00:00
6d42536769 Reduce the number of warnings by VS2010
git-svn-id: https://google-glog.googlecode.com/svn/trunk@112 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-06-13 07:25:19 +00:00
e7712bf068 Compile error fix for QNX
This patch is given in

http://code.google.com/p/google-glog/issues/detail?id=114



git-svn-id: https://google-glog.googlecode.com/svn/trunk@111 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-05-14 07:46:20 +00:00
ad13dc67dd VC11 build fix
http://code.google.com/p/google-glog/issues/detail?id=119



git-svn-id: https://google-glog.googlecode.com/svn/trunk@110 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-05-14 07:43:51 +00:00
475ec9b9c4 Add --disable-rtti
git-svn-id: https://google-glog.googlecode.com/svn/trunk@109 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-02-24 07:28:50 +00:00
73b0abc989 Remove trivial warnings produced by clang
git-svn-id: https://google-glog.googlecode.com/svn/trunk@107 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-01-12 08:41:09 +00:00
cd026f9eab Add exception specification for operator new and operator delete
Unfortunately, clang produces warnings for them



git-svn-id: https://google-glog.googlecode.com/svn/trunk@106 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-01-12 07:50:28 +00:00
8b90f05746 Fix compile failures with clang in stl_logging_unittest.cc
This happens due to the reason I wrote in stl_logging.h.
We don't need utilities.h (which includes logging.h) so we can just
remove it.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@105 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-01-12 07:49:25 +00:00
fe0967b999 Fix the wrong use of sizeof
git-svn-id: https://google-glog.googlecode.com/svn/trunk@104 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-01-12 07:46:39 +00:00
11e78e4c66 Put __attribute__((noreturn)) for declartions of function pointers
Clang needs this change.



git-svn-id: https://google-glog.googlecode.com/svn/trunk@103 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-01-12 07:45:39 +00:00
6febec361e Define GLOG_ prefixed log severities
Users can control if usual log severity values will be defined by
GLOG_NO_ABBREVIATED_SEVERITIES.

For http://code.google.com/p/google-glog/issues/detail?id=105



git-svn-id: https://google-glog.googlecode.com/svn/trunk@101 eb4d4688-79bd-11dd-afb4-1d65580434c0
2012-01-11 09:17:04 +00:00
8a4c1663e3 Make public headers "warnings clean" in the sense of -Wall -Wextra -Wshadow
-Werror.  Fixes issue 98.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@100 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-12-29 12:40:48 +00:00
d8944b1743 Fix logging_striplog_test.sh in debug mode. Fixes issue 108.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@99 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-12-29 12:36:09 +00:00
5a05c30365 Remove assumptions about function size in stacktrace_unittest.cc, which do not
hold when using certain compiler settings (for example, -O3 -g2 with GCC).
Fixes issue 107.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@98 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-12-28 15:45:05 +00:00
ac3e918969 Suppress warnings around return value of write and symlink.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@97 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-09-05 08:00:43 +00:00
c2cbc763ed Destruct global objects in ShutdownGoogleLogging
http://code.google.com/p/google-glog/issues/detail?id=69



git-svn-id: https://google-glog.googlecode.com/svn/trunk@96 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-09-05 08:00:01 +00:00
b1afbe7b3c Add google:: prefixes for COUNTER in glog's document
http://code.google.com/p/google-glog/issues/detail?id=92


git-svn-id: https://google-glog.googlecode.com/svn/trunk@95 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-09-05 07:58:38 +00:00
54421697f4 Create a new log files after pid has changed
http://code.google.com/p/google-glog/issues/detail?id=51
http://code.google.com/p/google-glog/issues/detail?id=74
http://code.google.com/p/google-glog/issues/detail?id=82



git-svn-id: https://google-glog.googlecode.com/svn/trunk@94 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-09-05 07:56:21 +00:00
204ef03af8 Add files left behind by certain tests to CLEANFILES.
Remove autogen.sh, since you can just use autoreconf instead.

Ran autoreconf and fixed a couple of issues that popped up in
configure.ac and m4/ac_rwlock.m4.  This updates the configuration
files to automake/aclocal 1.11.1 (from 1.10.1) and to autoconf 2.65
(from 2.61).


git-svn-id: https://google-glog.googlecode.com/svn/trunk@93 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-05-11 02:47:46 +00:00
3ae5baa10b Reduce stack consumption for Demangle(). Fixes issue 81.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@92 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-02-25 14:33:28 +00:00
0b4dcd23ac Add partial C++0x support and recognition of GCC function clone suffixes to
demangle.cc.  Fixes issue 80.

Make svn ignore autom4te.cache.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@91 eb4d4688-79bd-11dd-afb4-1d65580434c0
2011-02-07 14:43:05 +00:00
1e86eecaf6 Minor message update.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@90 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-06-15 07:04:56 +00:00
858a11d4e3 Add ShutdownGoogleLogging to close syslog.
This patch was contributed by DGunchev (thanks!)

http://code.google.com/p/google-glog/issues/detail?id=28


git-svn-id: https://google-glog.googlecode.com/svn/trunk@88 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-06-15 06:28:38 +00:00
b52f3fe2e4 s/ASSERT_EQ/CHECK_EQ/ .
We are not using gtests' ASSERT_* in our unittests.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@87 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-06-15 04:45:46 +00:00
c83adaa87d Use sys/ucontext.h when it is found. Snow leopard needs this.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@86 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-06-15 04:12:19 +00:00
1f8dac87fc Move TEST_SRC_DIR from googletest.h to config.h.
Now test passes out side tree.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@85 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-05-28 03:56:29 +00:00
9e15c473b7 Add DCHECK_NOTNULL macro to logging.h (points to CHECK_NOTNULL in debug mode)
http://code.google.com/p/google-glog/issues/detail?id=25


git-svn-id: https://google-glog.googlecode.com/svn/trunk@83 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-05-28 03:43:29 +00:00
b2704e9f07 Add __extension__ for GCC's statement expression.
http://code.google.com/p/google-glog/issues/detail?id=31


git-svn-id: https://google-glog.googlecode.com/svn/trunk@82 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-05-28 03:32:50 +00:00
85f35499a7 Add some more google:: namespaces.
http://code.google.com/p/google-glog/issues/detail?id=40


git-svn-id: https://google-glog.googlecode.com/svn/trunk@81 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-05-28 03:31:14 +00:00
cb35010215 Use GLOG_* environment variables even when gflags is installed.
Define GLOG_DEFINE_*, which checks if the GLOG_* environment variable
is defined. If defined, GLOG_DEFINE_* passes the value and otherwise,
it passes the original default value. In this way, GLOG_DEFINE_* macro
uses the value specified by gflags first, then GLOG_* environment
variables, and finally it uses the default value if neither of them are
specified.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@76 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-01-20 07:39:18 +00:00
327359662c Handle ucontext.h properly in Snow leopard.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@75 eb4d4688-79bd-11dd-afb4-1d65580434c0
2010-01-18 06:15:33 +00:00
b71aa94381 Fix compilation error with -DNDEBUG.
This bug is reported in
http://code.google.com/p/google-glog/issues/detail?id=19



git-svn-id: https://google-glog.googlecode.com/svn/trunk@74 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-11-11 09:07:47 +00:00
effef71e00 Use numeric_limits instead of SSIZE_MAX.
It seems a version of arm-linux-gcc doesn't have this symbol.
http://code.google.com/p/google-glog/issues/detail?id=18



git-svn-id: https://google-glog.googlecode.com/svn/trunk@73 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-11-11 09:06:51 +00:00
90e7825e55 Use intptr_t instead of int to cast from char* for Snow Leopard.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@72 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-10-07 08:52:14 +00:00
7e54f5ab11 Make the order of check for OS_WINDOWS|OS_CYGWIN and HAVE_PTHREAD consistent.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@70 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-31 05:25:27 +00:00
1b5a90b691 Cast from pthread_t to pid_t via uintptr_t.
On 64bit NetBSD, pthread_t is a pointer and pid_t is an integer so
we cannot cast from pthread_t to pid_t directoly due to difference of
their size.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@69 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-30 10:45:13 +00:00
9495564423 Call glog_internal_namespace_::ProgramInvocationShortName() explicitly.
Otherwise, we may call google::ProgramInvocationShortName() in gflags.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@68 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-30 10:43:50 +00:00
5bf76bb4d5 Avoid warning for type punning like
src/logging_unittest.cc:591: warning: dereferencing type-punned pointer will break strict-aliasing rules

As we'll never dereference the casted pointers, it's OK to silence this warning.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@67 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-30 10:42:59 +00:00
fcbeeb9f35 Fix posix_strerror_r for OpenBSD.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@66 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-30 05:51:28 +00:00
f028227fa3 Define DumpPCAndSymbol() only when HAVE_SYMBOLIZE is defined.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@65 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-29 09:11:48 +00:00
d712e2084a Fix user name detection for Windows.
This patch was given by ademin (thanks!).

http://code.google.com/p/google-glog/issues/detail?id=12


git-svn-id: https://google-glog.googlecode.com/svn/trunk@64 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-29 08:38:20 +00:00
fc88a722eb Suppress warnings.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@63 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-29 08:37:32 +00:00
b35305f1ab Initializes the length of machine name properly.
This fix was suggested at (thanks!)

http://code.google.com/p/google-glog/issues/detail?id=9


git-svn-id: https://google-glog.googlecode.com/svn/trunk@62 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-29 07:34:28 +00:00
2c28a49394 Regression: Add NOGDI and NOMINMAX macros before including windows.h.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@61 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-27 08:13:30 +00:00
c24b607748 Use internal namespace instead of anonymous namespace for Mutex.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@60 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-27 05:42:23 +00:00
70cb94e244 Add cast for pthread_self() to avoid warning.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@59 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-27 05:31:23 +00:00
d96287aa28 Add virtual ~Thread() to avoid warnings.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@58 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-27 05:30:39 +00:00
ac63dd1f58 Add OS_NETBSD macro.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@57 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-27 05:29:58 +00:00
8c4e3a9238 Suppress warnings. Most of this patch was given by keir (thanks!).
Corresponding glog bug: http://code.google.com/p/google-glog/issues/detail?id=10

The differences from keir's patch are:
- For raw_logging.h.in, I just included time.h for struct tm.
- Added a fprintf which warns that we should have died to avoid a warning for unused local variable.
- Added inline for some functions which may be unused in googletest.h.
- Removed DumpPCAndFrameSize as it was unused.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@56 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-08 17:19:09 +00:00
5f9c97a33c Run benchmarks only when --run_benchmark is specified.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@52 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-07-07 03:10:39 +00:00
c1995cd469 Encapsulate the definition of Mutex into glog's internal namespace.
This will fix the issue a user in Japan reported in his blog.

http://kzk9.net/blog/2009/05/deadlock_with_gflags_and_glog_2.html

According to his description, when he use glog and gflags-1.1, gflags'
code uses glog's Mutex, the Mutex cannot lock the pthread_mutex, and
the program stops.

The bug happens with the combination of gflags-1.1 and glog. It seems
that the issue was caused by incompatibility of Mutex classes. Though I
couldn't reproduce this issue, the reporter of this bug said that
adding namespace fixes the problem and I think it is generally good
idea to use namespace for this kind of common component to avoid
incompatibilities. So, I check this change in now. This patch
will protect glog from future changes on Mutex as well.
--This line, and  those below, will be ignored--

M    src/base/mutex.h


git-svn-id: https://google-glog.googlecode.com/svn/trunk@51 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-05-20 05:55:40 +00:00
7b97abb978 Suppress warnings (re-definition of _XOPEN_SOURCE) by including utilities.h first.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@50 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-05-19 09:12:00 +00:00
a86eb1ac62 Check if InitGoogleLogging is not called twice.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@47 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-04-10 16:15:53 +00:00
ddfd1884b6 A bug fix for Windows: Use GetSystemTimeAsFileTime instead of GetSystemTime. SYSTEMTIME's mSecond is not a unix time but like tm.tm_sec.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@45 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-04-09 07:49:44 +00:00
8cf64cc167 Use struct instead of class for forward declaration of CrashReason as we define it as struct.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@44 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-04-07 09:03:16 +00:00
315d590cdc Apply patch given by maw (thanks!). The patch was modified a bit using AC_ARG_WITH.
- Fix build problems when building with gtest.
- --with-gflags support.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@42 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-04-07 06:33:09 +00:00
b86afef3f7 Fixes for GCC 4.4. Thanks John for this patch!
git-svn-id: https://google-glog.googlecode.com/svn/trunk@41 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-03-10 02:15:40 +00:00
4a3f102ce0 Introduce RecordCrashReason().
git-svn-id: https://google-glog.googlecode.com/svn/trunk@40 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-03-04 10:16:33 +00:00
f365379532 Add license information for all source code.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@39 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-28 17:04:50 +00:00
e70803833d Bug fix: ifdef guard for InitGoogleMock must be HAVE_LIB_GMOCK rather than HAVE_LIB_GTEST.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@38 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-24 19:25:56 +00:00
8ef5cd3398 Regenerate header files for VC++.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@34 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-23 19:00:09 +00:00
0c6fdbd87f Remove the name of unused parameter.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@32 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-23 18:49:53 +00:00
630e77bac0 Remove unnecessary #include.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@31 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-23 18:48:11 +00:00
c3441fb6ba Better Cygwin support.
- configure.ac: Add -lpthread only if acx_pthread_ok is yes. In cygwin, we use Windows' thread so that we don't need -lpthread.
- base/mutex.h: Define NOMINMAX before we include windows.h.
- glog/*.h: Make sure that dllimport doesn't appear in cygwin. Note that windows.h may define _WIN32 macro.
- utilities.h: Define OS_CYGWIN.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@30 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-22 18:22:48 +00:00
e31a91b650 * Add LOG_TO_STRING.
* Add LOG_AT_LEVEL.
* Add DVLOG.
* Add LOG_TO_SINK_ONLY.
* Log microseconds.
* Add --log_backtrace_at option.
* Introduce CrashReason class.
* Fix some bugs.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@29 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-15 10:34:35 +00:00
eecffc5aa5 Introduce mock-log.h for unittests.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@28 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-13 11:49:10 +00:00
9de1077eed Define ARRAYSIZE in utilities.h and use it.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@27 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-09 06:07:55 +00:00
cc27d6aa59 Use gtest and gmock if installed.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@26 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-05 06:05:01 +00:00
68e9555c91 Initialize gflags in signalhandler_unittest.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@25 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-05 05:56:05 +00:00
6dfafc4571 Fix a typo in commandlineflags.h.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@24 eb4d4688-79bd-11dd-afb4-1d65580434c0
2009-01-05 05:54:57 +00:00
afd586a5d5 Initial windows support. Now we don't have the stacktrace and several unittests.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@23 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-12-19 15:20:40 +00:00
c54c735616 Flush logs unsafely before program fails in the signal handler.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@22 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-12-19 06:49:33 +00:00
4f81d0f209 Add -lpthread in addition to -pthread on Linux.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@21 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-21 11:22:51 +00:00
a00ca9b038 Fix a typo: s/gnore/ignore/
git-svn-id: https://google-glog.googlecode.com/svn/trunk@18 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-17 10:38:58 +00:00
32b7e7c1a4 Remove stacktrace.cc.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@17 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-17 08:32:28 +00:00
f9b58c5198 Re-organize the way to produce stacktrace.
Since we introduced the API to set signal handler and print a
stacktrace, we should avoid glibc's backtrace, which may call malloc.
Basically, we choose the way to produce a stacktrace as same as
perftools.

Also, I removed GetStackFrames, which is not used and not implemented
with glibc.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@16 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-17 07:58:10 +00:00
1ea4ad6ba1 Use uintptr_t instead of int as the integer format of pthread_t.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@14 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-04 07:08:11 +00:00
d15fcf784c Stop to define DISALLOW_EVIL_CONSTRUCTORS to avoid name conflict.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@13 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-11-03 05:00:04 +00:00
198a6d51b2 Forgot to add file for the previous change...
Add InstallFailureSignalHandler().  The function installs a signal handler that will dump useful information when the program crashes on certain signals such as SIGSEGV.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@12 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-30 10:38:57 +00:00
91d9fd8814 Add InstallFailureSignalHandler(). The function installs a signal handler that
will dump useful information when the program crashes on certain signals such
as SIGSEGV.
Also, changed the version of autoconf (2.59 => 2.61).


git-svn-id: https://google-glog.googlecode.com/svn/trunk@11 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-30 10:33:45 +00:00
c481ede8ce Use abort instead of exit.
git-svn-id: https://google-glog.googlecode.com/svn/trunk@9 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-17 11:54:23 +00:00
2ed196e07a Fix a bug: vmodule didn't work with gflags. Since
gflags isn't initialized when REGISTER_MODULE_INITIALIZER is invoked,
we couldn't initialize vmodule_list properly. Modified to call
VLOG2Initializer in the first call of InitVLOG3__.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@8 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-17 11:53:23 +00:00
364832195d Use dladdr to get symbols for environments which doesn't use ELF and
has execinfo.h (e.g., MacOSX 10.5). Though dladdr may not be async
signal safe, it's OK since glog's stacktrace doesn't depend on signals.


git-svn-id: https://google-glog.googlecode.com/svn/trunk@7 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-17 11:52:32 +00:00
e1fb8f60e9 Add __attribute__((noinline)) for StackGrowsDown. This is necessary for recent GCC (4.3).
git-svn-id: https://google-glog.googlecode.com/svn/trunk@6 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-14 00:32:16 +00:00
b8b4db46fe glog 0.1
git-svn-id: https://google-glog.googlecode.com/svn/trunk@2 eb4d4688-79bd-11dd-afb4-1d65580434c0
2008-10-07 05:43:05 +00:00