diff options
author | thestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2013-04-24 21:18:44 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2013-04-24 21:18:44 +0000 |
commit | f7566bd447f628d77152dc28fb70ab232c342b86 (patch) | |
tree | a092b168c9b64f59a72f62ba9680bc4a0d0dcb8a /src/tools | |
parent | Fix Clang warning regarding null pointer argument. (diff) | |
download | breakpad-f7566bd447f628d77152dc28fb70ab232c342b86.tar.xz |
Add an option to not handle DWARF inter-compilation unit references in Linux dump_syms.
This saves a lot of memory for dump_syms.
Review URL: https://breakpad.appspot.com/565002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1163 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/linux/dump_syms/dump_syms.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/tools/linux/dump_syms/dump_syms.cc b/src/tools/linux/dump_syms/dump_syms.cc index f58952ed..c8ade33a 100644 --- a/src/tools/linux/dump_syms/dump_syms.cc +++ b/src/tools/linux/dump_syms/dump_syms.cc @@ -43,33 +43,43 @@ int usage(const char* self) { "[directories-for-debug-file]\n\n", self); fprintf(stderr, "Options:\n"); fprintf(stderr, " -c Do not generate CFI section\n"); + fprintf(stderr, " -r Do not handle inter-compilation unit references\n"); return 1; } int main(int argc, char **argv) { - if (argc < 2 || argc > 4) + if (argc < 2) return usage(argv[0]); bool cfi = true; - int binary_index = 1; - if (strcmp("-c", argv[1]) == 0) { - cfi = false; - ++binary_index; + bool handle_inter_cu_refs = true; + int arg_index = 1; + while (arg_index < argc && strlen(argv[arg_index]) > 0 && + argv[arg_index][0] == '-') { + if (strcmp("-c", argv[arg_index]) == 0) { + cfi = false; + } else if (strcmp("-r", argv[arg_index]) == 0) { + handle_inter_cu_refs = false; + } else { + return usage(argv[0]); + } + ++arg_index; } - if (!cfi && argc == 2) + if (arg_index == argc) return usage(argv[0]); - const char *binary; + const char* binary; std::vector<string> debug_dirs; - binary = argv[binary_index]; - for (int debug_dir_index = binary_index + 1; + binary = argv[arg_index]; + for (int debug_dir_index = arg_index + 1; debug_dir_index < argc; ++debug_dir_index) { debug_dirs.push_back(argv[debug_dir_index]); } SymbolData symbol_data = cfi ? ALL_SYMBOL_DATA : NO_CFI; - if (!WriteSymbolFile(binary, debug_dirs, symbol_data, std::cout)) { + google_breakpad::DumpOptions options(symbol_data, handle_inter_cu_refs); + if (!WriteSymbolFile(binary, debug_dirs, options, std::cout)) { fprintf(stderr, "Failed to write symbol file.\n"); return 1; } |