This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
"Transfer rate" patch
- From: Ilko Iliev <office at ronetix dot at>
- To: gdb-patches at sourceware dot org
- Date: Tue, 05 Sep 2006 09:24:48 +0200
- Subject: "Transfer rate" patch
Hi,
I found a small bug by the calculating of the transfer rate at the
"load" command - if the download image size or the download speed is
higher then occurs overflow and the printed information is wrong.
I attached a patch for this problem.
regards,
Ilko Iliev
www.ronetix.at
--- symfile.c.orig 2006-08-31 15:29:12.000000000 +0200
+++ symfile.c 2006-08-31 15:47:28.000000000 +0200
@@ -1769,14 +1769,14 @@
ui_out_text (uiout, "Transfer rate: ");
if (time_count > 0)
{
- ui_out_field_fmt (uiout, "transfer-rate", "%lu",
- 1000 * (data_count * 8) / time_count);
- ui_out_text (uiout, " bits/sec");
+ ui_out_field_fmt (uiout, "transfer-rate", "%lu",
+ (unsigned long)((((unsigned long long)data_count)*1000)/time_count)/1024);
+ ui_out_text (uiout, " Kbytes/sec");
}
else
{
- ui_out_field_fmt (uiout, "transferred-bits", "%lu", (data_count * 8));
- ui_out_text (uiout, " bits in <1 sec");
+ ui_out_field_fmt (uiout, "transferred-bits", "%lu", data_count);
+ ui_out_text (uiout, " bytes in <1 sec");
}
if (write_count > 0)
{