The existing GCC and CLANG options xml files do not include debugging optimizations for either GDB or LLDB and as such what do people think about changing the files to have debugging options below. This should hopefully make it easier to swap between GDB and DWARF debugging :
options_gcc.xml <Category name="Debugging">
<Option name="Produce debugging symbols"
option="-g"
checkAgainst="-O -O1 -O2 -O3 -Os"
checkMessage="You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."
supersedes="-s"/>
<Option name="Optimize debugging executable (compile speed, execution speed and better debugging)"
option="-Og"
supersedes="-O -O1 -O2 -O3"/>
<Option name="Tune Debugging for GDB"
option="-ggdb"
checkAgainst="-O1 -O2 -Os -O3 -O4 -gdwarf -gdwarf-4"
checkMessage="You have other optimizations or debugging settings that are not good for GDB."
supersedes="-s -gline-tables-only"/>
<Option name="Tune Debugging for DWARF for GDB"
option="-gdwarf"
checkAgainst="-Os -O1 -O2 -O3 -O4 -ggdb -gdwarf-4"
checkMessage="You have other optimizations or debugging settings that are not good for GDB."
supersedes="-s -gline-tables-only"/>
<Option name="Tune Debugging for DWARF for LLDB"
option="-gdwarf-4"
checkAgainst="-Os -O1 -O2 -O3 -O4 -ggdb -gdwarf"
checkMessage="You have other optimizations or debugging settings that are not good for LLDB."
supersedes="-s -gline-tables-only"/>
</Category>
options_clang.xml <Category name="Debugging">
<Option name="Produce minimal debugging symbols"
option="-gline-tables-only"
checkAgainst="-O1 -O2 -Os -O3 -O4"
checkMessage="You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."
supersedes="-s -g"/>
<Option name="Tune Debugging for GDB"
option="-ggdb"
checkAgainst="-O1 -O2 -Os -O3 -O4"
checkMessage="You have other optimizations or debugging settings that are not good for GDB."
supersedes="-s -gline-tables-only"/>
<Option name="Tune Debugging for DWARF-2 (LLDB)"
option="-gdwarf-2"
checkAgainst="-O1 -O2 -Os -O3 -O4"
checkMessage="You have other optimizations or debugging settings that are not good for LLDB."
supersedes="-s -gline-tables-only"/>
</Category>
Currently with MSYS2 the Mingw64 gcc produces debugging info that LLDb does not understand if you use -gdwarf as it uses dwarf-5 and the LLDB currently does not understand it, but it does understand dwarf4.
The MSYS2 mingw GDB understands dwarf and as such it does not need to fall back to dwarf-4.
The supersedes is copied and pasted, so may not be 100% right. If it is not please speak up.