Can't "Attach to Process" in VC++ 6.0

This is a discussion on Can't "Attach to Process" in VC++ 6.0 within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I have a program that dynamically loads a DLL and starts a thread from that DLL... I need to ...

  1. #1
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545

    Can't "Attach to Process" in VC++ 6.0

    Hi,
    I have a program that dynamically loads a DLL and starts a thread from that DLL...
    I need to debug & step through the thread in that DLL, but I can't connect to it.
    If I run the .exe in the debugger, I can't set a breakpoint in the DLL since it's in a different project.
    I tried "Attach to Process", but once I select my program to attach to, it closes the DLL project, then says "Cannot execute program".

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Nevermind. I figured out how to do it.
    I just opened the DLL project and clicked Go (F5), then it asked me which .exe to load, so I selected my .exe and it started debugging as usual.
    I'm still not sure how that "Attach to Process" is supposed to work though.

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,458
    I'm still not sure how that "Attach to Process" is supposed to work though.
    It creates new "temporary" project for the exe and starts debugging (so I prefer to do it from another instance of VS)
    If you break - it shows the current callStack, starting with some kernel addresses probably

    You can go up the stack till you see the name of your own function (if exe is compiled with debug info) - when you select your own function - VS will open proper code if it can locate it in the path notedin the pdb file, otherwise it will ask about location of the source file, you can browse and select the apropriate file, after that you can debug as regular...

    For dlls I sometimes add assert or MEssageBox at the beginning of the function of interest, attach debugger while I see the message, go up the stack into the function I have put the message box and place breakpoint in the next line, after that click ok and start debugging from the breakpoint
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. makefile exported by vc 6.0 doesn't work
    By wow in forum Windows Programming
    Replies: 7
    Last Post: 03-24-2006, 03:20 PM
  2. Can't compile this with VC 6.0
    By uriel2013 in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2003, 07:43 PM
  3. Visual Studio 6.0 Help
    By L_I_Programmer in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2003, 09:35 PM
  4. adding a header file in VC 6.0
    By stimpyzu in forum C++ Programming
    Replies: 5
    Last Post: 10-28-2002, 01:26 AM
  5. VC 6.0 compiled error
    By alan4100 in forum Windows Programming
    Replies: 4
    Last Post: 09-17-2001, 03:10 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21