Conceptual draft of dsym support for macos
This commit is contained in:
parent
0c785673d9
commit
e1ea9da507
@ -62,4 +62,21 @@ class Keg
|
|||||||
#{result.stderr}
|
#{result.stderr}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dsymutil
|
||||||
|
binary_executable_or_library_files.each { |file| dsymutil_binary(file) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def dsymutil_binary(file)
|
||||||
|
odebug "Extracting symbols #{file}"
|
||||||
|
|
||||||
|
result = system_command("dsymutil", args: [file])
|
||||||
|
return if result.success?
|
||||||
|
|
||||||
|
# If it fails again, error out
|
||||||
|
onoe <<~EOS
|
||||||
|
Failed to extract symbols from #{file}:
|
||||||
|
#{result.stderr}
|
||||||
|
EOS
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -39,6 +39,7 @@ class FormulaInstaller
|
|||||||
attr_predicate :installed_as_dependency?, :installed_on_request?
|
attr_predicate :installed_as_dependency?, :installed_on_request?
|
||||||
attr_predicate :show_summary_heading?, :show_header?
|
attr_predicate :show_summary_heading?, :show_header?
|
||||||
attr_predicate :force_bottle?, :ignore_deps?, :only_deps?, :interactive?, :git?, :force?, :overwrite?, :keep_tmp?
|
attr_predicate :force_bottle?, :ignore_deps?, :only_deps?, :interactive?, :git?, :force?, :overwrite?, :keep_tmp?
|
||||||
|
attr_predicate :debug_symbols?
|
||||||
attr_predicate :verbose?, :debug?, :quiet?
|
attr_predicate :verbose?, :debug?, :quiet?
|
||||||
|
|
||||||
def initialize(
|
def initialize(
|
||||||
@ -71,6 +72,8 @@ class FormulaInstaller
|
|||||||
@force = force
|
@force = force
|
||||||
@overwrite = overwrite
|
@overwrite = overwrite
|
||||||
@keep_tmp = keep_tmp
|
@keep_tmp = keep_tmp
|
||||||
|
# Just for this proof of concept
|
||||||
|
@debug_symbols = keep_tmp
|
||||||
@link_keg = !formula.keg_only? || link_keg
|
@link_keg = !formula.keg_only? || link_keg
|
||||||
@show_header = show_header
|
@show_header = show_header
|
||||||
@ignore_deps = ignore_deps
|
@ignore_deps = ignore_deps
|
||||||
@ -802,6 +805,8 @@ class FormulaInstaller
|
|||||||
post_install
|
post_install
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dsymutil(keg) if debug_symbols?
|
||||||
|
|
||||||
# Updates the cache for a particular formula after doing an install
|
# Updates the cache for a particular formula after doing an install
|
||||||
CacheStoreDatabase.use(:linkage) do |db|
|
CacheStoreDatabase.use(:linkage) do |db|
|
||||||
break unless db.created?
|
break unless db.created?
|
||||||
@ -1326,4 +1331,14 @@ class FormulaInstaller
|
|||||||
#{SPDX.license_expression_to_string formula.license}.
|
#{SPDX.license_expression_to_string formula.license}.
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(keg: Keg).void }
|
||||||
|
def dsymutil(keg)
|
||||||
|
keg.dsymutil
|
||||||
|
# TODO
|
||||||
|
# rescue Keg::DsymError => e
|
||||||
|
rescue RuntimeError => e
|
||||||
|
ofail "Failed to extract debugging symbols for #{formula.full_name}"
|
||||||
|
puts e
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -483,6 +483,8 @@ class Keg
|
|||||||
ObserverPathnameExtension.n
|
ObserverPathnameExtension.n
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dsymutil; end
|
||||||
|
|
||||||
def remove_oldname_opt_record
|
def remove_oldname_opt_record
|
||||||
return unless oldname_opt_record
|
return unless oldname_opt_record
|
||||||
return if oldname_opt_record.resolved_path != path
|
return if oldname_opt_record.resolved_path != path
|
||||||
@ -531,6 +533,8 @@ class Keg
|
|||||||
|
|
||||||
def codesign_patched_binary(file); end
|
def codesign_patched_binary(file); end
|
||||||
|
|
||||||
|
def dsymutil_binary(file); end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def resolve_any_conflicts(dst, dry_run: false, verbose: false, overwrite: false)
|
def resolve_any_conflicts(dst, dry_run: false, verbose: false, overwrite: false)
|
||||||
|
@ -292,6 +292,7 @@ class Cmd
|
|||||||
args.concat(optflags) unless runtime_cpu_detection?
|
args.concat(optflags) unless runtime_cpu_detection?
|
||||||
args.concat(archflags)
|
args.concat(archflags)
|
||||||
args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0)
|
args << "-std=#{@arg0}" if /c[89]9/.match?(@arg0)
|
||||||
|
args << "-g" if debug_symbols?
|
||||||
args
|
args
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -399,6 +400,11 @@ class Cmd
|
|||||||
config.include?("w")
|
config.include?("w")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def debug_symbols?
|
||||||
|
mac?
|
||||||
|
# && config.include?("D")
|
||||||
|
end
|
||||||
|
|
||||||
def canonical_path(path)
|
def canonical_path(path)
|
||||||
path = Pathname.new(path)
|
path = Pathname.new(path)
|
||||||
path = path.realpath if path.exist?
|
path = path.realpath if path.exist?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user