Freeze/pause thread?

Sysprogs forums Forums VisualGDB Freeze/pause thread?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25220
    DeeJayBee
    Participant

    Hello,

    Normal Windows C++ projects allow threads to be paused (“Freeze” is the context menu option in the Threads window), a piece of functionality which is massively useful when diagnosing/replicating deadlock/general synchronisation issues.  This functionality is present in VisualGDB but does not appear to do anything.  Consider this code:

    #include <pthread.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    
    void* ThreadFunc(void*)
    {
    int i = 0;
    while (true)
    {
    printf("%i\n", ++i);
    sleep(1);
    }
    
    }
    
    int main(int argc, char** argv)
    {
    pthread_attr_t attr;
    pthread_t thread;
    
    int nRet = pthread_create(&thread, &attr, ThreadFunc, 0);
    if (nRet != 0) exit(-1);
    
    void* pRet = 0;
     pthread_join(thread, &pRet);
    
    return 0;
    }
    
    

    After starting debugging this code, then pausing execution, then right clicking on the worker thread and choosing “Freeze”, then resuming debugging, I would have liked to have seen the output stop appearing in the output window; but sadly the count continues.

    Is it possible to have this functionality implemented?

    Thanks very much!

    • This topic was modified 5 years, 5 months ago by DeeJayBee.
    #25222
    support
    Keymaster

    Hi,

    Sorry, unfortunately the only case where the freeze/resume thread command is currently supported is kernel-mode debugging of multi-core devices via JTAG with VisualKernel where VisualKernel is fully controlling the status of each core. It is not supported for other debug sessions because the underlying gdb debugger does not support this functionality.

    If gdb is extended in the future to support freezing/resuming of individual threads, we will add this functionality to VisualGDB as well.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.