Index: src/tools/mac/dump_syms/dump_syms_tool.cc |
diff --git a/src/tools/mac/dump_syms/dump_syms_tool.mm b/src/tools/mac/dump_syms/dump_syms_tool.cc |
similarity index 92% |
rename from src/tools/mac/dump_syms/dump_syms_tool.mm |
rename to src/tools/mac/dump_syms/dump_syms_tool.cc |
index 7d56809a885ebf92cc7ac9ac1133ac389fe64409..54f29226116dfc4669b434d4a892d01080d6f421 100644 |
--- a/src/tools/mac/dump_syms/dump_syms_tool.mm |
+++ b/src/tools/mac/dump_syms/dump_syms_tool.cc |
@@ -29,12 +29,13 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// dump_syms_tool.mm: Command line tool that uses the DumpSymbols class. |
+// dump_syms_tool.cc: Command line tool that uses the DumpSymbols class. |
// TODO(waylonis): accept stdin |
#include <mach-o/arch.h> |
#include <unistd.h> |
+#include <algorithm> |
#include <iostream> |
#include <vector> |
@@ -51,8 +52,9 @@ using std::vector; |
struct Options { |
Options() |
: srcPath(), dsymPath(), arch(), cfi(true), handle_inter_cu_refs(true) {} |
- NSString *srcPath; |
- NSString *dsymPath; |
+ |
+ string srcPath; |
+ string dsymPath; |
const NXArchInfo *arch; |
bool cfi; |
bool handle_inter_cu_refs; |
@@ -114,8 +116,10 @@ static bool Start(const Options &options) { |
// requested, then consider the Module as "split" and dump all the debug data |
// from the primary debug info file, the dSYM, and then dump additional CFI |
// data from the source Mach-O file. |
- bool split_module = options.dsymPath && options.srcPath && options.cfi; |
- NSString* primary_file = split_module ? options.dsymPath : options.srcPath; |
+ bool split_module = |
+ !options.dsymPath.empty() && !options.srcPath.empty() && options.cfi; |
+ const string& primary_file = |
+ split_module ? options.dsymPath : options.srcPath; |
if (!dump_symbols.Read(primary_file)) |
return false; |
@@ -124,7 +128,7 @@ static bool Start(const Options &options) { |
if (!dump_symbols.SetArchitecture(options.arch->cputype, |
options.arch->cpusubtype)) { |
fprintf(stderr, "%s: no architecture '%s' is present in file.\n", |
- [primary_file fileSystemRepresentation], options.arch->name); |
+ primary_file.c_str(), options.arch->name); |
size_t available_size; |
const SuperFatArch *available = |
dump_symbols.AvailableArchitectures(&available_size); |
@@ -214,8 +218,7 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { |
break; |
} |
case 'g': |
- options->dsymPath = [[NSFileManager defaultManager] |
- stringWithFileSystemRepresentation:optarg length:strlen(optarg)]; |
+ options->dsymPath = optarg; |
break; |
case 'c': |
options->cfi = false; |
@@ -237,21 +240,16 @@ static void SetupOptions(int argc, const char *argv[], Options *options) { |
exit(1); |
} |
- options->srcPath = [[NSFileManager defaultManager] |
- stringWithFileSystemRepresentation:argv[optind] |
- length:strlen(argv[optind])]; |
+ options->srcPath = argv[optind]; |
} |
//============================================================================= |
int main (int argc, const char * argv[]) { |
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
Options options; |
bool result; |
SetupOptions(argc, argv, &options); |
result = Start(options); |
- [pool release]; |
- |
return !result; |
} |