[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] tools/gtraceview: fix SIGFPE
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |