From 0f9acf807e4fc23aa088d2bd3aec218a86ea8092 Mon Sep 17 00:00:00 2001 From: "j-h.choi" Date: Thu, 5 Mar 2020 10:23:47 +0900 Subject: [PATCH] Copy the pdb file where the native image file exists --- NativeLauncher/tool/ni_common.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index bd72dc2..3a2a476 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -227,7 +227,7 @@ static ni_error_e crossgen(const std::string& dllPath, const std::string& appPat } if (!isManagedAssembly(dllPath)) { - fprintf(stderr, "Input file is not a dll file : %s\n", dllPath.c_str()); + //fprintf(stderr, "Input file is not a dll file : %s\n", dllPath.c_str()); return NI_ERROR_INVALID_PARAMETER; } @@ -238,6 +238,8 @@ static ni_error_e crossgen(const std::string& dllPath, const std::string& appPat std::string absDllPath = absolutePath(dllPath); std::string absNiPath = getNiFilePath(dllPath); + + if (absNiPath.empty()) { fprintf(stderr, "Fail to get ni file name\n"); return NI_ERROR_UNKNOWN; @@ -268,6 +270,13 @@ static ni_error_e crossgen(const std::string& dllPath, const std::string& appPat // niEixst() return false for System.Private.Corelib.dll if (isFileExist(absNiPath)) { copySmackAndOwnership(absDllPath, absNiPath); + std::string absPdbPath = replaceAll(absDllPath, ".dll", ".pdb"); + std::string pdbFilePath = replaceAll(absNiPath, ".ni.dll", ".pdb"); + if (isFileExist(absPdbPath) && (absPdbPath != pdbFilePath)) { + if (!copyFile(absPdbPath, pdbFilePath)) { + fprintf(stderr, "Failed to copy a .pdb file\n"); + } + } #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT if (baseAddr != 0) { updateBaseAddrFile(absNiPath, baseAddr); @@ -697,14 +706,14 @@ ni_error_e removeNiUnderPkgRoot(const std::string& pkgId) std::string binNIDir = concatPath(binDir, APP_NI_SUB_DIR); if (isFileExist(binNIDir)) { - if (rmdir(binNIDir.c_str()) != 0) { + if (!removeAll(binNIDir.c_str())) { fprintf(stderr, "Failed to remove app ni dir [%s]\n", binNIDir.c_str()); } } std::string libNIDir = concatPath(libDir, APP_NI_SUB_DIR); if (isFileExist(libNIDir)) { - if (rmdir(libNIDir.c_str()) != 0) { + if (!removeAll(libNIDir.c_str())) { fprintf(stderr, "Failed to remove app ni dir [%s]\n", libNIDir.c_str()); } } -- 2.7.4