Author Topic: GCC and CLang options*.xml enhancement/change  (Read 5629 times)

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
GCC and CLang options*.xml enhancement/change
« on: July 23, 2022, 11:05:51 am »
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
Code
    <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
Code
    <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.


Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: GCC and CLang options*.xml enhancement/change
« Reply #1 on: July 24, 2022, 08:53:03 pm »
With this we introduce the category debbuging?

The target file is src\plugins\compilergcc\resources\compilers\options_gcc.xml is this right?

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: GCC and CLang options*.xml enhancement/change
« Reply #2 on: July 25, 2022, 12:05:12 am »
The category was there before, but it was an attribute of the option as per the following in the options_gcc.xml:
Code
    <Option name="Produce debugging symbols"
            option="-g"
            category="Debugging"
            checkAgainst="-O -O1 -O2 -O3 -Os"
            checkMessage="You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."
            supersedes="-s"/>
In the options_clang.xml the category section was defined as key and the options were sub keys.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: GCC and CLang options*.xml enhancement/change
« Reply #3 on: July 27, 2022, 10:54:55 pm »
Thank you for the description and work. Is in SVN now.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: GCC and CLang options*.xml enhancement/change
« Reply #4 on: July 28, 2022, 12:17:38 am »
Thanks for making the SF changes.