PDA

View Full Version : Visual Studio 2010 Conditional Breakpoint + QString



atsoum
24th April 2012, 10:25
Hello, I am using visual studio 2010 and Qt 4.8. I read this article regarding conditional breakpoints and std:string
http://blogs.msdn.com/b/habibh/archive/2009/07/07/new-visual-studio-debugger-2010-feature-for-c-c-developers-using-string-functions-in-conditional-breakpoints.aspx

Is it possible to achieve the same with a QString? It seems that breakpoint isn't activated when I set a codition regarding a specific value of a QString variable. For example I want to set a breakpoint to stop if variable aa = "test".

atsoum
1st May 2012, 16:11
Any help on that?

Le_B
2nd May 2012, 01:00
if the you can't do aa == "test" maybe you can try to use wsccmp((const wchar_t*)aa.utf16(), L"test") == 0 like in the exemple
(i always work with unicode but you can use strcmp())

amleto
2nd May 2012, 08:46
I doubt it will work because the only method evaluation that is supported are mentioned in the article. Using methods on QString (e.g. utf16()), therefore, I believe wont work. You would have to directly access the data pointer in QString.

Le_B
2nd May 2012, 13:13
you mean like :

wchar_t* str_ptr = (const wchar_t*)aa.utf16();
and then put the breakpoint test to :
wsccmp(str_ptr, L"test") == 0;
?

amleto
2nd May 2012, 18:18
That isn't what you said in your previous post. I was stating my doubt that

wsccmp((const wchar_t*)aa.utf16(), L"test") == 0

would work due to utf16() method.

Le_B
2nd May 2012, 18:37
oh but that work i m sure of it
utf16() retrun the wide char pointer to the qstring

amleto
2nd May 2012, 21:56
It appears you are missing my point again. My point being that visual studio wont support it on a break line conditional.
(my untested belief based on the fact MS are very happy to shout about supporting basic string free functions)