From b0e5f262334e9a4d9e083d0daf430be2202f0152 Mon Sep 17 00:00:00 2001 From: David Yen Date: Fri, 8 Apr 2016 04:37:45 +0200 Subject: Added an option (-i) to have dump_syms output header information only. It is often helpful to check if a particular symbol file dumped by dump_syms actually matches a version of a binary file we have. The symbol output contains an ID which can be used to see if it matches the binary file. Unfortunately, this ID is internally calculated and not a standard hash of the binary file. Being able to output the header information only will allow users to determine whether their symbol file is up to date or not. R=jochen@chromium.org BUG=561447 Review URL: https://codereview.chromium.org/1864823002 . Patch from David Yen . --- src/tools/mac/dump_syms/dump_syms_tool.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/tools/mac/dump_syms') diff --git a/src/tools/mac/dump_syms/dump_syms_tool.cc b/src/tools/mac/dump_syms/dump_syms_tool.cc index 54f29226..6f68457b 100644 --- a/src/tools/mac/dump_syms/dump_syms_tool.cc +++ b/src/tools/mac/dump_syms/dump_syms_tool.cc @@ -51,11 +51,13 @@ using std::vector; struct Options { Options() - : srcPath(), dsymPath(), arch(), cfi(true), handle_inter_cu_refs(true) {} + : srcPath(), dsymPath(), arch(), header_only(false), + cfi(true), handle_inter_cu_refs(true) {} string srcPath; string dsymPath; const NXArchInfo *arch; + bool header_only; bool cfi; bool handle_inter_cu_refs; }; @@ -151,6 +153,9 @@ static bool Start(const Options &options) { } } + if (options.header_only) + return dump_symbols.WriteSymbolFileHeader(std::cout); + // Read the primary file into a Breakpad Module. Module* module = NULL; if (!dump_symbols.ReadSymbolData(&module)) @@ -189,6 +194,7 @@ static void Usage(int argc, const char *argv[]) { fprintf(stderr, "Output a Breakpad symbol file from a Mach-o file.\n"); fprintf(stderr, "Usage: %s [-a ARCHITECTURE] [-c] [-g dSYM path] " "\n", argv[0]); + fprintf(stderr, "\t-i: Output module header information only.\n"); fprintf(stderr, "\t-a: Architecture type [default: native, or whatever is\n"); fprintf(stderr, "\t in the file, if it contains only one architecture]\n"); fprintf(stderr, "\t-g: Debug symbol file (dSYM) to dump in addition to the " @@ -204,8 +210,11 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { extern int optind; signed char ch; - while ((ch = getopt(argc, (char * const *)argv, "a:g:chr?")) != -1) { + while ((ch = getopt(argc, (char * const *)argv, "ia:g:chr?")) != -1) { switch (ch) { + case 'i': + options->header_only = true; + break; case 'a': { const NXArchInfo *arch_info = google_breakpad::BreakpadGetArchInfoFromName(optarg); -- cgit v1.2.1