[Crash-utility] [PATCH] fix output bug of trace.c

qiaonuohan qiaonuohan at cn.fujitsu.com
Tue Oct 30 02:31:35 UTC 2012


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-output-bug-for-trace.c.patch
Type: text/x-patch
Size: 772 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20121030/e54b7fc5/attachment.bin>


More information about the Crash-utility mailing list