Solved

C++ Debugging question VS.NET

Posted on 2004-08-02
10
328 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

751 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