Hello Dave,
The patch is used to fix the output of trace.c.
When I was using trace command to display function tracer's data. The
following information is displayed.
<cut>
crash> trace show
version = 6
cpus=2
<idle>-0 [001] 20067.827943: function:
0xffffffff81089fa40xffffffff8109e423
<idle>-0 [001] 20067.827944: function:
0xffffffff811115a40xffffffff8109e4cd
<idle>-0 [001] 20067.827944: function:
0xffffffff81097a140xffffffff8109e44f
<idle>-0 [001] 20067.827945: function:
0xffffffff81089fa40xffffffff8109e479
<idle>-0 [001] 20067.827945: function:
0xffffffff81089fa40xffffffff8109e482
...
<cut>
In tmp_fprintf, function snprintf is used to output data. However, if
the following situation happends, the last character is omitted which
causes the above bug.
<cut>
snprintf(buf, 10, "123456789\n"); /* '\n' is omitted */
<cut>
With the patch, the output is like below.
<cut>
crash> trace show
version = 6
cpus=2
<idle>-0 [001] 20067.827943: function:
debug_lockdep_rcu_enabled <-- walk_tg_tree_from
<idle>-0 [001] 20067.827944: function:
rcu_is_cpu_idle <-- walk_tg_tree_from
<idle>-0 [001] 20067.827944: function: tg_nop
<-- walk_tg_tree_from
<idle>-0 [001] 20067.827945: function:
debug_lockdep_rcu_enabled <-- walk_tg_tree_from
<idle>-0 [001] 20067.827945: function:
debug_lockdep_rcu_enabled <-- walk_tg_tree_from
...
<cut>
--
--
Regards
Qiao Nuohan
>From 8837200f2e9d3f9e1417b3a469645ae99fa4bc52 Mon Sep 17 00:00:00 2001
From: qiaonuohan <qiaonuohan@xxxxxxxxxxxxxx>
Date: Tue, 30 Oct 2012 09:23:10 +0800
Subject: [PATCH] fix output bug for trace.c
---
extensions/trace.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/extensions/trace.c b/extensions/trace.c
index ea9b74c..3c33f3c 100644
--- a/extensions/trace.c
+++ b/extensions/trace.c
@@ -1595,7 +1595,7 @@ do { \
break; \
__pos = tmp_file_pos; \
__pos += snprintf(__buf + __pos, tmp_file_size - __pos, fmt); \
- if (__pos > tmp_file_size) { \
+ if (__pos >= tmp_file_size) { \
tmp_file_size = __pos + tmp_file_size; \
__buf = realloc(__buf, tmp_file_size); \
if (!__buf) { \
--
1.7.1
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility