blob: 529f8e2b6557aad2c345aafd1659ab04ad565927 [file] [log] [blame]
Brian Carlstrom78128a62011-09-15 17:21:19 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#include <stdio.h>
4#include <stdlib.h>
5
Brian Carlstrom27ec9612011-09-19 20:20:38 -07006#include <fstream>
7#include <iostream>
Brian Carlstrom78128a62011-09-15 17:21:19 -07008#include <string>
9#include <vector>
10
11#include "class_linker.h"
Brian Carlstrom916e74e2011-09-23 11:42:01 -070012#include "file.h"
Brian Carlstrom78128a62011-09-15 17:21:19 -070013#include "image.h"
Brian Carlstrom916e74e2011-09-23 11:42:01 -070014#include "os.h"
Brian Carlstrom78128a62011-09-15 17:21:19 -070015#include "runtime.h"
16#include "space.h"
17#include "stringpiece.h"
Brian Carlstrom916e74e2011-09-23 11:42:01 -070018#include "unordered_map.h"
Brian Carlstrom78128a62011-09-15 17:21:19 -070019
20namespace art {
21
22static void usage() {
23 fprintf(stderr,
24 "Usage: oatdump [options] ...\n"
Brian Carlstrom58ae9412011-10-04 00:56:06 -070025 " Example: oatdump --image=$ANDROID_PRODUCT_OUT/system/framework/boot.art --host-prefix=$ANDROID_PRODUCT_OUT\n"
26 " Example: adb shell oatdump --image=/system/framework/boot.art\n"
Brian Carlstrom78128a62011-09-15 17:21:19 -070027 "\n");
28 fprintf(stderr,
Brian Carlstrome24fa612011-09-29 00:53:55 -070029 " --image=<file.art>: specifies the required input image filename.\n"
30 " Example: --image=/system/framework/boot.art\n"
31 "\n");
Brian Carlstrom78128a62011-09-15 17:21:19 -070032 fprintf(stderr,
Brian Carlstrome24fa612011-09-29 00:53:55 -070033 " --boot-image=<file.art>: provide the image file for the boot class path.\n"
34 " Example: --boot-image=/system/framework/boot.art\n"
Brian Carlstrom78128a62011-09-15 17:21:19 -070035 "\n");
Brian Carlstrome24fa612011-09-29 00:53:55 -070036 fprintf(stderr,
Brian Carlstrom58ae9412011-10-04 00:56:06 -070037 " --host-prefix may be used to translate host paths to target paths during\n"
38 " cross compilation.\n"
39 " Example: --host-prefix=out/target/product/crespo\n"
Brian Carlstrom78128a62011-09-15 17:21:19 -070040 "\n");
Brian Carlstrom27ec9612011-09-19 20:20:38 -070041 fprintf(stderr,
42 " --output=<file> may be used to send the output to a file.\n"
43 " Example: --output=/tmp/oatdump.txt\n"
44 "\n");
Brian Carlstrom78128a62011-09-15 17:21:19 -070045 exit(EXIT_FAILURE);
46}
47
Ian Rogersff1ed472011-09-20 13:46:24 -070048const char* image_roots_descriptions_[] = {
Brian Carlstrom78128a62011-09-15 17:21:19 -070049 "kJniStubArray",
Brian Carlstrome24fa612011-09-29 00:53:55 -070050 "kAbstractMethodErrorStubArray",
Ian Rogersad25ac52011-10-04 19:13:33 -070051 "kInstanceResolutionStubArray",
52 "kStaticResolutionStubArray",
Brian Carlstrome24fa612011-09-29 00:53:55 -070053 "kCalleeSaveMethod",
54 "kOatLocation",
Brian Carlstrom58ae9412011-10-04 00:56:06 -070055 "kDexCaches",
Brian Carlstrom34f426c2011-10-04 12:58:02 -070056 "kClassRoots",
Brian Carlstrom78128a62011-09-15 17:21:19 -070057};
58
Brian Carlstrom27ec9612011-09-19 20:20:38 -070059class OatDump {
Brian Carlstrom78128a62011-09-15 17:21:19 -070060
Brian Carlstrom27ec9612011-09-19 20:20:38 -070061 public:
Brian Carlstrom916e74e2011-09-23 11:42:01 -070062 static void Dump(const std::string& image_filename,
63 std::ostream& os,
64 Space& image_space,
65 const ImageHeader& image_header) {
Brian Carlstrom27ec9612011-09-19 20:20:38 -070066 os << "MAGIC:\n";
67 os << image_header.GetMagic() << "\n\n";
68
Brian Carlstrome24fa612011-09-29 00:53:55 -070069 os << "IMAGE BASE:\n";
70 os << reinterpret_cast<void*>(image_header.GetImageBaseAddr()) << "\n\n";
71
72 os << "OAT BASE:\n";
73 os << reinterpret_cast<void*>(image_header.GetOatBaseAddr()) << "\n\n";
Brian Carlstrom916e74e2011-09-23 11:42:01 -070074
Brian Carlstrom27ec9612011-09-19 20:20:38 -070075 os << "ROOTS:\n";
Elliott Hughes418d20f2011-09-22 14:00:39 -070076 CHECK_EQ(arraysize(image_roots_descriptions_), size_t(ImageHeader::kImageRootsMax));
Brian Carlstrom27ec9612011-09-19 20:20:38 -070077 for (int i = 0; i < ImageHeader::kImageRootsMax; i++) {
78 ImageHeader::ImageRoot image_root = static_cast<ImageHeader::ImageRoot>(i);
Brian Carlstrom34f426c2011-10-04 12:58:02 -070079 const char* image_root_description = image_roots_descriptions_[i];
80 Object* image_root_object = image_header.GetImageRoot(image_root);
81 os << StringPrintf("%s: %p\n", image_root_description, image_root_object);
82 if (image_root_object->IsObjectArray()) {
83 // TODO: replace down_cast with AsObjectArray (g++ currently has a problem with this)
84 ObjectArray<Object>* image_root_object_array
85 = down_cast<ObjectArray<Object>*>(image_root_object);
86 // = image_root_object->AsObjectArray<Object>();
87 for (int i = 0; i < image_root_object_array->GetLength(); i++) {
88 os << StringPrintf("\t%d: %p\n", i, image_root_object_array->Get(i));
89 }
90 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -070091 }
92 os << "\n";
93
94 os << "OBJECTS:\n" << std::flush;
95 OatDump state(image_space, os);
96 HeapBitmap* heap_bitmap = Heap::GetLiveBits();
97 DCHECK(heap_bitmap != NULL);
98 heap_bitmap->Walk(OatDump::Callback, &state);
Brian Carlstrom916e74e2011-09-23 11:42:01 -070099 os << "\n";
100
101 os << "STATS:\n" << std::flush;
102 UniquePtr<File> file(OS::OpenFile(image_filename.c_str(), false));
103 state.stats_.file_bytes = file->Length();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700104 size_t header_bytes = sizeof(ImageHeader);
105 state.stats_.header_bytes = header_bytes;
106 size_t alignment_bytes = RoundUp(header_bytes, kObjectAlignment) - header_bytes;
107 state.stats_.alignment_bytes += alignment_bytes;
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700108 state.stats_.Dump(os);
109
110 os << std::flush;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700111 }
112
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700113 private:
114
Elliott Hughesd1bb4f62011-09-23 14:09:45 -0700115 OatDump(const Space& dump_space, std::ostream& os) : dump_space_(dump_space), os_(os) {
116 }
117
118 ~OatDump() {
119 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700120
Brian Carlstrom78128a62011-09-15 17:21:19 -0700121 static void Callback(Object* obj, void* arg) {
122 DCHECK(obj != NULL);
123 DCHECK(arg != NULL);
124 OatDump* state = reinterpret_cast<OatDump*>(arg);
125 if (!state->InDumpSpace(obj)) {
126 return;
127 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700128
129 size_t object_bytes = obj->SizeOf();
130 size_t alignment_bytes = RoundUp(object_bytes, kObjectAlignment) - object_bytes;
131 state->stats_.object_bytes += object_bytes;
132 state->stats_.alignment_bytes += alignment_bytes;
133
Brian Carlstrom78128a62011-09-15 17:21:19 -0700134 std::string summary;
135 StringAppendF(&summary, "%p: ", obj);
136 if (obj->IsClass()) {
137 Class* klass = obj->AsClass();
138 StringAppendF(&summary, "CLASS %s", klass->GetDescriptor()->ToModifiedUtf8().c_str());
Brian Carlstrome10b6972011-09-26 13:49:03 -0700139 std::stringstream ss;
140 ss << " (" << klass->GetStatus() << ")";
141 summary += ss.str();
Brian Carlstrom78128a62011-09-15 17:21:19 -0700142 } else if (obj->IsMethod()) {
143 Method* method = obj->AsMethod();
144 StringAppendF(&summary, "METHOD %s", PrettyMethod(method).c_str());
145 } else if (obj->IsField()) {
146 Field* field = obj->AsField();
147 Class* type = field->GetType();
148 std::string type_string;
149 type_string += (type == NULL) ? "<UNKNOWN>" : type->GetDescriptor()->ToModifiedUtf8();
150 StringAppendF(&summary, "FIELD %s", PrettyField(field).c_str());
151 } else if (obj->IsArrayInstance()) {
152 StringAppendF(&summary, "ARRAY %d", obj->AsArray()->GetLength());
153 } else if (obj->IsString()) {
154 StringAppendF(&summary, "STRING %s", obj->AsString()->ToModifiedUtf8().c_str());
155 } else {
156 StringAppendF(&summary, "OBJECT");
157 }
158 StringAppendF(&summary, "\n");
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700159 std::string descriptor = obj->GetClass()->GetDescriptor()->ToModifiedUtf8();
160 StringAppendF(&summary, "\tclass %p: %s\n", obj->GetClass(), descriptor.c_str());
161 state->stats_.descriptor_to_bytes[descriptor] += object_bytes;
162 state->stats_.descriptor_to_count[descriptor] += 1;
163 // StringAppendF(&summary, "\tsize %d (alignment padding %d)\n",
164 // object_bytes, RoundUp(object_bytes, kObjectAlignment) - object_bytes);
Brian Carlstrom78128a62011-09-15 17:21:19 -0700165 if (obj->IsMethod()) {
166 Method* method = obj->AsMethod();
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700167 if (!method->IsPhony()) {
Brian Carlstrome10b6972011-09-26 13:49:03 -0700168 const ByteArray* code = method->GetCodeArray();
169 const int8_t* code_base = NULL;
170 const int8_t* code_limit = NULL;
171 if (code != NULL) {
172 size_t code_bytes = code->GetLength();
173 code_base = code->GetData();
174 code_limit = code_base + code_bytes;
175 if (method->IsNative()) {
176 state->stats_.managed_to_native_code_bytes += code_bytes;
177 } else {
178 state->stats_.managed_code_bytes += code_bytes;
179 }
Brian Carlstrome24fa612011-09-29 00:53:55 -0700180 } else {
181 code_base = reinterpret_cast<const int8_t*>(method->GetCode());
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700182 }
Brian Carlstrome10b6972011-09-26 13:49:03 -0700183 StringAppendF(&summary, "\tCODE %p-%p\n", code_base, code_limit);
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700184
Ian Rogersff1ed472011-09-20 13:46:24 -0700185 const ByteArray* invoke = method->GetInvokeStubArray();
Brian Carlstrome10b6972011-09-26 13:49:03 -0700186 const int8_t* invoke_base = NULL;
187 const int8_t* invoke_limit = NULL;
188 if (invoke != NULL) {
189 size_t native_to_managed_code_bytes = invoke->GetLength();
190 invoke_base = invoke->GetData();
191 invoke_limit = invoke_base + native_to_managed_code_bytes;
192 state->stats_.native_to_managed_code_bytes += native_to_managed_code_bytes;
193 StringAppendF(&summary, "\tJNI STUB %p-%p\n", invoke_base, invoke_limit);
194 }
Ian Rogersff1ed472011-09-20 13:46:24 -0700195 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700196 if (method->IsNative()) {
197 if (method->IsRegistered()) {
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700198 StringAppendF(&summary, "\tNATIVE REGISTERED %p\n", method->GetNativeMethod());
Brian Carlstrom78128a62011-09-15 17:21:19 -0700199 } else {
200 StringAppendF(&summary, "\tNATIVE UNREGISTERED\n");
201 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700202 DCHECK(method->GetRegisterMapHeader() == NULL);
203 DCHECK(method->GetRegisterMapData() == NULL);
204 DCHECK(method->GetMappingTable() == NULL);
205 } else if (method->IsAbstract()) {
206 StringAppendF(&summary, "\tABSTRACT\n");
207 DCHECK(method->GetRegisterMapHeader() == NULL);
208 DCHECK(method->GetRegisterMapData() == NULL);
209 DCHECK(method->GetMappingTable() == NULL);
210 } else if (method->IsPhony()) {
211 StringAppendF(&summary, "\tPHONY\n");
212 DCHECK(method->GetRegisterMapHeader() == NULL);
213 DCHECK(method->GetRegisterMapData() == NULL);
214 DCHECK(method->GetMappingTable() == NULL);
215 } else {
216 size_t register_map_bytes = (method->GetRegisterMapHeader()->GetLength() +
217 method->GetRegisterMapData()->GetLength());
218 state->stats_.register_map_bytes += register_map_bytes;
219
Brian Carlstrome10b6972011-09-26 13:49:03 -0700220 if (method->GetMappingTable() != NULL) {
221 size_t pc_mapping_table_bytes = method->GetMappingTable()->GetLength();
222 state->stats_.pc_mapping_table_bytes += pc_mapping_table_bytes;
223 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700224
225 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
226 class DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache();
227 const DexFile& dex_file = class_linker->FindDexFile(dex_cache);
228 const DexFile::CodeItem* code_item = dex_file.GetCodeItem(method->GetCodeItemOffset());
229 size_t dex_instruction_bytes = code_item->insns_size_ * 2;
230 state->stats_.dex_instruction_bytes += dex_instruction_bytes;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700231 }
232 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700233 state->os_ << summary << std::flush;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700234 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700235
236 bool InDumpSpace(const Object* object) {
237 const byte* o = reinterpret_cast<const byte*>(object);
238 return (o >= dump_space_.GetBase() && o < dump_space_.GetLimit());
239 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700240
241 public:
242 struct Stats {
243 size_t file_bytes;
244
245 size_t header_bytes;
246 size_t object_bytes;
247 size_t alignment_bytes;
248
249 size_t managed_code_bytes;
250 size_t managed_to_native_code_bytes;
251 size_t native_to_managed_code_bytes;
252
253 size_t register_map_bytes;
254 size_t pc_mapping_table_bytes;
255
256 size_t dex_instruction_bytes;
257
258 Stats()
259 : file_bytes(0),
260 header_bytes(0),
261 object_bytes(0),
262 alignment_bytes(0),
263 managed_code_bytes(0),
264 managed_to_native_code_bytes(0),
265 native_to_managed_code_bytes(0),
266 register_map_bytes(0),
267 pc_mapping_table_bytes(0),
268 dex_instruction_bytes(0) {}
269
270 typedef std::tr1::unordered_map<std::string,size_t> TableBytes;
271 TableBytes descriptor_to_bytes;
272
273 typedef std::tr1::unordered_map<std::string,size_t> TableCount;
274 TableCount descriptor_to_count;
275
276 double PercentOfFileBytes(size_t size) {
277 return (static_cast<double>(size) / static_cast<double>(file_bytes)) * 100;
278 }
279
280 double PercentOfObjectBytes(size_t size) {
281 return (static_cast<double>(size) / static_cast<double>(object_bytes)) * 100;
282 }
283
284 void Dump(std::ostream& os) {
285 os << StringPrintf("\tfile_bytes = %d\n", file_bytes);
286 os << "\n";
287
288 os << "\tfile_bytes = header_bytes + object_bytes + alignment_bytes\n";
289 os << StringPrintf("\theader_bytes = %10d (%2.0f%% of file_bytes)\n",
290 header_bytes, PercentOfFileBytes(header_bytes));
291 os << StringPrintf("\tobject_bytes = %10d (%2.0f%% of file_bytes)\n",
292 object_bytes, PercentOfFileBytes(object_bytes));
293 os << StringPrintf("\talignment_bytes = %10d (%2.0f%% of file_bytes)\n",
294 alignment_bytes, PercentOfFileBytes(alignment_bytes));
295 os << "\n";
296 os << std::flush;
297 CHECK_EQ(file_bytes, header_bytes + object_bytes + alignment_bytes);
298
299 os << "\tobject_bytes = sum of descriptor_to_bytes values below:\n";
300 size_t object_bytes_total = 0;
301 typedef TableBytes::const_iterator It; // TODO: C++0x auto
302 for (It it = descriptor_to_bytes.begin(), end = descriptor_to_bytes.end(); it != end; ++it) {
303 const std::string& descriptor = it->first;
304 size_t bytes = it->second;
305 size_t count = descriptor_to_count[descriptor];
306 double average = static_cast<double>(bytes) / static_cast<double>(count);
307 double percent = PercentOfObjectBytes(bytes);
Brian Carlstromf153fe12011-09-27 16:27:12 -0700308 os << StringPrintf("\t%32s %8d bytes %6d instances "
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700309 "(%3.0f bytes/instance) %2.0f%% of object_bytes\n",
310 descriptor.c_str(), bytes, count,
311 average, percent);
312
313 object_bytes_total += bytes;
314 }
315 os << "\n";
316 os << std::flush;
317 CHECK_EQ(object_bytes, object_bytes_total);
318
319 os << StringPrintf("\tmanaged_code_bytes = %8d (%2.0f%% of object_bytes)\n",
320 managed_code_bytes, PercentOfObjectBytes(managed_code_bytes));
321 os << StringPrintf("\tmanaged_to_native_code_bytes = %8d (%2.0f%% of object_bytes)\n",
322 managed_to_native_code_bytes,
323 PercentOfObjectBytes(managed_to_native_code_bytes));
324 os << StringPrintf("\tnative_to_managed_code_bytes = %8d (%2.0f%% of object_bytes)\n",
325 native_to_managed_code_bytes,
326 PercentOfObjectBytes(native_to_managed_code_bytes));
327 os << "\n";
328 os << std::flush;
329
330 os << StringPrintf("\tregister_map_bytes = %7d (%2.0f%% of object_bytes)\n",
331 register_map_bytes, PercentOfObjectBytes(register_map_bytes));
332 os << StringPrintf("\tpc_mapping_table_bytes = %7d (%2.0f%% of object_bytes)\n",
333 pc_mapping_table_bytes, PercentOfObjectBytes(pc_mapping_table_bytes));
334 os << "\n";
335 os << std::flush;
336
337 os << StringPrintf("\tdex_instruction_bytes = %d\n", dex_instruction_bytes);
338 os << StringPrintf("\tmanaged_code_bytes expansion = %.2f\n",
339 static_cast<double>(managed_code_bytes)
340 / static_cast<double>(dex_instruction_bytes));
341 os << "\n";
342 os << std::flush;
343
344 }
345 } stats_;
346
347 private:
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700348 const Space& dump_space_;
349 std::ostream& os_;
Elliott Hughesd1bb4f62011-09-23 14:09:45 -0700350
351 DISALLOW_COPY_AND_ASSIGN(OatDump);
Brian Carlstrom78128a62011-09-15 17:21:19 -0700352};
353
354int oatdump(int argc, char** argv) {
355 // Skip over argv[0].
356 argv++;
357 argc--;
358
359 if (argc == 0) {
360 fprintf(stderr, "no arguments specified\n");
361 usage();
362 }
363
Brian Carlstrom78128a62011-09-15 17:21:19 -0700364 const char* image_filename = NULL;
365 const char* boot_image_filename = NULL;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700366 std::string host_prefix;
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700367 std::ostream* os = &std::cout;
368 UniquePtr<std::ofstream> out;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700369
370 for (int i = 0; i < argc; i++) {
371 const StringPiece option(argv[i]);
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700372 if (option.starts_with("--image=")) {
Brian Carlstrom78128a62011-09-15 17:21:19 -0700373 image_filename = option.substr(strlen("--image=")).data();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700374 } else if (option.starts_with("--boot-image=")) {
375 boot_image_filename = option.substr(strlen("--boot-image=")).data();
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700376 } else if (option.starts_with("--host-prefix=")) {
377 host_prefix = option.substr(strlen("--host-prefix=")).data();
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700378 } else if (option.starts_with("--output=")) {
379 const char* filename = option.substr(strlen("--output=")).data();
380 out.reset(new std::ofstream(filename));
381 if (!out->good()) {
382 fprintf(stderr, "failed to open output filename %s\n", filename);
383 usage();
384 }
385 os = out.get();
Brian Carlstrom78128a62011-09-15 17:21:19 -0700386 } else {
387 fprintf(stderr, "unknown argument %s\n", option.data());
388 usage();
389 }
390 }
391
392 if (image_filename == NULL) {
393 fprintf(stderr, "--image file name not specified\n");
394 return EXIT_FAILURE;
395 }
396
Brian Carlstrom78128a62011-09-15 17:21:19 -0700397 Runtime::Options options;
398 std::string image_option;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700399 std::string oat_option;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700400 std::string boot_image_option;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700401 std::string boot_oat_option;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700402 if (boot_image_filename != NULL) {
403 boot_image_option += "-Ximage:";
404 boot_image_option += boot_image_filename;
405 options.push_back(std::make_pair(boot_image_option.c_str(), reinterpret_cast<void*>(NULL)));
Brian Carlstrom78128a62011-09-15 17:21:19 -0700406 }
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700407 image_option += "-Ximage:";
408 image_option += image_filename;
409 options.push_back(std::make_pair(image_option.c_str(), reinterpret_cast<void*>(NULL)));
410
411 if (!host_prefix.empty()) {
412 options.push_back(std::make_pair("host-prefix", host_prefix.c_str()));
413 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700414
415 UniquePtr<Runtime> runtime(Runtime::Create(options, false));
416 if (runtime.get() == NULL) {
417 fprintf(stderr, "could not create runtime\n");
418 return EXIT_FAILURE;
419 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700420
421 Space* image_space = Heap::GetSpaces()[Heap::GetSpaces().size()-2];
422 CHECK(image_space != NULL);
423 const ImageHeader& image_header = image_space->GetImageHeader();
424 if (!image_header.IsValid()) {
425 fprintf(stderr, "invalid image header %s\n", image_filename);
426 return EXIT_FAILURE;
427 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700428 OatDump::Dump(image_filename, *os, *image_space, image_header);
Brian Carlstrom78128a62011-09-15 17:21:19 -0700429 return EXIT_SUCCESS;
430}
431
432} // namespace art
433
434int main(int argc, char** argv) {
435 return art::oatdump(argc, argv);
436}