WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools/gtraceview: fix SIGFPE

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools/gtraceview: fix SIGFPE
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 29 Jan 2010 01:05:25 -0800
Delivery-date: Fri, 29 Jan 2010 01:06:50 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1264755586 0
# Node ID 857d7b2dd8c78f7212eb1f5741815aa34cbcfc64
# Parent  b0ffb4912c46ca78a799ec2fe1f4709b05248cfe
tools/gtraceview: fix SIGFPE

If there are 0 or 1 valid record in xentrace file,
SIGFPE will occur. Fix it.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
---
 tools/misc/gtraceview.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -r b0ffb4912c46 -r 857d7b2dd8c7 tools/misc/gtraceview.c
--- a/tools/misc/gtraceview.c   Fri Jan 29 08:55:27 2010 +0000
+++ b/tools/misc/gtraceview.c   Fri Jan 29 08:59:46 2010 +0000
@@ -208,6 +208,11 @@ int main(int argc, char *argv[])
 
     if (load_file(fname))
         exit(EXIT_FAILURE);
+
+    if (!data_cur) {
+        fprintf(stderr, "file %s doesn't contain any valid record\n", fname);
+        exit(EXIT_FAILURE);
+    }
 
     if (mode_init())
         exit(EXIT_FAILURE);
@@ -939,14 +944,15 @@ int time_mode_rebuild(uint64_t start_tim
     struct cpu cur_state[MAX_CPU_NR];
     uint64_t tsc = start_time;
     struct state *state;
-    uint64_t number, temp;
+    uint64_t number, temp = 0;
     int state_cur = 0;
 
     for (i = 0; i < max_cpu_num; i++)
         cur_state[i].flag = FLAG_UNKNOWN;
 
     /* allocate spaces, it may be huge... */
-    temp = (data[data_cur-1].tsc - start_time)/time_scale;
+    if (time_scale)
+        temp = (data[data_cur-1].tsc - start_time)/time_scale;
     number = 10000UL;
     if (temp < number)
         number = temp;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools/gtraceview: fix SIGFPE, Xen patchbot-unstable <=