C++ Debugging question VS.NET

I can't tell where my program is hanging.  Is there a way to let the program run and then ask it to move to the line it is currently executing?  I am making a bunch of calls to download messages, and some of the calls are not returning.  However, I can't easily but break points in because there are about 2000 messages it could be.  I just am trying to determine the call that is not returning.  
LVL 5
jjacksnAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jkrConnect With a Mentor Commented:
BTW, to diagnose that better, I'd suggest to use

          string sender_name, sender_email;
          OutputDebugString ( "BEFORE GetProps()\n");
          hr = imsg->GetProps((SPropTagArray*)m_pSenderProps,0,&pcount,&props);
          OutputDebugString ( "AFTER GetProps()\n");
         if(SUCCEEDED(hr))
         {

and watch the output with a Debug Viewer like e.g. http://www.sysinternals.com/ntw2k/freeware/debugview.shtml
0
 
jkrCommented:
Go to the task manager, pick the 'Processes' tab, select your process, right-click and choose 'Debug', this will take you straigt to the debugger. There, all you have to do is selecting 'Break' from the debug menu.
0
 
jkrCommented:
BTW, under 'Build' menu, there should also be a 'Debug' subment that has the option "Attach to Process"...
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
jjacksnAuthor Commented:
That worked, the breaker is putting the green triangle at the GetProps line as the first call in the USER DEFINED code.  

      CComPtr<IMAPITable>      tablePtr;

            //Get the message da\ta
            ULONG recipientType = 1; //if we can't read the recipient type, assume its of type 1.
            ULONG pcount; SPropValue *props=0;
            string sender_name, sender_email;
---->            hr = imsg->GetProps((SPropTagArray*)m_pSenderProps,0,&pcount,&props);
            if(SUCCEEDED(hr))
            {
                  //check in here for message class if we want to, but we already did with the folders.
                  if(props[1].ulPropTag==PR_SENDER_NAME) sender_name = props[1].Value.lpszA;
                  if(props[2].ulPropTag==PR_SENDER_EMAIL_ADDRESS) sender_email = props[2].Value.lpszA;


However, when I first call break, it is breaking into xsting file at the  _Traits line.

void _Eos(size_type _Newsize)
      {      // set new length and null terminator
            _Traits::assign(_Myptr()[_Mysize = _Newsize], _Elem());
            }
Where _Newsize is 254228212.  (is that large?)

any idea what might be causing the hang?  

Does the green triangle represent the NEXT line to be executed (meaning its hanging on the string def line?), or the line that is CURRENTLY executed.  I don't really understand how the string defs could be doing anything wrong.  but, I also don't understand why it is breaking into the xstring file.  
0
 
jkrCommented:
>>Does the green triangle represent the NEXT line to be executed (meaning its hanging on the
>>string def line?), or the line that is CURRENTLY executed

That is the next line. Go up in the call stack to see whether this function is called in a loop. BTW, that you are 'breaking' the program while executing a library function is not unusual.
0
 
jjacksnAuthor Commented:
the call stack looks liks:

       ntdll.dll!77f5c524()       
       kernel32.dll!77e75ee0()       
       user32.dll!77d463eb()       
       user32.dll!77d46466()       
       PSTPRX32.DLL!35618dbd()       
       PSTPRX32.DLL!35619a06()       
       PSTPRX32.DLL!356027be()       
       PSTPRX32.DLL!355fc92c()       
       PSTPRX32.DLL!355fb8ae()       
>      msvcp71d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos(unsigned int _Newsize=253376380)  Line 1475 + 0x22      C++
       PSTPRX32.DLL!355f9f7c()       
       IOutlook.dll!CCoOutlookExtractor::ProcessIncomingMessageData(IMessage * imsg=0x0f1a36ac, std::basic_string<char,std::char_traits<char>,std::allocator<char> > * subject=0x0012eb0c, _FILETIME * date=0x0012ea00)  Line 1522 + 0x1f      C++
       IOutlook.dll!CCoOutlookExtractor::ParseMessageFolder(short * ptProgress=0x0012ee48, unsigned long stepSize=50)  Line 1219      C++
       IOutlook.dll!CCoOutlookExtractor::ParseActiveFolder(short * ptrProgress=0x0012ee48, unsigned long stepSize=50)  Line 873 + 0x10      C++
       rpcrt4.dll!780038f7()       
       rpcrt4.dll!780791a5()       
       mscorwks.dll!791fac97()       
       System.Windows.Forms.dll!7b8227c3()       
       System.Windows.Forms.dll!7b8227a4()       
       mscorwks.dll!791b51db()       
       mscorwks.dll!791fd6a8()       
       mscorwks.dll!791fd603()       
       mscorwks.dll!791fd603()       
       mscorwks.dll!791fec1d()       
       mscorwks.dll!791feb95()       
       mscorwks.dll!791febaa()       
       mscorwks.dll!791febaa()       
       mscorwks.dll!791fea17()       
       mscorwks.dll!791f92c9()       
       System.Windows.Forms.dll!7b825880()       
       System.Windows.Forms.dll!7b8257ac()       
       System.Windows.Forms.dll!7b81ca86()       
.............

The line number 1522 is the GetProps method line.  What does the + 0x1f mean?
0
 
jkrCommented:
>>What does the + 0x1f mean?

That's the offset into the function in the binary image. Are there any lengthy loops in 'ParseMessageFolder()' or 'ParseActiveFolder()'?
0
 
jjacksnAuthor Commented:
ParseMessageFolder takes 50 messages at a time, and loops over them, calling ParseIncomingMessage on each message.  ParseActiveFolder just calls ParseMessageFolder.  

The code hangs about 3/4s of the way through my inbox when it gets to my first IMAP header message that is not fully downloaded.  It is parsing about 10,000 messages.  

so since 1522 corresponds to the GetProps method, can I assume that is the method that is not returning?  
0
 
jkrCommented:
That's what I would assume also.
0
 
jjacksnAuthor Commented:
yep, that's it, the last line in the output window is before get Props, thanks.  Now i need to figure out why that's hanging
0
All Courses

From novice to tech pro — start learning today.