Copy the pdb file where the native image file exists
authorj-h.choi <j-h.choi@samsung.com>
Thu, 5 Mar 2020 01:23:47 +0000 (10:23 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Tue, 10 Mar 2020 02:36:44 +0000 (11:36 +0900)
NativeLauncher/tool/ni_common.cc

index bd72dc2..3a2a476 100644 (file)
@@ -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());
                }
        }