Solved

C++ Debugging question VS.NET

Posted on 2004-08-02
10
324 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 86

Expert Comment

by:jkr
Comment Utility
>>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
Comment Utility
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
Comment Utility
That's what I would assume also.
0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

763 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

12 Experts available now in Live!

Get 1:1 Help Now