Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
1c06d59d
Commit
1c06d59d
authored
11 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Plain Diff
Merge branch 'stable'
parents
1552874f
dff3c4c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/CMakeLists.txt
src/util.cc
+25
-24
25 additions, 24 deletions
src/util.cc
with
26 additions
and
25 deletions
src/CMakeLists.txt
+
1
−
1
View file @
1c06d59d
...
...
@@ -84,7 +84,7 @@ set (recompiled_sources
set
(
common_sources
tbuf.c
palloc.cc
util.c
util.c
c
sio.cc
evio.cc
coio.cc
...
...
This diff is collapsed.
Click to expand it.
src/util.c
→
src/util.c
c
+
25
−
24
View file @
1c06d59d
...
...
@@ -37,6 +37,7 @@
#include
<sys/time.h>
#include
<time.h>
#include
<unistd.h>
#include
<cxxabi.h>
#ifdef HAVE_BFD
#include
<bfd.h>
...
...
@@ -228,33 +229,29 @@ backtrace(void *frame_, void *stack, size_t stack_size)
void
*
stack_bottom
=
stack
;
char
*
p
=
backtrace_buf
;
size_t
r
,
len
=
sizeof
(
backtrace_buf
);
char
*
end
=
p
+
sizeof
(
backtrace_buf
)
-
1
;
int
frameno
=
0
;
while
(
stack_bottom
<=
(
void
*
)
frame
&&
(
void
*
)
frame
<
stack_top
)
{
r
=
snprintf
(
p
,
len
,
" - { frame: %p, caller: %p"
,
(
char
*
)
frame
+
2
*
sizeof
(
void
*
),
frame
->
ret
);
p
+=
snprintf
(
p
,
end
-
p
,
"#%-2d %p in "
,
frameno
++
,
frame
->
ret
);
if
(
r
>=
l
en
)
if
(
p
>=
en
d
)
goto
out
;
p
+=
r
;
len
-=
r
;
#ifdef HAVE_BFD
struct
symbol
*
s
=
addr2symbol
(
frame
->
ret
);
if
(
s
!=
NULL
)
{
r
=
snprintf
(
p
,
len
,
" <%s+%"
PRI_SZ
"> "
,
s
->
name
,
(
const
char
*
)
frame
->
ret
-
(
const
char
*
)
s
->
addr
);
if
(
r
>=
len
)
goto
out
;
p
+=
r
;
len
-=
r
;
}
size_t
offset
=
(
const
char
*
)
frame
->
ret
-
(
const
char
*
)
s
->
addr
;
p
+=
snprintf
(
p
,
end
-
p
,
"%s+%"
PRI_SZ
""
,
s
->
name
,
offset
);
}
else
#endif
/* HAVE_BFD */
r
=
snprintf
(
p
,
len
,
" }"
CRLF
);
if
(
r
>=
len
)
{
p
+=
snprintf
(
p
,
end
-
p
,
"?"
);
}
if
(
p
>=
end
)
goto
out
;
p
+=
snprintf
(
p
,
end
-
p
,
CRLF
);
if
(
p
>=
end
)
goto
out
;
p
+=
r
;
len
-=
r
;
#ifdef HAVE_BFD
if
(
s
!=
NULL
&&
strcmp
(
s
->
name
,
"main"
)
==
0
)
break
;
...
...
@@ -262,10 +259,8 @@ backtrace(void *frame_, void *stack, size_t stack_size)
#endif
frame
=
frame
->
rbp
;
}
r
=
0
;
out
:
p
+=
MIN
(
len
-
1
,
r
);
*
p
=
0
;
*
p
=
'\0'
;
return
backtrace_buf
;
}
...
...
@@ -389,7 +384,10 @@ symbols_load(const char *name)
if
(
is_func
&&
(
vma
+
symbol_table
[
i
]
->
value
)
>
0
&&
symbol_table
[
i
]
->
value
<
size
)
{
symbols
[
j
].
name
=
strdup
(
symbol_table
[
i
]
->
name
);
int
status
;
symbols
[
j
].
name
=
abi
::
__cxa_demangle
(
symbol_table
[
i
]
->
name
,
0
,
0
,
&
status
);
if
(
symbols
[
j
].
name
==
NULL
)
symbols
[
j
].
name
=
strdup
(
symbol_table
[
i
]
->
name
);
symbols
[
j
].
addr
=
(
void
*
)(
uintptr_t
)(
vma
+
symbol_table
[
i
]
->
value
);
symbols
[
j
].
end
=
(
void
*
)(
uintptr_t
)(
vma
+
size
);
j
++
;
...
...
@@ -428,7 +426,10 @@ addr2symbol(void *addr)
if
(
symbols
==
NULL
)
return
NULL
;
struct
symbol
key
=
{.
addr
=
addr
,
.
name
=
NULL
,
.
end
=
NULL
};
struct
symbol
key
;
key
.
addr
=
addr
;
key
.
name
=
NULL
;
key
.
end
=
NULL
;
struct
symbol
*
low
=
symbols
;
struct
symbol
*
high
=
symbols
+
symbol_count
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment