Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: class-dump/src/deprotect.m

Issue 7793008: Add the 3.3.3 sources for class-dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « class-dump/src/class-dump_Prefix.pch ('k') | class-dump/src/dyld-info-compat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: class-dump/src/deprotect.m
===================================================================
--- class-dump/src/deprotect.m (revision 0)
+++ class-dump/src/deprotect.m (revision 0)
@@ -0,0 +1,102 @@
+// -*- mode: ObjC -*-
+
+// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
+// Copyright (C) 1997-1998, 2000-2001, 2004-2010 Steve Nygard.
+
+#include <stdio.h>
+#include <libc.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <stdlib.h>
+
+#import <Foundation/Foundation.h>
+#import "NSString-Extensions.h"
+
+#import "CDClassDump.h"
+#import "CDMachOFile.h"
+
+void print_usage(void)
+{
+ fprintf(stderr,
+ "deprotect %s\n"
+ "Usage: deprotect [options] <input file> <output file>\n"
+ "\n"
+ " where options are:\n"
+ " (none)\n"
+ ,
+ CLASS_DUMP_VERSION
+ );
+}
+
+enum {
+ CDFormatIvar = 0,
+ CDFormatMethod = 1,
+ CDFormatBalance = 2,
+};
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ int ch;
+ BOOL errorFlag = NO;
+
+ struct option longopts[] = {
+ { NULL, 0, NULL, 0 },
+ };
+
+ if (argc == 1) {
+ print_usage();
+ exit(0);
+ }
+
+ while ( (ch = getopt_long(argc, argv, "", longopts, NULL)) != -1) {
+ switch (ch) {
+ case '?':
+ default:
+ errorFlag = YES;
+ break;
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (errorFlag || argc < 2) {
+ print_usage();
+ exit(2);
+ }
+
+ {
+ NSString *inputFile, *outputFile;
+ CDFile *file;
+ NSData *inputData;
+
+ inputFile = [NSString stringWithFileSystemRepresentation:argv[0]];
+ outputFile = [NSString stringWithFileSystemRepresentation:argv[1]];
+
+ NSLog(@"inputFile: %@", inputFile);
+ NSLog(@"outputFile: %@", outputFile);
+
+ inputData = [[NSData alloc] initWithContentsOfMappedFile:inputFile];
+
+ file = [CDFile fileWithData:inputData filename:inputFile searchPathState:nil];
+ if (file == nil) {
+ fprintf(stderr, "deprotect: Input file (%s) is neither a Mach-O file nor a fat archive.\n", [inputFile UTF8String]);
+ exit(1);
+ }
+
+ if ([file isKindOfClass:[CDMachOFile class]]) {
+ NSLog(@"file: %@", file);
+ [(CDMachOFile *)file saveDeprotectedFileToPath:outputFile];
+ } else {
+ NSLog(@"Can only deprotect thin mach-o files at this point.");
+ }
+
+ [inputData release];
+ }
+
+ [pool release];
+
+ return 0;
+}
Property changes on: class-dump/src/deprotect.m
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « class-dump/src/class-dump_Prefix.pch ('k') | class-dump/src/dyld-info-compat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698