Skip to content

Commit e5adf6e

Browse files
committed
[GR-60022] Map files in shared objects to relative paths for debugging on other systems.
1 parent 2ec2361 commit e5adf6e

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

graalpython/com.oracle.graal.python.cext/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# All rights reserved.
55
#
@@ -43,7 +43,8 @@ endif()
4343

4444
if(WIN32)
4545
require_var(GRAALVM_LLVM_LIB_DIR)
46-
endif()
46+
endif()
47+
require_var(GRAALPY_PARENT_DIR)
4748
require_var(CAPI_INC_DIR)
4849
require_var(PYCONFIG_INCLUDE_DIR)
4950
require_var(TRUFFLE_H_INC)
@@ -69,6 +70,8 @@ set(CFLAGS_WARNINGS -Wall -Werror,-Wunknown-warning-option -Wno-unused-function
6970
-Wno-incompatible-pointer-types-discards-qualifiers -Wno-pointer-type-mismatch
7071
-Wno-braced-scalar-init -Wno-deprecated-declarations)
7172

73+
add_compile_options(-ffile-prefix-map=${GRAALPY_PARENT_DIR}=.)
74+
7275
# preprocessor defines for all platforms
7376
add_compile_definitions(
7477
NDEBUG

graalpython/com.oracle.graal.python.hpy.llvm/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# All rights reserved.
55
#
@@ -45,6 +45,7 @@ set(TARGET_LIB "hpy-native")
4545
# don't install into the system but into the MX project's output dir
4646
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
4747

48+
require_var(GRAALPY_PARENT_DIR)
4849
require_var(GRAALVM_HPY_INCLUDE_DIR)
4950
require_var(GRAALVM_PYTHON_INCLUDE_DIR)
5051
require_var(PYCONFIG_INCLUDE_DIR)
@@ -96,6 +97,8 @@ target_include_directories(${TARGET_LIB} PRIVATE
9697
"${TRUFFLE_H_INC}"
9798
)
9899

100+
add_compile_options(-ffile-prefix-map=${GRAALPY_PARENT_DIR}=.)
101+
99102
target_compile_definitions(${TARGET_LIB} PRIVATE
100103
HPY_ABI_HYBRID
101104
NDEBUG

mx.graalpython/mx_graalpython.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,10 @@ def _get_suite_dir(suitename):
16681668
return mx.suite(suitename).dir
16691669

16701670

1671+
def _get_suite_parent_dir(suitename):
1672+
return os.path.dirname(mx.suite(suitename).dir)
1673+
1674+
16711675
def _get_src_dir(projectname):
16721676
for suite in mx.suites():
16731677
for p in suite.projects:
@@ -1784,6 +1788,7 @@ def dev_tag(arg=None, **kwargs):
17841788

17851789

17861790
mx_subst.path_substitutions.register_with_arg('suite', _get_suite_dir)
1791+
mx_subst.path_substitutions.register_with_arg('suite_parent', _get_suite_parent_dir)
17871792
mx_subst.path_substitutions.register_with_arg('src_dir', _get_src_dir)
17881793
mx_subst.path_substitutions.register_with_arg('output_root', _get_output_root)
17891794
mx_subst.path_substitutions.register_with_arg('py_ver', py_version_short)

mx.graalpython/suite.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@
707707
"TRUFFLE_H_INC": "<path:SULONG_LEGACY>/include",
708708
"TRUFFLE_NFI_H_INC": "<path:com.oracle.truffle.nfi.native>/include",
709709
"CMAKE_C_COMPILER": "<toolchainGetToolPath:native,CC>",
710+
"GRAALPY_PARENT_DIR": "<suite_parent:graalpython>",
710711
"GRAALPY_EXT": "<graalpy_ext:native>",
711712
},
712713
"results": [
@@ -727,6 +728,7 @@
727728
"TRUFFLE_H_INC": "<path:SULONG_LEGACY>/include",
728729
"TRUFFLE_NFI_H_INC": "<path:com.oracle.truffle.nfi.native>/include",
729730
"CMAKE_C_COMPILER": "<toolchainGetToolPath:native,CC>",
731+
"GRAALPY_PARENT_DIR": "<suite_parent:graalpython>",
730732
"GRAALPY_EXT": "<graalpy_ext:native>",
731733
},
732734
"results": [
@@ -783,6 +785,7 @@
783785
"GRAALVM_PYTHON_INCLUDE_DIR": "<path:com.oracle.graal.python.cext>/include",
784786
"TRUFFLE_H_INC": "<path:SULONG_LEGACY>/include",
785787
"CMAKE_C_COMPILER": "<toolchainGetToolPath:native,CC>",
788+
"GRAALPY_PARENT_DIR": "<suite_parent:graalpython>",
786789
},
787790
},
788791
},
@@ -794,6 +797,7 @@
794797
"GRAALVM_PYTHON_INCLUDE_DIR": "<path:com.oracle.graal.python.cext>/include",
795798
"TRUFFLE_H_INC": "<path:SULONG_LEGACY>/include",
796799
"CMAKE_C_COMPILER": "<toolchainGetToolPath:native,CC>",
800+
"GRAALPY_PARENT_DIR": "<suite_parent:graalpython>",
797801
},
798802
},
799803
},

0 commit comments

Comments
 (0)