OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006, Google Inc. | |
2 // All rights reserved. | |
3 // | |
4 // Redistribution and use in source and binary forms, with or without | |
5 // modification, are permitted provided that the following conditions are | |
6 // met: | |
7 // | |
8 // * Redistributions of source code must retain the above copyright | |
9 // notice, this list of conditions and the following disclaimer. | |
10 // * Redistributions in binary form must reproduce the above | |
11 // copyright notice, this list of conditions and the following disclaimer | |
12 // in the documentation and/or other materials provided with the | |
13 // distribution. | |
14 // * Neither the name of Google Inc. nor the names of its | |
15 // contributors may be used to endorse or promote products derived from | |
16 // this software without specific prior written permission. | |
17 // | |
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | |
30 // dump_syms.h: Interface for DumpSymbols. This class will take a mach-o file | |
31 // and extract the symbol information and write it to a file using the | |
32 // breakpad symbol file format. | |
33 | |
34 #import <Foundation/Foundation.h> | |
35 #include <mach-o/loader.h> | |
36 #include "common/dwarf/dwarf2reader.h" | |
37 | |
38 // This will map from an architecture string to a SectionMap, which | |
39 // will contain the offsets for all the sections in the dictionary | |
40 typedef map<string, dwarf2reader::SectionMap *> ArchSectionMap; | |
41 | |
42 @interface DumpSymbols : NSObject { | |
43 @protected | |
44 NSString *sourcePath_; // Source of symbols (STRONG) | |
45 NSString *architecture_; // Architecture to extract (STRONG) | |
46 NSMutableDictionary *addresses_; // Addresses and symbols (STRONG) | |
47 NSMutableSet *functionAddresses_; // Function addresses (STRONG) | |
48 NSMutableDictionary *sources_; // Address and Source file paths (STRONG) | |
49 NSMutableDictionary *headers_; // Mach-o header information (STRONG) | |
50 NSMutableDictionary *sectionData_; // Keyed by seg/sect name (STRONG) | |
51 uint32_t lastStartAddress_; | |
52 ArchSectionMap *sectionsForArch_; | |
53 } | |
54 | |
55 - (id)initWithContentsOfFile:(NSString *)machoFile; | |
56 | |
57 - (NSArray *)availableArchitectures; | |
58 | |
59 // One of ppc, x86, i386, ppc64, x86_64 | |
60 // If the architecture is not available, it will return NO | |
61 // If not set, the native architecture will be used | |
62 - (BOOL)setArchitecture:(NSString *)architecture; | |
63 - (NSString *)architecture; | |
64 | |
65 // Write the symbols to |symbolFilePath|. Return YES if successful. | |
66 - (BOOL)writeSymbolFile:(NSString *)symbolFilePath; | |
67 | |
68 @end | |
69 | |
70 @interface MachSection : NSObject { | |
71 @protected | |
72 struct section *sect_; | |
73 uint32_t sectionNumber_; | |
74 } | |
75 - (id)initWithMachSection:(struct section *)sect andNumber:(uint32_t)sectionNumb
er; | |
76 - (struct section*)sectionPointer; | |
77 - (uint32_t)sectionNumber; | |
78 | |
79 @end | |
OLD | NEW |