Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
d95a76ed
Commit
d95a76ed
authored
5 years ago
by
George Joseph
Committed by
Gerrit Code Review
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge "astmm.c: Display backtrace with memory show allocations" into 17
parents
3b485b3e
b1c5753b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main/astmm.c
+17
-6
17 additions, 6 deletions
main/astmm.c
with
17 additions
and
6 deletions
main/astmm.c
+
17
−
6
View file @
d95a76ed
...
...
@@ -188,7 +188,7 @@ AST_MUTEX_DEFINE_STATIC_NOTRACKING(reglock);
} \
} while (0)
static
void
print_backtrace
(
struct
ast_bt
*
bt
)
static
void
print_backtrace
(
struct
ast_bt
*
bt
,
struct
ast_cli_args
*
a
)
{
int
i
=
0
;
struct
ast_vector_string
*
strings
;
...
...
@@ -198,9 +198,17 @@ static void print_backtrace(struct ast_bt *bt)
}
if
((
strings
=
ast_bt_get_symbols
(
bt
->
addresses
,
bt
->
num_frames
)))
{
astmm_log
(
"Memory allocation backtrace:
\n
"
);
if
(
a
)
{
ast_cli
(
a
->
fd
,
"Memory allocation backtrace:
\n
"
);
}
else
{
astmm_log
(
"Memory allocation backtrace:
\n
"
);
}
for
(
i
=
3
;
i
<
AST_VECTOR_SIZE
(
strings
)
-
2
;
i
++
)
{
astmm_log
(
"#%d: %s
\n
"
,
i
-
3
,
AST_VECTOR_GET
(
strings
,
i
));
if
(
a
)
{
ast_cli
(
a
->
fd
,
"#%d: %s
\n
"
,
i
-
3
,
AST_VECTOR_GET
(
strings
,
i
));
}
else
{
astmm_log
(
"#%d: %s
\n
"
,
i
-
3
,
AST_VECTOR_GET
(
strings
,
i
));
}
}
ast_bt_free_symbols
(
strings
);
}
...
...
@@ -314,7 +322,7 @@ static void region_data_check(struct ast_region *reg)
if
(
*
pos
!=
FREED_MAGIC
)
{
astmm_log
(
"WARNING: Memory corrupted after free of %p allocated at %s %s() line %d
\n
"
,
reg
->
data
,
reg
->
file
,
reg
->
func
,
reg
->
lineno
);
print_backtrace
(
reg
->
bt
);
print_backtrace
(
reg
->
bt
,
NULL
);
my_do_crash
();
break
;
}
...
...
@@ -434,14 +442,14 @@ static void region_check_fences(struct ast_region *reg)
if
(
*
fence
!=
FENCE_MAGIC
)
{
astmm_log
(
"WARNING: Low fence violation of %p allocated at %s %s() line %d
\n
"
,
reg
->
data
,
reg
->
file
,
reg
->
func
,
reg
->
lineno
);
print_backtrace
(
reg
->
bt
);
print_backtrace
(
reg
->
bt
,
NULL
);
my_do_crash
();
}
fence
=
(
unsigned
int
*
)
(
reg
->
data
+
reg
->
len
);
if
(
get_unaligned_uint32
(
fence
)
!=
FENCE_MAGIC
)
{
astmm_log
(
"WARNING: High fence violation of %p allocated at %s %s() line %d
\n
"
,
reg
->
data
,
reg
->
file
,
reg
->
func
,
reg
->
lineno
);
print_backtrace
(
reg
->
bt
);
print_backtrace
(
reg
->
bt
,
NULL
);
my_do_crash
();
}
}
...
...
@@ -880,6 +888,9 @@ static char *handle_memory_show_allocations(struct ast_cli_entry *e, int cmd, st
ast_cli
(
a
->
fd
,
"%10u bytes allocated%s by %20s() line %5u of %s
\n
"
,
(
unsigned
int
)
reg
->
len
,
reg
->
cache
?
" (cache)"
:
""
,
reg
->
func
,
reg
->
lineno
,
reg
->
file
);
if
(
reg
->
bt
&&
!
ast_strlen_zero
(
fn
))
{
print_backtrace
(
reg
->
bt
,
a
);
}
selected_len
+=
reg
->
len
;
if
(
reg
->
cache
)
{
...
...
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