[Bug breakpoints/21121] New: clock() result is altered by time spent on the CLI

daniel.gutson at gmail dot com sourceware-bugzilla@sourceware.org
Thu Feb 9 16:30:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=21121

            Bug ID: 21121
           Summary: clock() result is altered by time spent on the CLI
           Product: gdb
           Version: 7.11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: daniel.gutson at gmail dot com
  Target Milestone: ---

Consider the following:

#include <time.h>
#include <iostream>

int main()
{
        const auto start = clock();
        volatile auto pepe = start * 3;
        ++pepe;
        std::cout << clock() - start << std::endl;
}

By breaking in the ++pepe line, waiting in the CLI until continuing affects the
results shown.
However, the time while the process is suspended does not affect clock() (while
not debugging).

I think that waiting an arbitrary time in the CLI should not make the behavior
as if clock() keeps counting.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list