mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-06 04:22:58 +00:00
Add options to set OS and filename
This allows Fuchsia to use dump_syms directly without a postprocessing step. Change-Id: I84507f8bedddfcdcdb237119457c8ddf8ac354d5 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1850718 Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
committed by
Mike Frysinger
parent
3e56ef9d4e
commit
17958ef62c
@@ -45,10 +45,14 @@ 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");
|
||||
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");
|
||||
fprintf(stderr, " -n <name> Use specified name for name of the object\n");
|
||||
fprintf(stderr, " -o <os> Use specified name for the "
|
||||
"operating system\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -59,6 +63,8 @@ int main(int argc, char **argv) {
|
||||
bool cfi = true;
|
||||
bool handle_inter_cu_refs = true;
|
||||
bool log_to_stderr = false;
|
||||
std::string obj_name;
|
||||
const char* obj_os = "Linux";
|
||||
int arg_index = 1;
|
||||
while (arg_index < argc && strlen(argv[arg_index]) > 0 &&
|
||||
argv[arg_index][0] == '-') {
|
||||
@@ -70,6 +76,20 @@ int main(int argc, char **argv) {
|
||||
handle_inter_cu_refs = false;
|
||||
} else if (strcmp("-v", argv[arg_index]) == 0) {
|
||||
log_to_stderr = true;
|
||||
} else if (strcmp("-n", argv[arg_index]) == 0) {
|
||||
if (arg_index + 1 >= argc) {
|
||||
fprintf(stderr, "Missing argument to -n\n");
|
||||
return usage(argv[0]);
|
||||
}
|
||||
obj_name = argv[arg_index + 1];
|
||||
++arg_index;
|
||||
} else if (strcmp("-o", argv[arg_index]) == 0) {
|
||||
if (arg_index + 1 >= argc) {
|
||||
fprintf(stderr, "Missing argument to -o\n");
|
||||
return usage(argv[0]);
|
||||
}
|
||||
obj_os = argv[arg_index + 1];
|
||||
++arg_index;
|
||||
} else {
|
||||
printf("2.4 %s\n", argv[arg_index]);
|
||||
return usage(argv[0]);
|
||||
@@ -95,15 +115,19 @@ int main(int argc, char **argv) {
|
||||
debug_dirs.push_back(argv[debug_dir_index]);
|
||||
}
|
||||
|
||||
if (obj_name.empty())
|
||||
obj_name = binary;
|
||||
|
||||
if (header_only) {
|
||||
if (!WriteSymbolFileHeader(binary, std::cout)) {
|
||||
if (!WriteSymbolFileHeader(binary, obj_name, obj_os, 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)) {
|
||||
if (!WriteSymbolFile(binary, obj_name, obj_os, debug_dirs, options,
|
||||
std::cout)) {
|
||||
fprintf(saved_stderr, "Failed to write symbol file.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user