Visual C++ 2005 hangs during qt builds - c++

At my shop, the main product app is a mongrel built on MFC, QT and other random things devs have thrown in over the years.
In the current stack, Qt toolkit is on the way out, but still features heavily.
If I have SQL 2005 Management studio open and have to do a full build, it usually hangs a CPU (even after the offending process is taken out back and shot...) during the qt specific parts of the build (Moc'ing and UIC'ing)
has anyone seen anything like this? any ideas what the problem could be?

In my experience, some of these tools are capable of looping forever (qt4: lupdate/lrelease for sure).

Related

After using QFileDialog program crashes after few seconds

I am making app to increase productivity in our company. It reads the whole .csv file and puts its contents to a table in .pdf format. I am using QT as GUI library and PoDoFo as .pdf library.
The thing is, after I let user select .csv file to get data from and path to save generated .pdf, the program crashes in two minutes or so. It varies from case to case. I was able to "track" the issue down to the QFileDialog.
It doesn't matter if I created it on the stack, or dynamically still the same thing happens. From the moment you press "Choose" in the GUI, which opens up file dialog, program will crash in something around a two minutes giving this in Visual Studio Community 2017
I was able to create minimalistic code, to reproduce the error. I am using Windows 7 Pro, Microsoft Visual Studio Community 2017, compiling 32-bit debug
.h,.cpp,.ui files: https://www.dropbox.com/sh/cf057p4lnumesol/AAD39zDJnrxGChXAuE7y27Kra?dl=0
Any help would be appreciated, I've spent 5 days of my free time trying to figure this out. Thanks
EDIT: I understand that the "Frame not in module" means that visual studio doesn't have debugging symbols for the part of code where crash occurred, since I did not built qt myself, that makes sense.
EDIT2: I am using QT Visual Studio Tools addon version 2.3.2
Qt version is 5.12.2
EDIT3: Crashes only occurs when compiling for 32-bit arch.
EDIT4: Crash is happening only if using native file dialog. If option QFileDialog::DontUseNativeDialog is set, then no crash occurrs.
Not sure if this is related, but I had an issue where if I gave a path to the FileDialog it would grind away for a few seconds because it was somehow interpreting it as a network path. To fix this I gave it a path that had a prefix of "file://". To accomplish this I did this:
QUrl().fromLocalFile(cell_info->progDir()).toString()
The original path came from cell_info->progDir(). Somehow that path was a regular windows specific path. Once I wrapped it in the from LocalFile call it produced what I needed for all platforms I was using it with.
Again, I have no idea if this is related to your issue, but it sounds fishy like it is grinding away in the background on something. If this is not related feel free to ignore.

Embedding thread names in Windows minidump files

Our 32-bit C++ application names its threads using the standard approach on Windows. We generate minidumps when errors occur, but when the dumps are loaded into Visual Studio 2013 the thread names are missing. This makes it harder to debug the problem given the high number of threads present.
The only way I've heard of to improve this comes from this Microsoft User Voice posting, where the caller suggests embedding them in a custom stream, and writing a custom Visual Studio extension to rename the threads upon loading the dump. However, this seems cumbersome and apparently adds a lot of time to the loading process.
Is there an easier way to embed thread names in the dump so they "just work" when loading them in Visual Studio?
For reference: we use Visual Studio 2013 to build, our apps run on Win7 or higher, and we use Google Breakpad to generate dumps.
Microsoft has indicated that the SetThreadDescription API will be the basis for any proper support they add in the future for thread names in dumps, debuggers, and/or analysis tools.
Unfortunately it appears that this API is rather new and is not yet supported in dumps, WinDbg, Visual Studio Debugger, etc. There is a User Voice request to add this support, so please vote for it if you would like a way to properly give threads a persistent name.
After some more digging, it seems like one way to do this would be to store a pointer to the name in the ArbitraryUserPointer field of the TEB of the thread.
If the TEB was then embedded in the minidump (which can be achieved with the MiniDumpWithProcessThreadData flag, according to this article) then it seems like at the very least we could view the current thread name in the Visual Studio watch window by evaluating
(*(char **)(#TIB+0x14))
Perhaps a Visual Studio debugger add-on could be written to examine the contents of the TEB when a process is attached to, and use the exception 'hack' to set the name of the thread in the Threads window.

How to configure Qt debugger and what is needed for it to work

Ok so Im really confused here, I got the same erroe as Martin.kv who started this thread How to configure CDB in Qt Creator?
which said "The preferred debugger engine for debugging binaries of type 'x86-windows-msvc2010-pe-32bit' is not available....Details: There is no CDB binary available for binaries in format 'x86-windows-msvc2010-pe-32bit"
I assume I have to download some stuff to fix this, so I went here http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx and I have Windows 7 on a 32-bit system so I went under this title "Install the Windows 7 Version of Debugging Tools for Windows" and went here http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=8279 to download the Debugging tools for windows.
From all the stuff I've read, on the thread I referenced and a few others, what I downloaded seemed to be the right thing.
I admit I screwed up a little because I forgot to check where it was putting the Debugger Tools because while it started downloading I was still searching for what to do after the download. But I'm pretty sure it is in "C:\Program Files\Microsoft Windows Performance Toolkit" but I dont have anything called Windows Kits, which everyone else is saying theirs is in, and I still dont seem to have a cdb.exe..
did I download the wrong thing? What do I need to do/download instead? and also where can I get the Symbol Server that the Qt site and many other people suggest??
Sorry I'm new to Qt and some what to programming in general and my program for my internship is due at the end of the day and last night it stopped working so I'm kind of freaking out a little but I figure the debugger could help because it doesnt really make sense why it stopped working.
There should be a place in the Qt Creator settings where you can point it to the cdb.exe that comes with the Debugging tools for Windows.
See here: http://doc.qt.nokia.com/qtcreator-2.5/creator-debugger-engines.html
I got cdb working with QtCreator only after the following steps:
1) Download & install Debugging Tools for Windows
2) QtCreator->Tools->Options->Build & Run->Tool Chains
3) Copy autodetected MS compiler to the "manual" section
4) Set the path to cdb.exe
5) Use the "manual" MS compiler.
Perhaps there's some way to avoid steps 3-5 (playing around with environment variables maybe) but the described scheme works fine so I don't mind.

Using Cuda with a Forms based GUI in xp

Brand new at CUDA programming so please bear with me. I finally got cuda to work in console application using Visual studio 2008 on win xp (32 bit). But my main target is to port an existing program to port to cuda. This program is very computational intensive and is based on a complex gui. So, porting to cuda makes sense as it will cut down on my computational time significantly. I did some research and found no example where cuda is used with a forms based application. Its always been with a console application. But converting my gui into a console based application will be out of the question.
So, I tried doing a test (forms based gui) where I included the .cu file in my project. But on compile i get this linker error
fatal error LNK1313: ijw/native module detected; cannot link with pure modules
So I guess cuda doesn't play nice with managed code.
My question is: IS there anyway to use cuda with a form in visual studio 2008?
Another question: Has anyone even tried this as I have not seen any such example?
Please help....
Edit:--
Ok I changed the the properties->configuration->general->common language runtime support to /clr, and it compiled without any problem. But when I tried to run it i got a nasty popup dialog box with Debug Assertion failed error in file dbgheap.c, Expression _CRTisValidHeapPointer(pUserData).
So close but no cigar. Any Ideas?????
I've done this with a WPF application written in C# that used C++/CLI to interop with a mixed CLI/native assembly that in turn called CUDA code in a separate project. I've not tried WinForms but I don't see any reason why this shouldn't work. You end up writing quite a lot of plumbing code to handle the interop though.
I'd need more info about what your application was doing when __CRTisValidHeapPointer failed. Your heap has gotten corrupted somehow. It may or may not be related to CUDA code.
C# to C++ interop:
http://www.ademiller.com/blogs/tech/2009/09/c-optimization-revisited-part-3-the-native-option-c/
C++ and CUDA side-by-side:
http://www.ademiller.com/blogs/tech/2011/03/using-cuda-and-thrust-with-visual-studio-2010/
(Visual Studio 2010, CUDA 5.0) Try to set:
Linker->System->Subsystem: Not Set
Linker->Advanced->Entry Point: Empty

My C++ executable runs way faster outside the Visual Studio 2008 IDE than inside, even in release

I build a C++ application that does some number crunching.
I'm running in Visual Studio 2008 PRO SP1, in release mode, Windows 7 64 bit.
If I run it inside the IDE, the application takes 4 minutes, if I run the same executable from windows explorer it takes 6 seconds!
I have no clue. I have checked that this does not depend on the processor and operating system. I don't think I have strange VS plugins that are doing something in the background.
Any hints?
Thank you in advance!
Marco
Presumably, the slow down is caused by the debugger being attached when you are starting the application in Visual Studio. This is the case even when you've built the program in "Release" mode.
To confirm that this is indeed the source of your problem, try running your application without the debugger, using the "Start Without Debugging" command or Ctrl+F5.
It's worth nothing that in C++ specifically, when you start without debugging, your program won't use the Windows debug heap. With the debugger attached, it will.
As Cody mentioned, one option is to simply not debug. But if you want to speed up your debugging sessions, here are a few things I've found can make a huge difference:
Remove debugging print statements that are no longer necessary. If you see your log filling up with text, that is likely slowing you down significantly.
Remove breakpoints (Ctrl+Shift+F5). A couple times I've noticed a huge drop in performance, and it turned out to be due to a breakpoint with a condition that was never met.