mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-09 15:26:27 +00:00
Linux/Mac: Add option to omit the CFI section in dump_syms.
Review URL: http://breakpad.appspot.com/304001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@835 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2010, Google Inc.
|
||||
// Copyright (c) 2011, Google Inc.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -27,27 +27,47 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "common/linux/dump_symbols.h"
|
||||
|
||||
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);
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, " -c Do not generate CFI section\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2 || argc > 3) {
|
||||
fprintf(stderr, "Usage: %s <binary-with-debugging-info> "
|
||||
"[directory-for-debug-file]\n", argv[0]);
|
||||
return 1;
|
||||
if (argc < 2 || argc > 4)
|
||||
return usage(argv[0]);
|
||||
|
||||
bool cfi = true;
|
||||
if (strcmp("-c", argv[1]) == 0)
|
||||
cfi = false;
|
||||
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];
|
||||
}
|
||||
|
||||
const char *binary = argv[1];
|
||||
std::string debug_dir;
|
||||
if (argc == 3)
|
||||
debug_dir = argv[2];
|
||||
|
||||
if (!WriteSymbolFile(binary, debug_dir, std::cout)) {
|
||||
if (!WriteSymbolFile(binary, debug_dir, cfi, std::cout)) {
|
||||
fprintf(stderr, "Failed to write symbol file.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user