Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2813)

Unified Diff: base/linux_util.cc

Issue 155653: Include output of "lsb_release -d" in crash reports.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/linux_util.h ('k') | chrome/app/breakpad_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/linux_util.cc
===================================================================
--- base/linux_util.cc (revision 20935)
+++ base/linux_util.cc (working copy)
@@ -2,10 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "linux_util.h"
+#include "base/linux_util.h"
#include <stdlib.h>
+#include <vector>
+
+#include "base/command_line.h"
+#include "base/process_util.h"
+
namespace base {
uint8_t* BGRAToRGBA(const uint8_t* pixels, int width, int height, int stride) {
@@ -28,4 +33,30 @@
return new_pixels;
}
+// We use this static string to hold the Linux distro info. If we
+// crash, the crash handler code will send this in the crash dump.
+std::string linux_distro = "Unknown";
+
+std::string GetLinuxDistro() {
+ static bool checked_distro = false;
+ if (!checked_distro) {
+ std::vector<std::string> argv;
+ argv.push_back("lsb_release");
+ argv.push_back("-d");
+ std::string output;
+ base::GetAppOutput(CommandLine(argv), &output);
+ if (output.length() > 0) {
+ // lsb_release -d should return: Description:<tab>Distro Info
+ static const std::string field = "Description:\t";
+ if (output.compare(0, field.length(), field) == 0)
+ linux_distro = output.substr(field.length());
+ }
+ // We do this check only once per process. If it fails, there's
+ // little reason to believe it will work if we attempt to run
+ // lsb_release again.
+ checked_distro = true;
+ }
+ return linux_distro;
+}
+
} // namespace base
« no previous file with comments | « base/linux_util.h ('k') | chrome/app/breakpad_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698