Skip to content

Commit 0c7497f

Browse files
committed
[GR-53747] Enable debug mode for native-image and native-image-configure.
PullRequest: graal/17638
2 parents d3d36e1 + 1cc9f38 commit 0c7497f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,20 +2023,24 @@ def native_image_on_jvm(args, **kwargs):
20232023
for key, value in javaProperties.items():
20242024
args.append("-D" + key + "=" + value)
20252025

2026-
arg = [executable]
20272026
jacoco_args = mx_gate.get_jacoco_agent_args(agent_option_prefix='-J')
20282027
if jacoco_args is not None:
20292028
arg += jacoco_args
2030-
arg += args
2031-
mx.run(arg, **kwargs)
2029+
mx.run([executable] + _debug_args() + args, **kwargs)
20322030

20332031
@mx.command(suite.name, 'native-image-configure')
20342032
def native_image_configure_on_jvm(args, **kwargs):
20352033
executable = vm_executable_path('native-image-configure')
20362034
if not exists(executable):
20372035
mx.abort("Can not find " + executable + "\nDid you forget to build? Try `mx build`")
2038-
mx.run([executable] + args, **kwargs)
2036+
mx.run([executable] + _debug_args() + args, **kwargs)
20392037

2038+
def _debug_args():
2039+
debug_args = get_jdk().debug_args
2040+
if debug_args and not mx.is_debug_disabled():
2041+
# prefix debug args with `--vm.` for bash launchers
2042+
return [f'--vm.{arg[1:]}' for arg in debug_args]
2043+
return []
20402044

20412045
@mx.command(suite.name, 'native-unittest')
20422046
def native_unittest(args):

0 commit comments

Comments
 (0)