Make DumpSymbols methods take a vector of debug_dirs

r=thestig at https://breakpad.appspot.com/512002/

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1102 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ted.mielczarek@gmail.com 2013-01-22 13:36:39 +00:00
parent 834f7ee611
commit c6f6d9ef30
4 changed files with 60 additions and 44 deletions

View file

@ -32,6 +32,7 @@
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include "common/linux/dump_symbols.h"
@ -39,7 +40,7 @@ using google_breakpad::WriteSymbolFile;
int usage(const char* self) {
fprintf(stderr, "Usage: %s [OPTION] <binary-with-debugging-info> "
"[directory-for-debug-file]\n\n", self);
"[directories-for-debug-file]\n\n", self);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -c Do not generate CFI section\n");
return 1;
@ -50,24 +51,24 @@ int main(int argc, char **argv) {
return usage(argv[0]);
bool cfi = true;
if (strcmp("-c", argv[1]) == 0)
int binary_index = 1;
if (strcmp("-c", argv[1]) == 0) {
cfi = false;
++binary_index;
}
if (!cfi && argc == 2)
return usage(argv[0]);
const char *binary;
std::string debug_dir;
if (cfi) {
binary = argv[1];
if (argc == 3)
debug_dir = argv[2];
} else {
binary = argv[2];
if (argc == 4)
debug_dir = argv[3];
std::vector<string> debug_dirs;
binary = argv[binary_index];
for (int debug_dir_index = binary_index + 1;
debug_dir_index < argc;
++debug_dir_index) {
debug_dirs.push_back(argv[debug_dir_index]);
}
if (!WriteSymbolFile(binary, debug_dir, cfi, std::cout)) {
if (!WriteSymbolFile(binary, debug_dirs, cfi, std::cout)) {
fprintf(stderr, "Failed to write symbol file.\n");
return 1;
}