[Lldb-commits] [PATCH] D130939: [LLDB][NFC] Fix potential div by 0 "count" can be zero potentially causing div by 0

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 2 02:32:30 PDT 2022


DavidSpickett added a reviewer: DavidSpickett.
DavidSpickett added a comment.

Given that testing packet speed by sending no packets seems pointless, I wonder if this should be asserts on the packet counts instead.

If this speed test is something we do as part of connection setup, you'd probably want to know that something went wrong rather than lldb claiming that any speed/packet size/whatever is fine. Then failing to send any real packets later.



================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:2483
             ((float)num_packets) / duration<float>(total_time).count();
         auto average_per_packet = total_time / num_packets;
         const duration<float> standard_deviation =
----------------
This could have the same issue if `num_packets` parameter is 0.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130939/new/

https://reviews.llvm.org/D130939



More information about the lldb-commits mailing list