Qt 4.8.2 QString toStdString unhandled exception - visual-studio-2010

void QuinielaApuesta::funcion(QString & str)
{
std::string cadenita = str.toStdString();
std::cout << cadenita << std::endl;
}
I am on Qt 4.8.2 for VS2010, Windows 7 N 64-bit, Visual Studio 2010 and using the QString method "toStdString()" (or something somewhat related) causes an Unhandled exception.
it doesn't matter where I use the line
std::string cadenita = str.toStdString();
It will cause an unhandled exception. In this particular case, it happens right after I get out of the method "funcion"s scope. But it happens in the current context of the scope escape (That is, if you put this line in an object's constructor, it will proceed as expected until the end of the constructor, and then when it should proceed to a higher scope level, it will send an Unhandled Exception error).
I have isolated the issue to .toStdString by trial and error, and I cannot say if other methods might (or might) have this same issue. I can say, however, that as soon as the line is commented, it all works ok. In fact, if I replace said line with a simple
std::cout << "Some Funny Test Text" std::endl;
It all works fine and dandy.
The error is
Unhandled exception at 0x53b8ad7a (msvcp100d.dll) in C_plus_plus_QT_project.exe: 0xC0000005: Access violation reading location 0xccccccd0.
And then in file xutility, line 201
#if _ITERATOR_DEBUG_LEVEL == 2
if (_Myproxy != 0)
{ // proxy allocated, drain it
_Lockit _Lock(_LOCK_DEBUG);
for (_Iterator_base12 **_Pnext = &_Myproxy->_Myfirstiter;
*_Pnext != 0; *_Pnext = (*_Pnext)->_Mynextiter) // HERE IS THE LINE WHERE THE BREAK KICKS IN
(*_Pnext)->_Myproxy = 0;
_Myproxy->_Myfirstiter = 0;
}
Visual Studio's output is:
'C_plus_plus_QT_project.exe': Loaded 'C:\Users\aravasio\Desktop\C_plus_plus_QT_project\Debug\C_plus_plus_QT_project.exe', Symbols loaded.
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Users\aravasio\Desktop\C_plus_plus_QT_project\Debug\QtGui4.dll', Binary was not built with debug information.
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\comdlg32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149af\comctl32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Users\aravasio\Desktop\C_plus_plus_QT_project\Debug\QtCore4.dll', Binary was not built with debug information.
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcp90.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'C_plus_plus_QT_project.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
First-chance exception at 0x53b8ad7a (msvcp100d.dll) in C_plus_plus_QT_project.exe: 0xC0000005: Access violation reading location 0xccccccd0.
Unhandled exception at 0x53b8ad7a (msvcp100d.dll) in C_plus_plus_QT_project.exe: 0xC0000005: Access violation reading location 0xccccccd0.
If I can provide any other information about my system, I will be glad to.
I can only make some sort of educated guess that this is not a Qt bug, because at home I am having no problem at all (but at home I am using an x86 W7, so it might not be a good example).
Does anybody know about this? I've googled quite a bit, but every error seems to have been addressed in an old hotfix.
Should I just abandon ship and try VS2008? Does it work with x64 environments? (Release is going to be for x86, btw, not x64)

You compiled the debug target but you linked it with the release variants of the Qt dlls (QtCore4.dll and QtGui4.dll instead of QtCored4.dll and QtGuid4.dll).

Related

Download symbols from Microsoft symbol server

I read MSDN "using symbol server"
I am trying to download symbols from microsoft symbol server.
My symbol search path: srv*C:\symbols*http://msdl.microsoft.com/download/symbols
In WinDbg I always get error:
************* Symbol Loading Error Summary **************
Module name Error
ntdll PDB not found :
srv*c:\symbols*http://msdl.microsoft.com/download/symbols
Unable to locate the .pdb file in this location
PDB not found : > srv*c:\symbols*https://msdl.microsoft.com/download/symbols
Unable to locate the .pdb file in this location
How can I obtain the symbols from MS symbol server?
because the location site is crashed!
http://msdl.microsoft.com/download/symbols
open that in your browser,you will see a crashed page,normally it will show a hint page if the site is good.
i try to report this but cannot find the way.-_-!!!
that brought me some trouble too.
question:is there a site cached MS symbols and opened for everyone?thanks.

PDB symbol for clr.dll not loaded

I get following message when I execute "!name2ee app.exe!Program".How can I fix that?
I am using VS2013.
.load sos
extension C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos.dll loaded
!name2ee app.exe!Program
PDB symbol for clr.dll not loaded
Make sure you have an Internet connection
Set "Microsoft Symbol Servers" in Options / Debugging / Symbols

Visual Studio error: The program '[5308] myNewOpenCV.exe' has exited with code -1073741701 (0xc000007b)

I was following this tutorial and tried to run the following code:
#include <opencv\cv.h>
#include <opencv\highgui.h>
using namespace cv;
int main() {
//Create matric to store image
Mat image;
//initialize capture
VideoCapture cap;
cap.open(0);
//create window to show image
namedWindow("window", 1);
while (1){
// copy webcam stream to image
cap >> image;
// print image to screen
imshow("window", image);
//delay 33ms
waitKey(33);
}
}
However I got the following errors:
'myNewOpenCV.exe' (Win32): Loaded 'C:\Users\Or\Copy\Documents\Visual Studio 2013\Projects\myNewOpenCV\Debug\myNewOpenCV.exe'. Symbols loaded.
'myNewOpenCV.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'myNewOpenCV.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'myNewOpenCV.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
The program '[5308] myNewOpenCV.exe' has exited with code -1073741701 (0xc000007b).
and the program does not run. I've tried to re install the opevCV libraries like suggested on some places but it didn't work.
I'm running Visual Studio 2013 Version 12.0.21005.1 REL and Windows 7 64-bit

Windbg and Symbol Files

I have a problem with symbol files. I experimented with the symbol file path and set the path as follows:
srv*c:\symbols*http://msdl.microsoft.com/download/symbols;C:\Users\myuser\Desktop\driver2\objchk_win7_x86\i386
But afterwards I changed it to the following:
srv*c:\symbols*http://msdl.microsoft.com/download/symbols;C:\Users\myuser\Desktop\mydriver\objchk_win7_x86\i386
I changed the driver2 with mydriver in the path: this is the path where the .pdb file for my driver is located. The problem is that .sympath prints the right path as shown below:
kd> .sympath
Symbol search path is: srv*c:\symbols*http://msdl.microsoft.com/download/symbols;C:\Users\myuser\Desktop\mydriver\objchk_win7_x86\i386
Expanded Symbol search path is: srv*c:\symbols*http://msdl.microsoft.com/download/symbols;c:\users\myuser\desktop\mydriver\objchk_win7_x86\i386
But the symbols for the driver are still not found. If I run .reload command, we can see that WinDbg is looking for .pdb in driver2/ directory instead of mydriver/ directory.
kd> .reload /f mydriver.sys
SYMSRV: c:\symbols\mydriver.pdb\3D655E533B0449A38D7AB0AF637CE9201\mydriver.pdb not found
SYMSRV: http://msdl.microsoft.com/download/symbols/mydriver.pdb/3D655E533B0449A38D7AB0AF637CE9201/mydriver.pdb not found
SYMSRV: c:\users\myuser\desktop\mydriver\objchk_win7_x86\i386\mydriver.pdb\3D655E533B0449A38D7AB0AF637CE9201\mydriver.pdb not found
DBGHELP: c:\users\myuser\desktop\driver2\objchk_win7_x86\i386\mydriver.pdb - file not found
*** ERROR: Module load completed but symbols could not be loaded for mydriver.sys
DBGHELP: mydriver - no symbols loaded
I've deleted all the workspaces, closed WinDbg, restarted Windows, but the driver2/ entry is still there: it must be in the default workspace's cache or somewhere. How can I delete the whole personal settings of WinDbg including those caches, so I can restart WinDbg and be gone with the driver2/ path and make it use mydriver/.
I could also solve the problem with renaming the mydriver/ directory back into driver2/, but I don't want to solve the problem like that. I want to understand what's going on and solve it the best I can.
!sym noisy
will tell you why it did not want to load the pdb. Perhaps you did rebuild your driver and the pdb guid or pdb age does no longer match.
If you are sure that you have built the same source files you can force loading of your pdb by
.reload /i /f yourdriver.sys
/i is the magic switch to load also mismatched pdbs. This switch will not load any driver from your symbol server but it will consider only local file paths to load your driver. Also symbol store directories (SRV*) are not considered since there would be many versions to choose from. But if your .sympath directly points to your pdb it will be loaded.
Is the driver originally compiled & built in the driver2 path? What is the location of mydriver.sys?
For example assume I have symbol path 'c:\users\rahulsundar\desktop' set and try to load ntdll.dll, then it displays below error,
0:000> .reload ntdll.dll
DBGHELP: c:\users\rahulsundar\desktop\ntdll.pdb - file not found
DBGHELP: c:\users\rahulsundar\desktop\dll\ntdll.pdb - file not found
DBGHELP: c:\users\rahulsundar\desktop\symbols\dll\ntdll.pdb - file not found
DBGHELP: C:\Windows\SYSTEM32\ntdll.pdb - file not found
DBGHELP: ntdll.pdb - file not found
*** ERROR: Symbol file could not be found. Defaulted to export symbols for ntdll.dll -
DBGHELP: ntdll - export symbols
Note: Windbg by default searches ntdll.pdb from the same location 'C:\Windows\SYSTEM32'
One way to solve the current issue, from the log its clear that windbg expects pdb file in directory 'c:\users\myuser\desktop\mydriver\objchk_win7_x86\i386\mydriver.pdb\3D655E533B0449A38D7AB0AF637CE9201\mydriver.pdb'.
So manually create directory till
'mydriver.pdb\3D655E533B0449A38D7AB0AF637CE9201' and place pdb file
there.
This is just a standard way( binaryfoldername\hashid\pdbfile ) that Windows expects a symbol for a binary.
Better way to solve this - turn on sim noisy and look at path
at .reload /f my_driver.sys
or add new path to .sympath[+] path/to/pdb and do the same

Why does the program assemble, but do nothing?

Here is a copy of the source:
extrn MessageBoxA: PROC
extrn ExitProcess: PROC
.data
mytit db 'The 64-bit world of Windows & assembler...', 0
mymsg db 'Hello World!', 0
.code
main proc
mov r9d, 0 ; uType = MB_OK
lea r8, mytit ; LPCSTR lpCaption
lea rdx, mymsg ; LPCSTR lpText
mov rcx, 0 ; hWnd = HWND_DESKTOP
call MessageBoxA
mov ecx, eax ; uExitCode = MessageBox(...)
call ExitProcess
main endp
End
Right now, I am just trying to get my 'first' x64 assembly program up and running so that I can start playing around and actually learn some assembly, so I just literally copied this source from here in an attempt to see if I could get anything to assemble correctly, but so far, no luck.
If I assemble this, I don't get any errors, neither during assembly-time nor run-time, but the program doesn't run as it's supposed to: it doesn't appear to do anything at all. Once the executable has been generated and I double-click on it, nothing happens, and if I go to the task manager, it doesn't seem to be running in the background either. What's going on?
I am using the default settings for MASM64 that are generated upon checking "masm" under "Build Customizations..." (found by right-clicking the project in the Solution Explorer) and changing the platform from Win32 to x64 in the Configuation Manager, the exceptions being that I've changed the "Entry Point" linker option to "main" and the "SubSystem" linker option to "Windows". (All of this is done in Visual Studio 2012.)
The debug info generated by running the program in Visual Studio is
'Hello World (ASM).exe' (Win32): Loaded 'D:\Google Drive\My Documents\Visual Studio
2012\Projects\Hello World (ASM)\x64\Release\Hello World (ASM).exe'. Symbols loaded.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\nvinitx.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\coprocmanager\detoured.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\coprocmanager\Nvd3d9wrapx.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Program Files\NVIDIA Corporation\coprocmanager\nvdxgiwrapx.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\PROGRA~1\NVIDIA~1\NVSTRE~1\rxinput.dll'. Module was built without symbols.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. Cannot find or open the PDB file.
'Hello World (ASM).exe' (Win32): Unloaded 'C:\PROGRA~1\NVIDIA~1\NVSTRE~1\rxinput.dll'
'Hello World (ASM).exe' (Win32): Unloaded 'C:\Windows\System32\combase.dll'
'Hello World (ASM).exe' (Win32): Unloaded 'C:\Windows\System32\oleaut32.dll'
'Hello World (ASM).exe' (Win32): Unloaded 'C:\Windows\System32\ole32.dll'
First-chance exception at 0x000007FA9A09B9FB (gdi32.dll) in Hello World (ASM).exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Unhandled exception at 0x000007FA9A09B9FB (gdi32.dll) in Hello World (ASM).exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
First-chance exception at 0x000007FA9A09B9FB (gdi32.dll) in Hello World (ASM).exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Unhandled exception at 0x000007FA9A09B9FB (gdi32.dll) in Hello World (ASM).exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
First-chance exception at 0x000007FA9A09B9FB (gdi32.dll) in Hello World (ASM).exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
Unhandled exception at 0x000007FA9A09B9FB (gdi32.dll) in Hello World (ASM).exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
The program '[1080] Hello World (ASM).exe' has exited with code 0 (0x0).
Before calling any of the WinAPI functions you must provide some space on the stack:
sub rsp,40
When calling other functions in x64 code on Windows you're required to provide shadow/spill/home space for that function, which is an area in which it can spill the 4 registers that are used for passing the first 4 parameters (ECX, EDX, R8, R9). Four quadwords amounts to 32 bytes (it's always 32 bytes, even if the function you call takes less than 4 arguments).
So why subtract 40 instead of 32?
There's also a requirement on stack alignment. Prior to calling a function you have to align the stack pointer to a multiple of 16 bytes (upon entering the function you'll also have RIPon the stack, making RSP % 16 == 8). So the subtraction of 8 extra bytes is because the stack pointer was 8 modulo 16 when the program started. Is that always the case? I don't know, but it seems plausible if whoever called your program's entrypoint (the OS or some runtime library) also aligned the stack before the call.
Instead of sub rsp,40 you could use:
and esp,0xFFFFFFF0 ; align
sub rsp,32 ; allocate shadow space

Resources