Skip to content

Commit a452120

Browse files
committed
[GR-11010] Store paths relative to the home for core C extensions
* So they can be debugged with GraalVM and --inspect.SourcePath=trufflerubyCheckout
1 parent 2bdced7 commit a452120

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/cext/preprocess.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def self.patch(file, contents, directory)
7272
file_name = patched_file_name
7373
end
7474

75-
$stdout.puts "#line 1 \"#{file_name}\""
75+
expanded_path = File.expand_path(file_name)
76+
$stdout.puts "#line 1 \"#{expanded_path}\""
7677
$stdout.puts output
7778
end
7879
end

lib/truffle/rbconfig-for-mkmf.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,20 @@
8585

8686
cext_dir = "#{RbConfig::CONFIG['libdir']}/cext"
8787

88+
expanded = RbConfig::CONFIG
89+
mkconfig = RbConfig::MAKEFILE_CONFIG
90+
8891
if Truffle::Boot.get_option 'building.core.cexts'
8992
ruby_home = Truffle::Boot.ruby_home
9093
link_o_files = "#{ruby_home}/src/main/c/cext/ruby.o #{ruby_home}/src/main/c/sulongmock/sulongmock.o"
91-
RbConfig::MAKEFILE_CONFIG['CPPFLAGS'] = "-DSULONG_POLYGLOT_H='\"#{ENV.fetch('SULONG_POLYGLOT_H')}\"'"
94+
relative_debug_paths = "-fdebug-prefix-map=#{ruby_home}=."
95+
polyglot_h = "-DSULONG_POLYGLOT_H='\"#{ENV.fetch('SULONG_POLYGLOT_H')}\"'"
96+
mkconfig['CPPFLAGS'] = "#{relative_debug_paths} #{polyglot_h}"
97+
expanded['CPPFLAGS'] = mkconfig['CPPFLAGS']
9298
else
9399
link_o_files = "#{cext_dir}/ruby.o #{cext_dir}/sulongmock.o"
94100
end
95101

96-
expanded = RbConfig::CONFIG
97-
mkconfig = RbConfig::MAKEFILE_CONFIG
98-
99102
common = {
100103
'CC' => cc,
101104
'CPP' => cc,

0 commit comments

Comments
 (0)