Merge pull request #5977 from dearblue/setup_debug

Make `MRuby::Build#enable_debug` compiler flag setting abstract
This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-04-09 15:51:44 +09:00
committed by GitHub
3 changed files with 11 additions and 3 deletions
+1 -3
View File
@@ -167,9 +167,7 @@ module MRuby
def enable_debug
compilers.each do |c|
c.defines += %w(MRB_DEBUG)
if toolchains.any? { |toolchain| toolchain == "gcc" }
c.flags += %w(-g3 -O0)
end
c.setup_debug(self)
end
@mrbc.compile_options += ' -g'
+6
View File
@@ -172,6 +172,12 @@ module MRuby
def object_ext?(path)
File.extname(path) == build.exts.object
end
# This method can be redefined as a singleton method where appropriate.
# Manipulate `flags`, `include_paths` and/or more if necessary.
def setup_debug(conf)
nil
end
end
class Command::Linker < Command
+4
View File
@@ -20,6 +20,10 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
compiler.cxx_compile_flag = '-x c++ -std=gnu++03'
compiler.cxx_exception_flag = '-fexceptions'
compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags
def compiler.setup_debug(conf)
self.flags << %w(-g3 -O0)
end
end
conf.linker do |linker|