Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
glog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
glog
Commits
70f0f558
Commit
70f0f558
authored
7 years ago
by
Fumitoshi Ukai
Committed by
GitHub
7 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #186 from shinh/backport
Backport internal changes
parents
f012836d
a6266db9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
8 deletions
+40
-8
logging_unittest.cc
src/logging_unittest.cc
+1
-1
stacktrace_x86-inl.h
src/stacktrace_x86-inl.h
+11
-4
symbolize_unittest.cc
src/symbolize_unittest.cc
+17
-2
utilities.cc
src/utilities.cc
+8
-0
utilities.h
src/utilities.h
+3
-1
No files found.
src/logging_unittest.cc
View file @
70f0f558
...
...
@@ -282,7 +282,7 @@ void TestLogging(bool check_counts) {
}
static
void
NoAllocNewHook
()
{
CHECK
(
false
)
<<
"unexpected new"
;
LOG
(
FATAL
)
<<
"unexpected new"
;
}
struct
NewHook
{
...
...
This diff is collapsed.
Click to expand it.
src/stacktrace_x86-inl.h
View file @
70f0f558
...
...
@@ -93,16 +93,23 @@ static void **NextStackFrame(void **old_sp) {
// If you change this function, also change GetStackFrames below.
int
GetStackTrace
(
void
**
result
,
int
max_depth
,
int
skip_count
)
{
void
**
sp
;
#ifdef __i386__
#ifdef __GNUC__
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402
#define USE_BUILTIN_FRAME_ADDRESS
#endif
#endif
#ifdef USE_BUILTIN_FRAME_ADDRESS
sp
=
reinterpret_cast
<
void
**>
(
__builtin_frame_address
(
0
));
#elif defined(__i386__)
// Stack frame format:
// sp[0] pointer to previous frame
// sp[1] caller address
// sp[2] first argument
// ...
sp
=
(
void
**
)
&
result
-
2
;
#endif
#ifdef __x86_64__
#elif defined(__x86_64__)
// __builtin_frame_address(0) can return the wrong address on gcc-4.1.0-k8
unsigned
long
rbp
;
// Move the value of the register %rbp into the local variable rbp.
...
...
This diff is collapsed.
Click to expand it.
src/symbolize_unittest.cc
View file @
70f0f558
...
...
@@ -99,7 +99,13 @@ TEST(Symbolize, Symbolize) {
// Compilers should give us pointers to them.
EXPECT_STREQ
(
"nonstatic_func"
,
TrySymbolize
((
void
*
)(
&
nonstatic_func
)));
EXPECT_STREQ
(
"static_func"
,
TrySymbolize
((
void
*
)(
&
static_func
)));
// The name of an internal linkage symbol is not specified; allow either a
// mangled or an unmangled name here.
const
char
*
static_func_symbol
=
TrySymbolize
((
void
*
)(
&
static_func
));
CHECK
(
NULL
!=
static_func_symbol
);
EXPECT_TRUE
(
strcmp
(
"static_func"
,
static_func_symbol
)
==
0
||
strcmp
(
"static_func()"
,
static_func_symbol
)
==
0
);
EXPECT_TRUE
(
NULL
==
TrySymbolize
(
NULL
));
}
...
...
@@ -254,8 +260,13 @@ static const char *SymbolizeStackConsumption(void *pc, int *stack_consumed) {
return
g_symbolize_result
;
}
#ifdef __ppc64__
// Symbolize stack consumption should be within 4kB.
const
int
kStackConsumptionUpperLimit
=
4096
;
#else
// Symbolize stack consumption should be within 2kB.
const
int
kStackConsumptionUpperLimit
=
2048
;
#endif
TEST
(
Symbolize
,
SymbolizeStackConsumption
)
{
int
stack_consumed
;
...
...
@@ -267,9 +278,13 @@ TEST(Symbolize, SymbolizeStackConsumption) {
EXPECT_GT
(
stack_consumed
,
0
);
EXPECT_LT
(
stack_consumed
,
kStackConsumptionUpperLimit
);
// The name of an internal linkage symbol is not specified; allow either a
// mangled or an unmangled name here.
symbol
=
SymbolizeStackConsumption
((
void
*
)(
&
static_func
),
&
stack_consumed
);
EXPECT_STREQ
(
"static_func"
,
symbol
);
CHECK
(
NULL
!=
symbol
);
EXPECT_TRUE
(
strcmp
(
"static_func"
,
symbol
)
==
0
||
strcmp
(
"static_func()"
,
symbol
)
==
0
);
EXPECT_GT
(
stack_consumed
,
0
);
EXPECT_LT
(
stack_consumed
,
kStackConsumptionUpperLimit
);
}
...
...
This diff is collapsed.
Click to expand it.
src/utilities.cc
View file @
70f0f558
...
...
@@ -349,4 +349,12 @@ _END_GOOGLE_NAMESPACE_
// Make an implementation of stacktrace compiled.
#ifdef STACKTRACE_H
# include STACKTRACE_H
# if 0
// For include scanners which can't handle macro expansions.
# include "stacktrace_libunwind-inl.h"
# include "stacktrace_x86-inl.h"
# include "stacktrace_x86_64-inl.h"
# include "stacktrace_powerpc-inl.h"
# include "stacktrace_generic-inl.h"
# endif
#endif
This diff is collapsed.
Click to expand it.
src/utilities.h
View file @
70f0f558
...
...
@@ -39,7 +39,9 @@
#elif defined(__CYGWIN__) || defined(__CYGWIN32__)
# define OS_CYGWIN
#elif defined(linux) || defined(__linux) || defined(__linux__)
# define OS_LINUX
# ifndef OS_LINUX
# define OS_LINUX
# endif
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
# define OS_MACOSX
#elif defined(__FreeBSD__)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment