Home » U++ Library support » U++ Core » AssertST problem in initialization when debugging on MSBT17x64
AssertST problem in initialization when debugging on MSBT17x64 [message #50627] |
Tue, 27 November 2018 14:59 |
Tom1
Messages: 1242 Registered: March 2007
|
Senior Contributor |
|
|
Hi,
As the title states, something goes wrong here when starting a debugging session of a GUI (MT) application:
#ifdef _DEBUG
inline void AssertST() { ASSERT(Thread::IsST()); }
#endif
The ASSERTion happens. If I comment out the ASSERT() code, the debugging session starts just fine. I'm running on Windows 10 Professional 64-bit and using MSBT17x64 compiler with up-to-date U++. Also, Release code works OK, which is obvious since the above code is not active there. Is there something wrong with my setup or is there some issue in Core?
Best regards,
Tom
|
|
|
Re: AssertST problem in initialization when debugging on MSBT17x64 [message #50628 is a reply to message #50627] |
Tue, 27 November 2018 18:44 |
mr_ped
Messages: 825 Registered: November 2005 Location: Czech Republic - Praha
|
Experienced Contributor |
|
|
From the name of it I guess it's asserting that you are in single-thread mode, but you are not ("GUI (MT)").
So it depends, where this assert is, if you did it write yourself, then why? If it's part of UPP sources, then that part is either not meant to be used in MT, or the flag "MT" was not delegated properly during compilation and the ST variant of code got picked up, or there's a bug.
Unfortunately you didn't indicate where that AssertST is used, so hard to say where it is and why.
(edit: if it is directly in the IDE code (not in app code) in the start-debug-session, then the author of that code has to explain, if it's really supposed to be used only for ST debugging, or this is some obsolete artefact and can be removed now.)
[Updated on: Tue, 27 November 2018 18:46] Report message to a moderator
|
|
|
Re: AssertST problem in initialization when debugging on MSBT17x64 [message #50631 is a reply to message #50628] |
Wed, 28 November 2018 09:23 |
Tom1
Messages: 1242 Registered: March 2007
|
Senior Contributor |
|
|
Hi Peter,
Sorry for being so unspecific.
First, it is my own program where this happens when running in debugger. Here's the backtrace:
DebugBreak()
Upp::AssertFailed(file=7ff6022e6700 "c:\\upp-12514\\upp.src\\uppsrc\\core\\Mt.h", line=116 't', cond=7ff6022e66e8 "Thread::IsST()") at c:\upp-12514\upp.src\uppsrc\core\util.cpp 167
Upp::AssertST() at c:\upp-12514\upp.src\uppsrc\core\mt.h 116
Upp::Value::Register(w=40 '(', c=7ff600fa7ea5, name=7ff6022d46ac "Font") at c:\upp-12514\upp.src\uppsrc\core\value.cpp 560
Upp::Value::Register<Upp::Font>(name=7ff6022d46ac "Font") at c:\upp-12514\upp.src\uppsrc\core\value.hpp 318
Upp::s__sF0_19_fn() at c:\upp-12514\upp.src\uppsrc\draw\font.cpp 21
Upp::Callinit::Callinit(fn=7ff6013188f0, cpp=7ff6022d4618 "C:\\upp-12514\\upp.src\\uppsrc\\Draw\\Font.cpp", line=19) at c:\upp-12514\upp.src\uppsrc\core\defs.h 176
Upp::`dynamic initializer for 's__sF0_19''() at c:\upp-12514\upp.src\uppsrc\draw\font.cpp 19
_initterm(first=7ff60225d000->0, last=7ff60225e180->0)
__scrt_common_main_seh()
__scrt_common_main()
WinMainCRTStartup()
BaseThreadInitThunk()
RtlUserThreadStart()
After digging a bit deeper, I found out that my own code contains a static instance of a class that starts a couple of threads in the background. These threads are already running when the above assertion happens and if I do not start those threads, the assertion does not happen. However, I do need those threads for my software to work properly.
I worked around this issue by switching from "static MyClass a;" to "One<MyClass> a;" and appropriate initialization code "a.Create();" that runs only in GUI_APP_MAIN after everything else is initialized within U++.
Thanks and best regards,
Tom
|
|
|
|
|
Re: AssertST problem in initialization when debugging on MSBT17x64 [message #50640 is a reply to message #50639] |
Wed, 28 November 2018 14:58 |
|
peterh
Messages: 108 Registered: November 2018 Location: Germany
|
Experienced Member |
|
|
The documentation is (not always, but often) in the source:
If you click the small green square left from AsserST(), you see this:
void AssertST()
This operation only has effect in DEBUG mode. If any Thread was started prior to calling AssertST, it will stop the execution with diagnostic message. The purpose is that some global initialization routines are best performed before any multi-threading starts. AssertST can be used to assure this as runtime check.
[Updated on: Wed, 28 November 2018 15:04] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 05:48:58 CEST 2024
Total time taken to generate the page: 0.03242 seconds
|