Solved

C++ Debugging question VS.NET

Posted on 2004-08-02
10
325 Views
Last Modified: 2006-11-17
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.  
0
Comment
Question by:jjacksn
  • 6
  • 4
10 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 11698233
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
 
LVL 86

Expert Comment

by:jkr
ID: 11698245
BTW, under 'Build' menu, there should also be a 'Debug' subment that has the option "Attach to Process"...
0
 
LVL 5

Author Comment

by:jjacksn
ID: 11699798
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
 
LVL 86

Expert Comment

by:jkr
ID: 11699863
>>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
 
LVL 5

Author Comment

by:jjacksn
ID: 11707188
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 86

Expert Comment

by:jkr
ID: 11707225
>>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
 
LVL 5

Author Comment

by:jjacksn
ID: 11707373
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
 
LVL 86

Expert Comment

by:jkr
ID: 11707437
That's what I would assume also.
0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 11707611
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
 
LVL 5

Author Comment

by:jjacksn
ID: 11707826
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now