I started working on this again. It has been a while since I worked with C++ and I needed some guidance. [:botond] - who's on the layouts team has been gracious enough to help me out! We have been pair programming on this bug in our extra time. Here are our findings so far: ## April 14, 2023 **Summary of today's session:** - Finished copying the rest of the code - Finished a full build but there are compile errors we can look at next time ``` 10:25.30 /Users/mandycheang/central/toolkit/components/osfile/NativeOSFileInternals.cpp:824:24: warning: result of comparison 'unsigned long' > 18446744073709551615 is always false [-Wtautological-type-limit-compare] 10:25.30 needed.value() > std::numeric_limits<nsAString::size_type>::max()) { 10:25.30 ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10:25.38 toolkit/components/printingui/ipc 10:25.66 1 warning generated. 10:25.71 toolkit/components/processtools 10:25.77 toolkit/components/protobuf 10:26.46 toolkit/components/reflect 10:26.87 toolkit/components/remote 10:27.01 toolkit/components/reputationservice 10:27.14 toolkit/components/resistfingerprinting 10:27.80 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/generated_message_tctable_lite.cc:1631:10: warning: 'return' will never be executed [-Wunreachable-code-return] 10:27.80 return Error(PROTOBUF_TC_PARAM_PASS); 10:27.80 ^~~~~ 10:27.89 toolkit/components/satchel 10:28.75 1 warning generated. 10:28.79 toolkit/components/sessionstore 10:28.95 toolkit/components/startup 10:29.18 toolkit/components/statusfilter 10:29.29 toolkit/components/telemetry/TelemetryHistogramData.inc.stub 10:29.67 toolkit/components/terminator 10:29.73 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc:375:10: warning: 'return' will never be executed [-Wunreachable-code-return] 10:29.73 return true; 10:29.73 ^~~~ 10:29.76 toolkit/components/typeaheadfind 10:29.81 1 warning generated. 10:29.93 toolkit/components/uniffi-js 10:30.30 toolkit/components/url-classifier 10:30.71 toolkit/components/viaduct 10:30.99 toolkit/components/windowwatcher 10:32.95 toolkit/crashreporter/breakpad-client/mac/crash_generation 10:32.97 toolkit/crashreporter/breakpad-client/mac/handler 10:33.12 toolkit/crashreporter/breakpad-client 10:33.41 toolkit/crashreporter/google-breakpad/src/common/mac 10:33.42 toolkit/crashreporter/google-breakpad/src/common 10:33.80 toolkit/crashreporter 10:34.31 toolkit/library/buildid.cpp.stub 10:34.39 In file included from Unified_cpp_components_protobuf0.cpp:47: 10:34.39 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc:506:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] 10:34.39 sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"), 10:34.39 ^ 10:34.40 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here 10:34.40 __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") 10:34.40 ^ 10:34.40 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' 10:34.40 #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) 10:34.40 ^ 10:34.47 toolkit/mozapps/extensions 10:34.53 toolkit/profile 10:34.80 In file included from Unified_cpp_crashreporter0.cpp:11: 10:34.80 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1461:24: error: use of undeclared identifier 'NS_LITERAL_STRING' 10:34.80 miniDumpsDir->Append(NS_LITERAL_STRING("minidumps")); 10:34.80 ^ 10:34.82 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1528:41: error: use of undeclared identifier 'memoryReportLocalPath' 10:34.84 copy_file(memoryReportPath.c_str(), memoryReportLocalPath); 10:34.84 ^ 10:34.84 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1594:7: error: no viable conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'bool' 10:34.84 if (memoryReportPath) { 10:34.85 ^~~~~~~~~~~~~~~~ 10:34.85 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/c++/v1/string:903:5: note: candidate function 10:34.85 operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } 10:34.85 ^ 10:34.85 In file included from Unified_cpp_crashreporter0.cpp:11: 10:34.86 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1598:5: error: no matching function for call to 'copy_file' 10:34.86 copy_file(memoryReportPath, memoryReportLocalPath); 10:34.86 ^~~~~~~~~ 10:34.86 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:501:6: note: candidate function not viable: no known conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'const char *' for 1st argument 10:34.87 bool copy_file(const char* from, const char* to) { 10:34.87 ^ 10:34.87 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1613:17: error: no matching function for call to 'LaunchProgram' 10:34.87 returnValue = LaunchProgram(crashReporterPath, minidumpPathInMinidumpsDir); 10:34.87 ^~~~~~~~~~~~~ 10:34.99 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1195:13: note: candidate function not viable: no known conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'const CrashReporter::XP_CHAR *' (aka 'const char *') for 1st argument 10:34.99 static bool LaunchProgram(const XP_CHAR* aProgramPath, 10:34.99 ^ 10:34.99 5 errors generated. 10:34.99 make[4]: *** [Unified_cpp_crashreporter0.o] Error 1 10:34.99 make[4]: *** Waiting for unfinished jobs.... 10:35.03 toolkit/system/commonproxy 10:35.07 1 warning generated. 10:35.12 toolkit/system/osxproxy 10:35.30 make[3]: *** [toolkit/crashreporter/target-objects] Error 2 10:35.30 make[3]: *** Waiting for unfinished jobs.... 10:41.01 make[2]: *** [compile] Error 2 10:41.01 make[1]: *** [default] Error 2 10:41.01 make: *** [build] Error 2 10:41.04 1311 compiler warnings present. 10:41.12 Notification center failed: Install terminal-notifier to get a notification when the build finishes. ➜ central ``` **Discussion:** - ```c++ // This was tricky to understand, but this is "equivalent" to declaring and assigning a variable in a higher language xpstring path = xpstring(minidump->NativePath().get()); static XP_CHAR minidumpPathInMinidumpsDir[XP_PATH_MAX]; p = Concat(minidumpPathInMinidumpsDir, path.c_str(), &size); ``` - We figured out how to declare a variable before calling `createFileFromPath` [in this code here](https://searchfox.org/mozilla-central/rev/7939a5150dcd96915bccf1c819433ad489a5edc9/toolkit/crashreporter/nsExceptionHandler.cpp#3236,3244)] - ```c++ nsCOMPtr<nsIFile> minidump; CreateFileFromPath(aFilePath, getter_AddRefs(minidump)); ``` ## March 15, 2023 **Summary of today's session:** * Understood the scope of the problem: The patch is finished and approved. What’s left is to fix the remaining failing tests. * Since the patch is over 3 years old now, we started copying over the code into the latest files. This will help so we don’t have to rebase a deal with merge conflicts. **Discussion:** - The parent directory is `profile/` - The dump directory is `profile/minidumps` - nsComPtr are smart pointers and it knows how to automatically deallocate and free destroyed object memory ``` NS_GetSpecialDirectory(const char* aSpecialDirName, nsIFile** aResult) ``` - Investigated the `NS_GetSpecialDirectory` function signature and learned that it takes two arguments: - `const char*` a SpecialDirName - `nsIFile** aResult` - It knows about a special directory, and in the code we're looking at, it's "ProfD" or profileDirectory - It creates an nsIFile object representing the profile directory and stores it into `nsIFile** aResult` - ``` nsCOMPtr<nsIFile> file; rv = NS_GetSpecialDirectory("ProfD", getter_AddRefs(file)); ``` - We looked into `NS_GetSpecialDirectory` to understand what `getter_AddRefs()` was returning
Bug 1541603 Comment 15 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
I started working on this again in my extra time. It has been a while since I worked with C++ and I needed some guidance. [:botond] - who's on the layouts team has been gracious enough to help me out! We have been pair programming on this bug in our extra time. Here are our findings so far: ## April 14, 2023 **Summary of today's session:** - Finished copying the rest of the code - Finished a full build but there are compile errors we can look at next time ``` 10:25.30 /Users/mandycheang/central/toolkit/components/osfile/NativeOSFileInternals.cpp:824:24: warning: result of comparison 'unsigned long' > 18446744073709551615 is always false [-Wtautological-type-limit-compare] 10:25.30 needed.value() > std::numeric_limits<nsAString::size_type>::max()) { 10:25.30 ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10:25.38 toolkit/components/printingui/ipc 10:25.66 1 warning generated. 10:25.71 toolkit/components/processtools 10:25.77 toolkit/components/protobuf 10:26.46 toolkit/components/reflect 10:26.87 toolkit/components/remote 10:27.01 toolkit/components/reputationservice 10:27.14 toolkit/components/resistfingerprinting 10:27.80 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/generated_message_tctable_lite.cc:1631:10: warning: 'return' will never be executed [-Wunreachable-code-return] 10:27.80 return Error(PROTOBUF_TC_PARAM_PASS); 10:27.80 ^~~~~ 10:27.89 toolkit/components/satchel 10:28.75 1 warning generated. 10:28.79 toolkit/components/sessionstore 10:28.95 toolkit/components/startup 10:29.18 toolkit/components/statusfilter 10:29.29 toolkit/components/telemetry/TelemetryHistogramData.inc.stub 10:29.67 toolkit/components/terminator 10:29.73 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc:375:10: warning: 'return' will never be executed [-Wunreachable-code-return] 10:29.73 return true; 10:29.73 ^~~~ 10:29.76 toolkit/components/typeaheadfind 10:29.81 1 warning generated. 10:29.93 toolkit/components/uniffi-js 10:30.30 toolkit/components/url-classifier 10:30.71 toolkit/components/viaduct 10:30.99 toolkit/components/windowwatcher 10:32.95 toolkit/crashreporter/breakpad-client/mac/crash_generation 10:32.97 toolkit/crashreporter/breakpad-client/mac/handler 10:33.12 toolkit/crashreporter/breakpad-client 10:33.41 toolkit/crashreporter/google-breakpad/src/common/mac 10:33.42 toolkit/crashreporter/google-breakpad/src/common 10:33.80 toolkit/crashreporter 10:34.31 toolkit/library/buildid.cpp.stub 10:34.39 In file included from Unified_cpp_components_protobuf0.cpp:47: 10:34.39 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc:506:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] 10:34.39 sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"), 10:34.39 ^ 10:34.40 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here 10:34.40 __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") 10:34.40 ^ 10:34.40 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' 10:34.40 #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) 10:34.40 ^ 10:34.47 toolkit/mozapps/extensions 10:34.53 toolkit/profile 10:34.80 In file included from Unified_cpp_crashreporter0.cpp:11: 10:34.80 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1461:24: error: use of undeclared identifier 'NS_LITERAL_STRING' 10:34.80 miniDumpsDir->Append(NS_LITERAL_STRING("minidumps")); 10:34.80 ^ 10:34.82 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1528:41: error: use of undeclared identifier 'memoryReportLocalPath' 10:34.84 copy_file(memoryReportPath.c_str(), memoryReportLocalPath); 10:34.84 ^ 10:34.84 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1594:7: error: no viable conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'bool' 10:34.84 if (memoryReportPath) { 10:34.85 ^~~~~~~~~~~~~~~~ 10:34.85 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/c++/v1/string:903:5: note: candidate function 10:34.85 operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } 10:34.85 ^ 10:34.85 In file included from Unified_cpp_crashreporter0.cpp:11: 10:34.86 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1598:5: error: no matching function for call to 'copy_file' 10:34.86 copy_file(memoryReportPath, memoryReportLocalPath); 10:34.86 ^~~~~~~~~ 10:34.86 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:501:6: note: candidate function not viable: no known conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'const char *' for 1st argument 10:34.87 bool copy_file(const char* from, const char* to) { 10:34.87 ^ 10:34.87 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1613:17: error: no matching function for call to 'LaunchProgram' 10:34.87 returnValue = LaunchProgram(crashReporterPath, minidumpPathInMinidumpsDir); 10:34.87 ^~~~~~~~~~~~~ 10:34.99 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1195:13: note: candidate function not viable: no known conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'const CrashReporter::XP_CHAR *' (aka 'const char *') for 1st argument 10:34.99 static bool LaunchProgram(const XP_CHAR* aProgramPath, 10:34.99 ^ 10:34.99 5 errors generated. 10:34.99 make[4]: *** [Unified_cpp_crashreporter0.o] Error 1 10:34.99 make[4]: *** Waiting for unfinished jobs.... 10:35.03 toolkit/system/commonproxy 10:35.07 1 warning generated. 10:35.12 toolkit/system/osxproxy 10:35.30 make[3]: *** [toolkit/crashreporter/target-objects] Error 2 10:35.30 make[3]: *** Waiting for unfinished jobs.... 10:41.01 make[2]: *** [compile] Error 2 10:41.01 make[1]: *** [default] Error 2 10:41.01 make: *** [build] Error 2 10:41.04 1311 compiler warnings present. 10:41.12 Notification center failed: Install terminal-notifier to get a notification when the build finishes. ➜ central ``` **Discussion:** - ```c++ // This was tricky to understand, but this is "equivalent" to declaring and assigning a variable in a higher language xpstring path = xpstring(minidump->NativePath().get()); static XP_CHAR minidumpPathInMinidumpsDir[XP_PATH_MAX]; p = Concat(minidumpPathInMinidumpsDir, path.c_str(), &size); ``` - We figured out how to declare a variable before calling `createFileFromPath` [in this code here](https://searchfox.org/mozilla-central/rev/7939a5150dcd96915bccf1c819433ad489a5edc9/toolkit/crashreporter/nsExceptionHandler.cpp#3236,3244)] - ```c++ nsCOMPtr<nsIFile> minidump; CreateFileFromPath(aFilePath, getter_AddRefs(minidump)); ``` ## March 15, 2023 **Summary of today's session:** * Understood the scope of the problem: The patch is finished and approved. What’s left is to fix the remaining failing tests. * Since the patch is over 3 years old now, we started copying over the code into the latest files. This will help so we don’t have to rebase a deal with merge conflicts. **Discussion:** - The parent directory is `profile/` - The dump directory is `profile/minidumps` - nsComPtr are smart pointers and it knows how to automatically deallocate and free destroyed object memory ``` NS_GetSpecialDirectory(const char* aSpecialDirName, nsIFile** aResult) ``` - Investigated the `NS_GetSpecialDirectory` function signature and learned that it takes two arguments: - `const char*` a SpecialDirName - `nsIFile** aResult` - It knows about a special directory, and in the code we're looking at, it's "ProfD" or profileDirectory - It creates an nsIFile object representing the profile directory and stores it into `nsIFile** aResult` - ``` nsCOMPtr<nsIFile> file; rv = NS_GetSpecialDirectory("ProfD", getter_AddRefs(file)); ``` - We looked into `NS_GetSpecialDirectory` to understand what `getter_AddRefs()` was returning
I started working on this again in my extra time. It has been a while since I worked with C++ and I needed some guidance. [:botond] - who's on the layouts team has been gracious enough to help me out! We have been pair programming on this bug in our extra time. Here are our findings so far: ## April 14, 2023 **Summary of today's session:** - Finished copying the rest of the code - Finished a full build but there are compile errors we can look at next time ``` 10:25.30 /Users/mandycheang/central/toolkit/components/osfile/NativeOSFileInternals.cpp:824:24: warning: result of comparison 'unsigned long' > 18446744073709551615 is always false [-Wtautological-type-limit-compare] 10:25.30 needed.value() > std::numeric_limits<nsAString::size_type>::max()) { 10:25.30 ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10:25.38 toolkit/components/printingui/ipc 10:25.66 1 warning generated. 10:25.71 toolkit/components/processtools 10:25.77 toolkit/components/protobuf 10:26.46 toolkit/components/reflect 10:26.87 toolkit/components/remote 10:27.01 toolkit/components/reputationservice 10:27.14 toolkit/components/resistfingerprinting 10:27.80 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/generated_message_tctable_lite.cc:1631:10: warning: 'return' will never be executed [-Wunreachable-code-return] 10:27.80 return Error(PROTOBUF_TC_PARAM_PASS); 10:27.80 ^~~~~ 10:27.89 toolkit/components/satchel 10:28.75 1 warning generated. 10:28.79 toolkit/components/sessionstore 10:28.95 toolkit/components/startup 10:29.18 toolkit/components/statusfilter 10:29.29 toolkit/components/telemetry/TelemetryHistogramData.inc.stub 10:29.67 toolkit/components/terminator 10:29.73 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc:375:10: warning: 'return' will never be executed [-Wunreachable-code-return] 10:29.73 return true; 10:29.73 ^~~~ 10:29.76 toolkit/components/typeaheadfind 10:29.81 1 warning generated. 10:29.93 toolkit/components/uniffi-js 10:30.30 toolkit/components/url-classifier 10:30.71 toolkit/components/viaduct 10:30.99 toolkit/components/windowwatcher 10:32.95 toolkit/crashreporter/breakpad-client/mac/crash_generation 10:32.97 toolkit/crashreporter/breakpad-client/mac/handler 10:33.12 toolkit/crashreporter/breakpad-client 10:33.41 toolkit/crashreporter/google-breakpad/src/common/mac 10:33.42 toolkit/crashreporter/google-breakpad/src/common 10:33.80 toolkit/crashreporter 10:34.31 toolkit/library/buildid.cpp.stub 10:34.39 In file included from Unified_cpp_components_protobuf0.cpp:47: 10:34.39 /Users/mandycheang/central/toolkit/components/protobuf/src/google/protobuf/stubs/strutil.cc:506:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] 10:34.39 sprintf(dest + used, (use_hex ? "\\x%02x" : "\\%03o"), 10:34.39 ^ 10:34.40 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here 10:34.40 __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") 10:34.40 ^ 10:34.40 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg' 10:34.40 #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg))) 10:34.40 ^ 10:34.47 toolkit/mozapps/extensions 10:34.53 toolkit/profile 10:34.80 In file included from Unified_cpp_crashreporter0.cpp:11: 10:34.80 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1461:24: error: use of undeclared identifier 'NS_LITERAL_STRING' 10:34.80 miniDumpsDir->Append(NS_LITERAL_STRING("minidumps")); 10:34.80 ^ 10:34.82 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1528:41: error: use of undeclared identifier 'memoryReportLocalPath' 10:34.84 copy_file(memoryReportPath.c_str(), memoryReportLocalPath); 10:34.84 ^ 10:34.84 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1594:7: error: no viable conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'bool' 10:34.84 if (memoryReportPath) { 10:34.85 ^~~~~~~~~~~~~~~~ 10:34.85 /Users/mandycheang/.mozbuild/MacOSX13.0.sdk/usr/include/c++/v1/string:903:5: note: candidate function 10:34.85 operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } 10:34.85 ^ 10:34.85 In file included from Unified_cpp_crashreporter0.cpp:11: 10:34.86 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1598:5: error: no matching function for call to 'copy_file' 10:34.86 copy_file(memoryReportPath, memoryReportLocalPath); 10:34.86 ^~~~~~~~~ 10:34.86 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:501:6: note: candidate function not viable: no known conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'const char *' for 1st argument 10:34.87 bool copy_file(const char* from, const char* to) { 10:34.87 ^ 10:34.87 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1613:17: error: no matching function for call to 'LaunchProgram' 10:34.87 returnValue = LaunchProgram(crashReporterPath, minidumpPathInMinidumpsDir); 10:34.87 ^~~~~~~~~~~~~ 10:34.99 /Users/mandycheang/central/toolkit/crashreporter/nsExceptionHandler.cpp:1195:13: note: candidate function not viable: no known conversion from 'CrashReporter::xpstring' (aka 'basic_string<char, char_traits<char>, allocator<char>>') to 'const CrashReporter::XP_CHAR *' (aka 'const char *') for 1st argument 10:34.99 static bool LaunchProgram(const XP_CHAR* aProgramPath, 10:34.99 ^ 10:34.99 5 errors generated. 10:34.99 make[4]: *** [Unified_cpp_crashreporter0.o] Error 1 10:34.99 make[4]: *** Waiting for unfinished jobs.... 10:35.03 toolkit/system/commonproxy 10:35.07 1 warning generated. 10:35.12 toolkit/system/osxproxy 10:35.30 make[3]: *** [toolkit/crashreporter/target-objects] Error 2 10:35.30 make[3]: *** Waiting for unfinished jobs.... 10:41.01 make[2]: *** [compile] Error 2 10:41.01 make[1]: *** [default] Error 2 10:41.01 make: *** [build] Error 2 10:41.04 1311 compiler warnings present. 10:41.12 Notification center failed: Install terminal-notifier to get a notification when the build finishes. ➜ central ``` **Discussion:** - ```c++ // This was tricky to understand, but this is "equivalent" to declaring and assigning a variable in a higher language static XP_CHAR minidumpPathInMinidumpsDir[XP_PATH_MAX]; p = Concat(minidumpPathInMinidumpsDir, path.c_str(), &size); ``` - We figured out how to declare a variable before calling `createFileFromPath` [in this code here](https://searchfox.org/mozilla-central/rev/7939a5150dcd96915bccf1c819433ad489a5edc9/toolkit/crashreporter/nsExceptionHandler.cpp#3236,3244)] - ```c++ nsCOMPtr<nsIFile> minidump; CreateFileFromPath(aFilePath, getter_AddRefs(minidump)); ``` ## March 15, 2023 **Summary of today's session:** * Understood the scope of the problem: The patch is finished and approved. What’s left is to fix the remaining failing tests. * Since the patch is over 3 years old now, we started copying over the code into the latest files. This will help so we don’t have to rebase a deal with merge conflicts. **Discussion:** - The parent directory is `profile/` - The dump directory is `profile/minidumps` - nsComPtr are smart pointers and it knows how to automatically deallocate and free destroyed object memory ``` NS_GetSpecialDirectory(const char* aSpecialDirName, nsIFile** aResult) ``` - Investigated the `NS_GetSpecialDirectory` function signature and learned that it takes two arguments: - `const char*` a SpecialDirName - `nsIFile** aResult` - It knows about a special directory, and in the code we're looking at, it's "ProfD" or profileDirectory - It creates an nsIFile object representing the profile directory and stores it into `nsIFile** aResult` - ``` nsCOMPtr<nsIFile> file; rv = NS_GetSpecialDirectory("ProfD", getter_AddRefs(file)); ``` - We looked into `NS_GetSpecialDirectory` to understand what `getter_AddRefs()` was returning