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

Unified Diff: src/tools/linux/dump_syms/dump_syms.cc

Issue 1864823002: Added an option (-i) to have dump_syms output header information only. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: merge Created 4 years, 8 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 | « src/common/mac/dump_syms.cc ('k') | src/tools/mac/dump_syms/dump_syms_tool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/tools/linux/dump_syms/dump_syms.cc
diff --git a/src/tools/linux/dump_syms/dump_syms.cc b/src/tools/linux/dump_syms/dump_syms.cc
index c51ae8cde4fa58fc78c188a8e85e80cbd8ab052b..84953172ea12d063c7f19a6c22a20a23ca5372ea 100644
--- a/src/tools/linux/dump_syms/dump_syms.cc
+++ b/src/tools/linux/dump_syms/dump_syms.cc
@@ -39,11 +39,13 @@
#include "common/linux/dump_symbols.h"
using google_breakpad::WriteSymbolFile;
+using google_breakpad::WriteSymbolFileHeader;
int usage(const char* self) {
fprintf(stderr, "Usage: %s [OPTION] <binary-with-debugging-info> "
"[directories-for-debug-file]\n\n", self);
fprintf(stderr, "Options:\n");
+ fprintf(stderr, " -i: Output module header information only.\n");
fprintf(stderr, " -c Do not generate CFI section\n");
fprintf(stderr, " -r Do not handle inter-compilation unit references\n");
fprintf(stderr, " -v Print all warnings to stderr\n");
@@ -53,27 +55,29 @@ int usage(const char* self) {
int main(int argc, char **argv) {
if (argc < 2)
return usage(argv[0]);
-
+ bool header_only = false;
bool cfi = true;
bool handle_inter_cu_refs = true;
bool log_to_stderr = false;
int arg_index = 1;
while (arg_index < argc && strlen(argv[arg_index]) > 0 &&
argv[arg_index][0] == '-') {
- if (strcmp("-c", argv[arg_index]) == 0) {
+ if (strcmp("-i", argv[arg_index]) == 0) {
+ header_only = true;
+ } else if (strcmp("-c", argv[arg_index]) == 0) {
cfi = false;
} else if (strcmp("-r", argv[arg_index]) == 0) {
handle_inter_cu_refs = false;
} else if (strcmp("-v", argv[arg_index]) == 0) {
log_to_stderr = true;
} else {
+ printf("2.4 %s\n", argv[arg_index]);
return usage(argv[0]);
}
++arg_index;
}
if (arg_index == argc)
return usage(argv[0]);
-
// Save stderr so it can be used below.
FILE* saved_stderr = fdopen(dup(fileno(stderr)), "w");
if (!log_to_stderr) {
@@ -82,7 +86,6 @@ int main(int argc, char **argv) {
// Add this brace section to silence gcc warnings.
}
}
-
const char* binary;
std::vector<string> debug_dirs;
binary = argv[arg_index];
@@ -92,11 +95,18 @@ int main(int argc, char **argv) {
debug_dirs.push_back(argv[debug_dir_index]);
}
- SymbolData symbol_data = cfi ? ALL_SYMBOL_DATA : NO_CFI;
- google_breakpad::DumpOptions options(symbol_data, handle_inter_cu_refs);
- if (!WriteSymbolFile(binary, debug_dirs, options, std::cout)) {
- fprintf(saved_stderr, "Failed to write symbol file.\n");
- return 1;
+ if (header_only) {
+ if (!WriteSymbolFileHeader(binary, std::cout)) {
+ fprintf(saved_stderr, "Failed to process file.\n");
+ return 1;
+ }
+ } else {
+ SymbolData symbol_data = cfi ? ALL_SYMBOL_DATA : NO_CFI;
+ google_breakpad::DumpOptions options(symbol_data, handle_inter_cu_refs);
+ if (!WriteSymbolFile(binary, debug_dirs, options, std::cout)) {
+ fprintf(saved_stderr, "Failed to write symbol file.\n");
+ return 1;
+ }
}
return 0;
« no previous file with comments | « src/common/mac/dump_syms.cc ('k') | src/tools/mac/dump_syms/dump_syms_tool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698