Add support for llvm-objdump to applocal.ps1 (#11898)

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
Christian Fersch 2020-11-10 01:47:21 +01:00 committed by GitHub
parent 254bd8fe89
commit 19fe942c13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,7 +86,13 @@ function resolve([string]$targetBinary) {
}
$targetBinaryDir = Split-Path $targetBinaryPath -parent
$a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
if (Get-Command "dumpbin" -ErrorAction SilentlyContinue) {
$a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
} elseif (Get-Command "llvm-objdump" -ErrorAction SilentlyContinue) {
$a = $(llvm-objdump -p $targetBinary| ? { $_ -match "^ {4}DLL Name: .*\.dll" } | % { $_ -replace "^ {4}DLL Name: ","" })
} else {
Write-Error "Neither dumpbin nor llvm-objdump could be found. Can not take care of dll dependencies."
}
$a | % {
if ([string]::IsNullOrEmpty($_)) {
return