Results 1 to 9 of 9

Thread: How to debug multiple threads?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170

    How to debug multiple threads?

    I'm using (not by choice) Microsoft's Visual Studio .NET to do my development. I've written an application that uses Microsoft's recommend method for Async Serial I/O (overlapped).

    The problem is, In my main UI thread, I'm doing a bit of serial code (sending, receiving, etc). All is good, until for some reason, my Sending thread seems to hang, crash, or something. I've tried placing all kinds of TRACE() statements to help, but i haven't been able to track it down within the send thread.

    I am able to break on when the error occurs from within my main UI thread, but I have no idea how I can switch to the Tx thread to see where it's stuck at.

    Is this possible? I would hope so...

    Thanks
    Phil

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    I'll use this free debuging tools from Microsoft, this tool is mainly for Device Driver development, but it also can use to debug normal application. Basically, this is a debugging tool you most have 1 in your desktop

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I never found out how to debug multiple threads. That's the largest problem of multithreaded programming.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    Lively Member rekcus's Avatar
    Join Date
    Jan 1999
    Location
    Kuala Lumpur
    Posts
    122

    Debug Multithreaded

    What is your setting for Project Settings->C/C++->Code Generation->Use run-time library?
    penyou!

    "The code bytes.."

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170
    rekcus:

    Multi-threaded Debug DLL (/MDd)

    Chris: I'll take a look at that...I can't believe Microsoft didn't include a 'switch to thread' ability into VStudio...crazy!

    Phil

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Stick a breakpoint somewhere in the send thread, and hope
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170
    parksie, yah, that was my original attempt. Never breaks unless I start sticking breakpoints in legit working code and that is a pain and never allows me to see the bug.

    Ugh!

  8. #8
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    According to MSDN, you can use the Threads Window (Debug->Threads) to switch between threads for debugging purposes.

    Z.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    Dallas,TX
    Posts
    170
    Originally posted by Zaei
    According to MSDN, you can use the Threads Window (Debug->Threads) to switch between threads for debugging purposes.

    Z.
    Bingo...perfect!

    Thanks
    Phil

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width