graalvm / mandrel-packaging

6 stars 8 forks source link

Enable debug info generation for Mandrel 22.3 builds #326

Closed zakkak closed 1 year ago

zakkak commented 1 year ago

The next feature release of GraalVM CE will include debug info by default.

This PR enables the generation of debug info by default for Mandrel 22.3 builds as well.

Note that the debug info is embedded in the generated native libraries and it will be shipped with Mandrel.

jerboaa commented 1 year ago

This PR enables the generation of debug info by default for Mandrel 22.3 builds as well.

It's not clear to me how this patch achieves it. Could you explain? All I see is that there is going to be the wrapper patch applied, but that doesn't enable debuginfo -g on its own does it? What am I missing?

zakkak commented 1 year ago

https://github.com/graalvm/mandrel-packaging/pull/326/files#diff-2e7b2c099fb548baf6f3f44f5a984665c0e9a52ea034a98a517669145a88709eR9-R10 removes the check for GraalVM EE (svmee), which apparently is the only thing blocking our builds from having debug info enabled by default.

The said check is used in https://github.com/graalvm/mandrel/blob/0b907338a1fce8cf6f3a0a450cde70ca25f10c4d/sdk/mx.sdk/mx_sdk_vm_impl.py#L1123-L1124

which is used in https://github.com/graalvm/mandrel/blob/0b907338a1fce8cf6f3a0a450cde70ca25f10c4d/sdk/mx.sdk/mx_sdk_vm_impl.py#L1257-L1258

which adds the -g parameter.

HTH

jerboaa commented 1 year ago

https://github.com/graalvm/mandrel-packaging/pull/326/files#diff-2e7b2c099fb548baf6f3f44f5a984665c0e9a52ea034a98a517669145a88709eR9-R10 removes the check for GraalVM EE (svmee), which apparently is the only thing blocking our builds from having debug info enabled by default.

The said check is used in https://github.com/graalvm/mandrel/blob/0b907338a1fce8cf6f3a0a450cde70ca25f10c4d/sdk/mx.sdk/mx_sdk_vm_impl.py#L1123-L1124

which is used in https://github.com/graalvm/mandrel/blob/0b907338a1fce8cf6f3a0a450cde70ca25f10c4d/sdk/mx.sdk/mx_sdk_vm_impl.py#L1257-L1258

which adds the -g parameter.

HTH

Yes, that's helpful. However, lumping this into a truffle-api-removal.patch seems for a bug bound to happen. Could we move it into a separate patch? I'm worried once a truffle-api removal patch is no longer needed, this gets dropped on the floor too. Failing that, please add a comment why this works.

zakkak commented 1 year ago

Could we move it into a separate patch?

Sure, but we could also just rename that file to make clear it't not truffle-specific.

I'm worried once a truffle-api removal patch is no longer needed, this gets dropped on the floor too.

I don't expect this to ever happen. This patch is solely for 22.3, starting with 23.0 we don't need it (see https://github.com/oracle/graal/pull/5943).

zakkak commented 1 year ago

The windows build failure is interesting, and the failure happens when building the native agent (which is now being built with debug symbols enabled) so it might be relevant...

2023-03-03T16:32:32.9859247Z # A fatal error has been detected by the Java Runtime Environment:
2023-03-03T16:32:32.9863105Z #
2023-03-03T16:32:32.9865676Z #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000001ee44e53c33, pid=6784, tid=1180
2023-03-03T16:32:32.9882129Z #
2023-03-03T16:32:32.9885240Z # JRE version: OpenJDK Runtime Environment Temurin-11.0.19+4-202303021811 (11.0.19+4) (build 11.0.19-beta+4-202303021811)
2023-03-03T16:32:32.9886466Z # Java VM: OpenJDK 64-Bit Server VM Temurin-11.0.19+4-202303021811 (11.0.19-beta+4-202303021811, mixed mode, tiered, jvmci, compressed oops, parallel gc, windows-amd64)
2023-03-03T16:32:32.9887037Z # Problematic frame:
2023-03-03T16:32:32.9887851Z # J 20129 c2 com.oracle.svm.core.graal.snippets.NonSnippetLowerings$InvokeLowering.lower(Lorg/graalvm/compiler/nodes/FixedNode;Lorg/graalvm/compiler/nodes/spi/LoweringTool;)V org.graalvm.nativeimage.builder (1177 bytes) @ 0x000001ee44e53c33 [0x000001ee44e52460+0x00000000000017d3]
2023-03-03T16:32:32.9888851Z #
2023-03-03T16:32:32.9890004Z # Core dump will be written. Default location: D:\a\mandrel-packaging\mandrel-packaging\hs_err_pid6784.mdmp
2023-03-03T16:32:32.9890502Z #
2023-03-03T16:32:32.9890903Z # An error report file with more information is saved as:
2023-03-03T16:32:32.9891451Z # D:\a\mandrel-packaging\mandrel-packaging\hs_err_pid6784.log
2023-03-03T16:32:33.0177014Z [thread 3352 also had an error]
2023-03-03T16:32:33.0178167Z [thread 1216 also had an error]
2023-03-03T16:32:33.0179073Z Compiled method (c2)  104252 20129       4       com.oracle.svm.core.graal.snippets.NonSnippetLowerings$InvokeLowering::lower (1177 bytes)
2023-03-03T16:32:33.0179687Z  total in heap  [0x000001ee44e51d10,0x000001ee44e5db68] = 48728
2023-03-03T16:32:33.0180120Z  relocation     [0x000001ee44e51e88,0x000001ee44e52460] = 1496
2023-03-03T16:32:33.0180540Z  main code      [0x000001ee44e52460,0x000001ee44e58460] = 24576
2023-03-03T16:32:33.0180933Z  stub code      [0x000001ee44e58460,0x000001ee44e586b0] = 592
2023-03-03T16:32:33.0181341Z  oops           [0x000001ee44e586b0,0x000001ee44e58798] = 232
2023-03-03T16:32:33.0181747Z  metadata       [0x000001ee44e58798,0x000001ee44e58b58] = 960
2023-03-03T16:32:33.0182163Z  scopes data    [0x000001ee44e58b58,0x000001ee44e5c1d8] = 13952
2023-03-03T16:32:33.0182588Z  scopes pcs     [0x000001ee44e5c1d8,0x000001ee44e5d198] = 4032
2023-03-03T16:32:33.0183091Z  dependencies   [0x000001ee44e5d198,0x000001ee44e5d200] = 104
2023-03-03T16:32:33.0183516Z  handler table  [0x000001ee44e5d200,0x000001ee44e5d9c8] = 1992
2023-03-03T16:32:33.0183921Z  nul chk table  [0x000001ee44e5d9c8,0x000001ee44e5db68] = 416
2023-03-03T16:32:33.0266427Z Could not load hsdis-amd64.dll; library not loadable; PrintAssembly is disabled

Before futher debugging it I will change the CI to use JDK 17 since we don't support Mandrel 22.3 with JDK 11 either way...

zakkak commented 1 year ago

Error: could not find target field: static java.lang.Object com.oracle.svm.core.jfr.Target_jdk_jfr_internal_JVM.FILE_DELTA_CHANGE

This is unrelated and a known issue that will be fixed by https://github.com/oracle/graal/pull/6129

java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 61.0

Is again unrelated but triggered by the CI change to use JDK 17 instead of 11. working on it.

jerboaa commented 1 year ago

java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 61.0

Is again unrelated but triggered by the CI change to use JDK 17 instead of 11. working on it.

@zakkak I take it #327 is the fix for this?

zakkak commented 1 year ago

327 is the fix for master, I have included a similar commit in this PR (which targets branch 22.3).