|
Several. You can set a conditional breakpoint on any of those local variables you want to watch. Or you could add some variables to the scope outside of those calls to just store the values of those variables for debugging purposes. Additionally, you could always add code to output important data to a file as it goes through your code.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thank you Zac,
The idea of setting a conditional break point is not feasible for me, becasue the value of variable which will cause error is not predictable (image some mathematics operations ...).
So, I have to write some additional code to some place, a file or the console. But actually, I do not want to add them since I am debugging some race conditions in a multiple threaded application, and I concern that if I add some additional debug code, the race condition will not occur. And, I only release application without debug code ... I mean I want to test the application the same as the one I will release (without debug code).
Any comments or good points to solve this?
regards,
George
|
|
|
|
|
George_George wrote: The idea of setting a conditional break point is not feasible for me, becasue the value of variable which will cause error is not predictable
But you do know the valid values for such a variable I take it?
George_George wrote: So, I have to write some additional code to some place, a file or the console. But actually, I do not want to add them since I am debugging some race conditions in a multiple threaded application, and I concern that if I add some additional debug code, the race condition will not occur. And, I only release application without debug code ... I mean I want to test the application the same as the one I will release (without debug code).
You may not want to, but you may have to in order to find your bug. You can test your release builds all you want, but if you are not able to find the cause of your bug, you need to start gathering more information. If the race condition does not occur when you add output information, at least you would have tried -- and if it does still occur, you would have more information about where it might be. Debugging is largely trial and error.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thank you Zac,
Zac Howland wrote: But you do know the valid values for such a variable I take it?
I mean in some situation, the value 100 for variable foo is correct (not causing errors) in a complex system, but later, the value 100 for variable 100 is in-correct (causing errors). It is highly dependent on other threads running at the same time. Have I made myself understood?
Any ideas?
regards,
George
|
|
|
|
|
George_George wrote: I mean in some situation, the value 100 for variable foo is correct (not causing errors) in a complex system, but later, the value 100 for variable 100 is in-correct (causing errors). It is highly dependent on other threads running at the same time. Have I made myself understood?
I think I understand your problem, but there is no real easy way to debug it.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Thank you Zac,
Do you mean the best solution I could use is to debug some codes to manually dump the values of the variables I am interested to somewhere, and to monitor/analyze them later when error occurs?
regards,
George
|
|
|
|
|
how to bind data from database to adrotator control in .NET. and need code for horizontal sliding.
Please help me in this...
Thanks & Regards
Sandeep.k
.NET Programmer
sandeep chowdary.k
|
|
|
|
|
hi, all:
I've developed a bho plugin for internet explorer. It simply receive the DISPID_BEFORENAVIGATE2 event and change the address in the address bar. It's event-driven and I think it will not cost too much cpu. But to my surprise when it's loaded into IE, the cpu usage turns to be 100% and I can do nothing else.
Why it costs so much cpu and how to resolve this problem?
Thank you very much!
harald
|
|
|
|
|
what is the Difference between C++ and VC++ ?
|
|
|
|
|
This has been asked several times before. In short, VC++ is Microsoft's version of the C++ language.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Then can u give me links of it
|
|
|
|
|
See here.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
My understanding is that DOS C++ is for Console based applications. Once you get into Visual C++, you can develop Windows-like applications - applications containing menus, buttons, dialog boxes and many more features.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
you can create console based application using visual C++.
-Prakash
|
|
|
|
|
Mr.Prakash wrote: you can create console based application using visual C++.
That's backward compatibility.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
you can create console application with win32 support
-Prakash
|
|
|
|
|
|
As was said before, VC++ is the Microsoft version of C++. It contains several extensions to the official C++ standard, many of wich i find quite compeling. Microsoft makes a habit of "extending" broadly accepted standards. I don't like it most of the time, but i think that in this case, they did a good job (if you disregard the heap if compatibility issues even between their own different compiler versions).
If you read your way through th MSDN-Library VC++ articles, you will stumble upon paragraphs marked "Microsoft specific" once in a while. That's where the difference is.
|
|
|
|
|
Mr.Brainley wrote: if you disregard the heap if compatibility issues even between their own different compiler versions
I know this isn't what you were getting at, but just a note that the VS.Net2005 compiler is something like 98.5% compliant with the C++ standard, which was a lot higher than any other compiler available.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
i am doing an application where i need to load a bitmap from a file like C:\MyFolder where my bitmaps are stored. i don't want use bitmap as resource to add bitmaps to my application. Now the problem is when i run the application using LoadImage() function it is showing my bitmap in scratched or crushed format(bad format). i want to show it as it is i.e. in actual size. i have attached the code snippet i m using. please help me immediately.
thanks to everyone..
void CPictureBox::ShowBitmap(CPaintDC *pdc)
{
//Create a device context to load the bitmap into
CDC dcMem; dcMem.CreateCompatibleDC(pdc);
//Get the Display area available
CRect lRect;
GetClientRect(lRect);
lRect.NormalizeRect();
//select the bitmap into compatible device context
CBitmap* pOldBitmap = (CBitmap*)dcMem.SelectObject(&m_bmpBitmap);
//m_bmpBitmap.SetBitmapDimension(lRect.Width(),lRect.Height());
//copy & resize the window to the dialog window
int bmw, bmh ;
m_bmpBitmap.GetBitmap(&bm);
bmw = bm.bmWidth;
bmh = bm.bmHeight;
int xo=0, yo=0;
pdc->BitBlt (xo, yo, lRect.Width(),
lRect.Height(), &dcMem,
0, 0, SRCCOPY);
pdc->StretchBlt(0,0,lRect.Width(),lRect.Height(),&dcMem,0,0,bmw,bmh,SRCCOPY);
dcMem.SelectObject(pOldBitmap);
}
void CPictureBox::OnPaint()
{
CPaintDC dc(this);
// device context for painting
RECT rect;
GetClientRect(&rect);
dc.FillSolidRect(&rect, RGB(255,255,255));
if(m_sBitmap!="")
ShowBitmap(&dc);
}
void CPictureBox::SetBitmap(CString strBitmap)
{
m_sBitmap = strBitmap;
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_sBitmap, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE | LR_CREATEDIBSECTION );
// Do we have a valid handle for the loaded image?
if (hBitmap)
{
// Delete the current bitmap
if (m_bmpBitmap.DeleteObject())
m_bmpBitmap.Detach(); // If there was a bitmap, detach it
// Attach the currently loaded bitmap to the bitmap object
m_bmpBitmap.Attach(hBitmap);
}
m_bmpBitmap.GetBitmap(&bm); //Get Bitmap Structure
Invalidate();
jIteen
|
|
|
|
|
Whats wrong in your code?
|
|
|
|
|
http://www.codeproject.com/tools/imageviewer.asp[^]
I wrote this tool to help solve problems like you are having. With this tool I could check that LoadImage() actually loaded the image the way I wanted it loaded, I could check every bitmap manipulation immediately after it was done etc.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
yes your article But I think its a good article well done Arends
|
|
|
|
|
First of all i dont understand why are you using a BitBlt and StretchBlt in your drwing code.. shouldn't you be using one of them. Anyways your logic.
By the way if you only want to display the bitmap on the dialog try removing the LR_CREATEDIBSECTION flag from LoadImage call. This will create a DDB compatible with your Display and u dont have to worry about the palette and other petty issues :P.. just select it and BitBlt or StretchBlt it
Peace!
|
|
|
|
|
|