RFR: 8242181: [Linux] Show source information when printing native stack traces in hs_err files [v8]

Christian Hagedorn chagedorn at openjdk.java.net
Fri May 13 08:53:06 UTC 2022


On Fri, 8 Apr 2022 13:34:03 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> make/autoconf/flags-cflags.m4 line 116:
>> 
>>> 114:     fi
>>> 115: 
>>> 116:     CFLAGS_DEBUG_SYMBOLS="-g -gdwarf-4"
>> 
>> We may need to guard this with a FLAGS_COMPILER_CHECK_ARGUMENTS. Perhaps it should also be applied only on Linux since the whole feature is Linux only. What do you think @magicus?
>
> I'm googling around for some information about -gdwarf-4 but is mostly coming up empty handed. :( I found [this](https://www.phoronix.com/scan.php?page=news_item&px=GCC-11-DWARF-5-Possible-Default) saying that dwarf-5 became default in gcc11. It also claims dwarf-4 is about 10 years old. My guess is that all our supported gcc versions do support -gdwarf-4, but this needs to be verified.
> 
> In practice, we only use gcc on linux so I'm not convinced we need to have an addition check for that. If we ever are going to support gcc on other OSes I think we'll have many more, much harder problems, than to remove the -gdwarf-4 flag.

I'm back to work again. I also had a look but could not find something on Google, either. I then skimmed through the old GCC manuals. I found the first occurrence of `-gdwarf-4` in the manual for GCC 4.5.4 [here](https://gcc.gnu.org/onlinedocs/gcc-4.5.4/gcc.pdf):


- gdwarf-version
    Produce debugging information in DWARF format (if that is supported). This
    is the format used by DBX on IRIX 6. The value of version may be either 2, 3
    or 4; the default version is 2.

While the manual for GCC 4.4.7 only mentions `-gdwarf-2`:

-gdwarf-2
    Produce debugging information in DWARF version 2 format (if that is supported). This is the format used by DBX on 
    IRIX 6. With this option, GCC
    uses features of DWARF version 3 when they are useful; version 3 is upward
    compatible with version 2, but may still cause problems for older debuggers.


The minimum accepted GCC version is currently 5.0 according to:
https://github.com/openjdk/jdk/blob/d5ae3833b1b71eb84fadb69c0c92851400f8921c/doc/building.md?plain=1#L341-L344

This suggests that all our supported GCC versions should accept `-gdwarf-4`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7126



More information about the build-dev mailing list