|
Are you sure variables are not initialized for a debug build when run with ctrl-F5? ctrl-F5 only implies that the code will be run without attaching the VisualStudio debugger. It does not mean the code will be run in release mode - there may not even be a release mode executable to run.
I do know that you can run a release build with F5, and when you inspect an uninitialized variable, it will most likely not show a null value, just as you described - but that does not depend on whether or not you attach a debugger.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
You are getting build configuration mode as in "debug" and "release" mode come in that isn't relevant.
The act of connecting a debugger does it's thing which is connect to the memory space, function and variables it doesn't give a rats about build mode.
From a memory point the key thing it does is drop it's own heap manager which has been forever but started to be improved in VS2014 and now it connects to that whole memory display gadget that seems to get slower and slower each release.
C++ Debugging Improvements in Visual Studio "14" | C++ Team Blog[^]
That means whenever you run the debugger the heap is different to normal unless you go thru the hijinx to turn it off which used to be as simple as _NO_DEBUG_HEAP = 1 but like everything it has gotten successively harder.
In vino veritas
|
|
|
|
|
I'm working on a C++ native code graphics application using DirectX9. I use the latest version of Visual Studio Community 2019. When working in the IDE the application crashes from time to time with a message like
"Exception thrown at 0x00007FF9762975D6 (nvd3dumx.dll) in NNetSimu.exe: 0xC0000005: Access violation reading location 0x000001B388FE1A3E."
So far I could not reproduce the error, it happens once in while. The strange thing is: If I call the application directly, it runs very stable, the problem occurs only in the IDE.
The crash happens always during the end of a frame, typically during swapChain->Present. My code:
void D3D_driver::EndFrame( HWND const hwnd )
{
HRESULT hres;
hres = m_d3d_device->EndScene(); assert(hres == D3D_OK);
hres = m_d3d_swapChain->Present( nullptr, nullptr, hwnd, nullptr, 0 ); assert(hres == D3D_OK);
m_id3dx_font->Release();
}
I could live with the situation, the app runs smoothly without IDE, but it is annoying during development.
Any ideas how I could further investigate the problem?
modified 13-Dec-19 19:32pm.
|
|
|
|
|
Since the problem appears to be within Microsoft's library it would be best to report it to them.
|
|
|
|
|
Hi
Can bullet used as numbering in paraformat/ CricheditCtrl::SetPartaFormat be colored
I am trying to create an image such as the breakpoint bullet in Visual Studio debugger
thanks
|
|
|
|
|
Does the SetParaFormat method contain an option to set the colour, or does it use the default of the current font?
|
|
|
|
|
Thanks wasn't sure if bullets could be colored I'll use the the SetSelectionCharFormat member crTextColor of charformat to color the text
thanks
|
|
|
|
|
Ripping my hair out with this one. I develop for some Windows Embedded Compact 7 products where we use VS2008 with add-on SDKs. All service packs applied, I've been using the same setup for the A week or so ago, I did a code merge between two branches and broke on of my applications. In trying to debug the issue, I discovered that no matter where I placed breakpoints, they would immediately go clear with a warning. Mousing over shows the message in the title bar. In doing my debug of the debugger work, I have:
- full clean rebuild;
- delete all PDB, suo and ncb files;
- create a new application;
Nothing corrects the issue. In fact, the last item is a simple dummy hello world dialog app, and it has the same breakpoint issue. So something bad has happened to the installation I'm guessing. In reading all the SO discussions, it appears that most people solve this by making random changes until it starts working.
Does anyone have a definitive explanation or solution for this behavior?
Thanks
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Seems I fixed this by doing a repair installation on VS2008. Should have thought of that last week.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
The bigger question is why you are still using VS2008 given all the upgrades above you are free
WIN CE was supported until at least VS2015 from memory.
Update: Ignore that you are trying to debug you have to be on VS2008 my bad
In vino veritas
modified 8-Dec-19 19:27pm.
|
|
|
|
|
In principle, you can choose a toolset from an earlier VS installation in any version of VS. If VS 2008 and a newer version are installed, you should be able to select the VS 2008 toolset in the newer VS for the purpose of debugging, or even building executables. Maybe intellisense won't like it, but you can disable intellisense if it gets too annoying.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Pretty sure you have to have a stub running in Win CE target to debug and if I remember correctly it is tied to the VS version. You can definitely compile without issue but I recall issues with debugging.
In vino veritas
|
|
|
|
|
Good point. I've never tried this with different target platform applications.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Good question, but it's the nature of embedded systems. My customers are still using systems they purchased in 2006. We're still supporting CE 5.0 and WEC7. Microsoft sort of lost their way after WEC7, and the tools stopped supporting the embedded arena. Microsoft was ripped a new bloody one with this decision, and eventually added support back into the Visual Studio, but the support does not extend back to 5.0 and 7.0. My team dug into this pretty deeply a few years back when we had to deal with this. Do you have knowledge of this changing?
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Well, I spoke to soon . The re-installation did not fix this completely. My breakpoints are back, but any attempts at compiling is a disaster.
There was an issue from long ago (I even have notes back from 2017 on this) about issues with the default include order. My notes cover about 95% of what needs to be done to correct it, but I think I missed one important key. Sigh.
I'm backing up to a scrubbed system and re-installing everything. VMs are nice.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
I'm going to close this out for posterity's sake.
Part of the problem with having to use VS2008 is that people who make extensions don't test against very old versions, and let's face it, 2008 is a gnarly old thing (but it's better than EVC++). Anyway, a long about December of last year I was trying to track down an issue with stack allocation. One tool I tried to use is Intel's VTune. Once installed, my woes began. I scrubbed everything to recover. Not only did it hose the breakpoints, but things would not compile, etc. I'm a busy guy, and I hate not being able to go back and do a true cause analysis.
New post coming up
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
I could use some very basic assistance solving this problem.
The struct is located inside class function and I am not sure if that is OK.
I am trying to port C code to C++.
Here is the error
I get same error for both test calls to malloc
../src/MODULES/M_BLUEZ/CBLUEZ.cpp:505:14: error: invalid conversion from ‘void*’ to ‘hci_dev_list_req*’ [-fpermissive]
dl = malloc(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl));
Here is the offending code snippet
<pre> struct hci_dev_list_req *dl;
struct hci_dev_req *dr;
int dev_id = -1;
int i, sk, err = 0;
dl = malloc(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl));
if (!dl) {
err = errno;
goto done;
}
dl = malloc(HCI_MAX_DEV * sizeof(struct hci_dev_req) + sizeof(uint16_t));
Thanks
Cheers
|
|
|
|
|
Since malloc can only return a void* , it must be cast to the receiving type:
dl = reinterpret_cast<hci_dev_list_req>(malloc(HCI_MAX_DEV * sizeof(*dr) + sizeof(*dl)));
|
|
|
|
|
Thanks,
just figured that out.
Appreciate your reply anyway.
Is it more appropriate to do
reinterpret_cast<hci_dev_list_req> or just
(hci_dev_list_req*) ?
|
|
|
|
|
Since you are "porting C code to C++", why don't you replace malloc/free with the new/delete?
Just use C++ allocation operators/methods and you won't need every time cast the returned pointer to the correct type.
|
|
|
|
|
I was going to suggest the use of new, but since he is allocating a single area for two separate structures it would be more complicated.
|
|
|
|
|
I don't think it's two structs, it looks like it's N structs plus a 16 bit number, which maybe could contain the size. If so, it should be converted to a std::vector.
On a side note, sizeof(uint16_t) deserves a place in the coding horror forum
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
You are correct. However, given many of OP's previous questions I think it is a bit too soon to introduce him to the new operator.
|
|
|
|
|
In C++ it is more appropriate to use reinterpret_cast .
|
|
|
|
|
Please consider rewriting it in proper C++ .
I don't blame the usage of goto in C code, but C++ provides better alternatives.
|
|
|
|