To add to that, here's an actual hands-on example from CK3.You really do not want to use debug builds while playing the game, or using any software for that matter. Debug builds might have some "additional" feature compared to release builds ( marked in c++ code with something like #ifdef DEBUG) but usually there aren't many of those. That kind of "features" are usually there to overcome some limitation of your environment, when you want some special behavior during debug. But during debug you usually want your application to behave as closer as possible to how it would actually behave.
What debug build is mostly adding additional information so execution of certain part of the code can be recognized and displayed in debugger.
For example somewhere in code you can have something like this:
In release build, compiler can say, I do not need a, b, c, d, e variables anywhere, so I will replace all of this with auto f = 1; This is much faster and used much less memory. But in debug build that replacement is never done. In debug mode, you want to see when variable a get value of 1, then variable b etc. You want to know when any of those lines are executed.Code:
auto a = 1; auto b = a;//and after this a not used anymore in rest of the code auto c = b;//and after this b not used anymore in rest of the code auto d = c;//and after this c not used anymore in rest of the code auto e = d;//and after this d not used anymore in rest of the code auto f = e;//and after this e not used anymore in rest of the code // now do something with f // you will not have this example in real code, I am just showing it as example to explain what can be optimised
Of course this is absurd example, you will never write this kind of code. But there are much more subtle optimization, where code is reduced and speed up during building release. This is just extreme example to show the point.
So if you are using software, and you are not trying to figure out why it is not working properly, you always want to use release build, and not debug build.
And about differences between "-debug_mode" and enabeling it ingame via a gui mod, I would say that there are some additional differences. File watchers are for sure attached on load time, so you will not probably have that feature with gui mod. And maybe some logging is turned on as well. I cannot come up with more ideas what "-debug_mode" can have more then gui mod. But all of that, if any additional feature exists, must be related to that flag being present during load time. And all of these are not features related to debug build, but to debug mod in release build.
Here is the info available when I pause the execution of the game during a function that deals with handling all the data for making a frame in a Release build.
Around half the variables are just completely gone. 4 separate functions in the callstack are gone too (the ones marked "Inline Frame").
Trying to debug this is hell, so we basically only do that if there's a crash on a Release build that we have no way of reproducing on a Debug build.
In a Debug build, none of this would be gone, making my life as a programmer way easier.