aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-09-14 01:02:55 +0000
committerthestig@chromium.org <thestig@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-09-14 01:02:55 +0000
commit8d54c7509234e9a4918046c12dcb138489f06990 (patch)
tree3da356f2f0b5d4b281cb6394a8064fbee5fdd756 /src/tools
parentRemove javascript_engine GYP variable. (diff)
downloadbreakpad-8d54c7509234e9a4918046c12dcb138489f06990.tar.xz
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
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/linux/dump_syms/dump_syms.cc42
-rw-r--r--src/tools/mac/dump_syms/dump_syms_tool.mm21
2 files changed, 44 insertions, 19 deletions
diff --git a/src/tools/linux/dump_syms/dump_syms.cc b/src/tools/linux/dump_syms/dump_syms.cc
index f4c05cfc..adac216c 100644
--- a/src/tools/linux/dump_syms/dump_syms.cc
+++ b/src/tools/linux/dump_syms/dump_syms.cc
@@ -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]);
- const char *binary = argv[1];
+ 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 (argc == 3)
- debug_dir = argv[2];
+ if (cfi) {
+ binary = argv[1];
+ if (argc == 3)
+ debug_dir = argv[2];
+ } else {
+ binary = argv[2];
+ if (argc == 4)
+ debug_dir = argv[3];
+ }
- 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;
}
diff --git a/src/tools/mac/dump_syms/dump_syms_tool.mm b/src/tools/mac/dump_syms/dump_syms_tool.mm
index 3f1f03b6..92ebf211 100644
--- a/src/tools/mac/dump_syms/dump_syms_tool.mm
+++ b/src/tools/mac/dump_syms/dump_syms_tool.mm
@@ -1,6 +1,6 @@
// -*- mode: c++ -*-
-// Copyright (c) 2006, Google Inc.
+// Copyright (c) 2011, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -45,9 +45,10 @@ using google_breakpad::DumpSymbols;
using std::vector;
struct Options {
- Options() : srcPath(), arch() { }
+ Options() : srcPath(), arch(), cfi(true) { }
NSString *srcPath;
const NXArchInfo *arch;
+ bool cfi;
};
//=============================================================================
@@ -82,17 +83,18 @@ static bool Start(const Options &options) {
return false;
}
}
-
- return dump_symbols.WriteSymbolFile(std::cout);
+
+ return dump_symbols.WriteSymbolFile(std::cout, options.cfi);
}
//=============================================================================
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] <Mach-o file>\n",
+ fprintf(stderr, "Usage: %s [-a ARCHITECTURE] [-c] <Mach-o file>\n",
argv[0]);
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-c: Do not generate CFI section\n");
fprintf(stderr, "\t-h: Usage\n");
fprintf(stderr, "\t-?: Usage\n");
}
@@ -102,7 +104,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
extern int optind;
signed char ch;
- while ((ch = getopt(argc, (char * const *)argv, "a:h?")) != -1) {
+ while ((ch = getopt(argc, (char * const *)argv, "a:ch?")) != -1) {
switch (ch) {
case 'a': {
const NXArchInfo *arch_info = NXGetArchInfoFromName(optarg);
@@ -114,6 +116,9 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
options->arch = arch_info;
break;
}
+ case 'c':
+ options->cfi = false;
+ break;
case '?':
case 'h':
Usage(argc, argv);
@@ -121,7 +126,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
break;
}
}
-
+
if ((argc - optind) != 1) {
fprintf(stderr, "Must specify Mach-o file\n");
Usage(argc, argv);
@@ -137,7 +142,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) {
int main (int argc, const char * argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Options options;
- bool result;
+ bool result;
SetupOptions(argc, argv, &options);
result = Start(options);