55// For linux_syscall_support.h. This makes it safe to call embedded system
66// calls when in seccomp mode.
77
8- #include " chrome /app/breakpad_linux.h"
8+ #include " components/breakpad /app/breakpad_linux.h"
99
1010#include < fcntl.h>
1111#include < poll.h>
4040#include " content/nw/src/breakpad_linux_impl.h"
4141#include " chrome/common/child_process_logging.h"
4242#include " chrome/common/chrome_paths.h"
43- #include " components/breakpad/breakpad_client.h"
43+ #include " components/breakpad/app/ breakpad_client.h"
4444#include " content/public/common/content_descriptors.h"
4545#include " content/public/common/content_switches.h"
4646
7474using google_breakpad::ExceptionHandler;
7575using google_breakpad::MinidumpDescriptor;
7676
77+ using breakpad::GetBreakpadClient;
78+
7779namespace {
7880
7981const char kUploadURL [] = " https://clients2.google.com/cr/report" ;
@@ -193,26 +195,12 @@ size_t LengthWithoutTrailingSpaces(const char* str, size_t len) {
193195 return len;
194196}
195197
196- // Populates the passed in allocated strings and their sizes with the GUID,
197- // crash url and distro of the crashing process.
198- // The passed strings are expected to be at least kGuidSize, kMaxActiveURLSize
199- // and kDistroSize bytes long respectively.
200- void PopulateGUIDAndURLAndDistro (char * guid, size_t * guid_len_param,
201- char * crash_url, size_t * crash_url_len_param,
202- char * distro, size_t * distro_len_param) {
203- size_t guid_len = std::min (my_strlen (child_process_logging::g_client_id),
204- kGuidSize );
205- size_t crash_url_len =
206- std::min (my_strlen (child_process_logging::g_active_url),
207- kMaxActiveURLSize );
198+ // Populates the passed in allocated string and its size with the distro of
199+ // the crashing process.
200+ // The passed string is expected to be at least kDistroSize bytes long.
201+ void PopulateDistro (char * distro, size_t * distro_len_param) {
208202 size_t distro_len = std::min (my_strlen (base::g_linux_distro), kDistroSize );
209- memcpy (guid, child_process_logging::g_client_id, guid_len);
210- memcpy (crash_url, child_process_logging::g_active_url, crash_url_len);
211203 memcpy (distro, base::g_linux_distro, distro_len);
212- if (guid_len_param)
213- *guid_len_param = guid_len;
214- if (crash_url_len_param)
215- *crash_url_len_param = crash_url_len;
216204 if (distro_len_param)
217205 *distro_len_param = distro_len;
218206}
@@ -223,10 +211,10 @@ void SetClientIdFromCommandLine(const CommandLine& command_line) {
223211 command_line.GetSwitchValueASCII (switches::kEnableCrashReporter );
224212 size_t separator = switch_value.find (" ," );
225213 if (separator != std::string::npos) {
226- child_process_logging::SetClientId (switch_value.substr (0 , separator));
214+ GetBreakpadClient ()-> SetClientID (switch_value.substr (0 , separator));
227215 base::SetLinuxDistro (switch_value.substr (separator + 1 ));
228216 } else {
229- child_process_logging::SetClientId (switch_value);
217+ GetBreakpadClient ()-> SetClientID (switch_value);
230218 }
231219}
232220
@@ -598,8 +586,6 @@ bool CrashDone(const MinidumpDescriptor& minidump,
598586 info.process_type_length = 7 ;
599587 info.crash_url = NULL ;
600588 info.crash_url_length = 0 ;
601- info.guid = child_process_logging::g_client_id;
602- info.guid_length = my_strlen (child_process_logging::g_client_id);
603589 info.distro = base::g_linux_distro;
604590 info.distro_length = my_strlen (base::g_linux_distro);
605591 info.upload = upload;
@@ -708,17 +694,14 @@ bool CrashDoneInProcessNoUpload(
708694 size_t guid_length = 0 ;
709695 size_t crash_url_length = 0 ;
710696 size_t distro_length = 0 ;
711- PopulateGUIDAndURLAndDistro (guid, &guid_length, crash_url, &crash_url_length,
712- distro, &distro_length);
697+ PopulateDistro (distro, &distro_length);
713698 BreakpadInfo info = {0 };
714699 info.filename = NULL ;
715700 info.fd = descriptor.fd ();
716701 info.process_type = g_process_type;
717702 info.process_type_length = my_strlen (g_process_type);
718703 info.crash_url = crash_url;
719704 info.crash_url_length = crash_url_length;
720- info.guid = guid;
721- info.guid_length = guid_length;
722705 info.distro = distro;
723706 info.distro_length = distro_length;
724707 info.upload = false ;
@@ -773,10 +756,8 @@ bool NonBrowserCrashHandler(const void* crash_context,
773756 }
774757
775758 // Start constructing the message to send to the browser.
776- char guid[kGuidSize + 1 ] = {0 };
777- char crash_url[kMaxActiveURLSize + 1 ] = {0 };
778759 char distro[kDistroSize + 1 ] = {0 };
779- PopulateGUIDAndURLAndDistro (guid, NULL , crash_url, NULL , distro, NULL );
760+ PopulateDistro ( distro, NULL );
780761
781762 char b; // Dummy variable for sys_read below.
782763 const char * b_addr = &b; // Get the address of |b| so we can create the
@@ -793,28 +774,24 @@ bool NonBrowserCrashHandler(const void* crash_context,
793774 struct kernel_iovec iov[kCrashIovSize ];
794775 iov[0 ].iov_base = const_cast <void *>(crash_context);
795776 iov[0 ].iov_len = crash_context_size;
796- iov[1 ].iov_base = guid;
797- iov[1 ].iov_len = kGuidSize + 1 ;
798- iov[2 ].iov_base = crash_url;
799- iov[2 ].iov_len = kMaxActiveURLSize + 1 ;
800- iov[3 ].iov_base = distro;
801- iov[3 ].iov_len = kDistroSize + 1 ;
802- iov[4 ].iov_base = &b_addr;
803- iov[4 ].iov_len = sizeof (b_addr);
804- iov[5 ].iov_base = &fds[0 ];
805- iov[5 ].iov_len = sizeof (fds[0 ]);
806- iov[6 ].iov_base = &g_process_start_time;
807- iov[6 ].iov_len = sizeof (g_process_start_time);
808- iov[7 ].iov_base = &base::g_oom_size;
809- iov[7 ].iov_len = sizeof (base::g_oom_size);
777+ iov[1 ].iov_base = distro;
778+ iov[1 ].iov_len = kDistroSize + 1 ;
779+ iov[2 ].iov_base = &b_addr;
780+ iov[2 ].iov_len = sizeof (b_addr);
781+ iov[3 ].iov_base = &fds[0 ];
782+ iov[3 ].iov_len = sizeof (fds[0 ]);
783+ iov[4 ].iov_base = &g_process_start_time;
784+ iov[4 ].iov_len = sizeof (g_process_start_time);
785+ iov[5 ].iov_base = &base::g_oom_size;
786+ iov[5 ].iov_len = sizeof (base::g_oom_size);
810787 google_breakpad::SerializedNonAllocatingMap* serialized_map;
811- iov[8 ].iov_len = g_crash_keys->Serialize (
788+ iov[6 ].iov_len = g_crash_keys->Serialize (
812789 const_cast <const google_breakpad::SerializedNonAllocatingMap**>(
813790 &serialized_map));
814- iov[8 ].iov_base = serialized_map;
791+ iov[6 ].iov_base = serialized_map;
815792#if defined(ADDRESS_SANITIZER)
816- iov[9 ].iov_base = const_cast <char *>(g_asan_report_str);
817- iov[9 ].iov_len = kMaxAsanReportSize + 1 ;
793+ iov[7 ].iov_base = const_cast <char *>(g_asan_report_str);
794+ iov[7 ].iov_len = kMaxAsanReportSize + 1 ;
818795#endif
819796
820797 msg.msg_iov = iov;
0 commit comments