blob: 27dbdee8c23eef2dc430580f3bfc14407ce0ae48 [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",
Ian Rogers1cb0a1d2011-10-06 15:24:35 -070053 "kUnknownMethodResolutionStubArray",
Brian Carlstrome24fa612011-09-29 00:53:55 -070054 "kCalleeSaveMethod",
55 "kOatLocation",
Brian Carlstrom58ae9412011-10-04 00:56:06 -070056 "kDexCaches",
Brian Carlstrom34f426c2011-10-04 12:58:02 -070057 "kClassRoots",
Brian Carlstrom78128a62011-09-15 17:21:19 -070058};
59
Brian Carlstrom27ec9612011-09-19 20:20:38 -070060class OatDump {
Brian Carlstrom78128a62011-09-15 17:21:19 -070061
Brian Carlstrom27ec9612011-09-19 20:20:38 -070062 public:
Brian Carlstrom916e74e2011-09-23 11:42:01 -070063 static void Dump(const std::string& image_filename,
64 std::ostream& os,
65 Space& image_space,
66 const ImageHeader& image_header) {
Brian Carlstrom27ec9612011-09-19 20:20:38 -070067 os << "MAGIC:\n";
68 os << image_header.GetMagic() << "\n\n";
69
Brian Carlstrome24fa612011-09-29 00:53:55 -070070 os << "IMAGE BASE:\n";
71 os << reinterpret_cast<void*>(image_header.GetImageBaseAddr()) << "\n\n";
72
73 os << "OAT BASE:\n";
74 os << reinterpret_cast<void*>(image_header.GetOatBaseAddr()) << "\n\n";
Brian Carlstrom916e74e2011-09-23 11:42:01 -070075
Brian Carlstrom27ec9612011-09-19 20:20:38 -070076 os << "ROOTS:\n";
Elliott Hughes418d20f2011-09-22 14:00:39 -070077 CHECK_EQ(arraysize(image_roots_descriptions_), size_t(ImageHeader::kImageRootsMax));
Brian Carlstrom27ec9612011-09-19 20:20:38 -070078 for (int i = 0; i < ImageHeader::kImageRootsMax; i++) {
79 ImageHeader::ImageRoot image_root = static_cast<ImageHeader::ImageRoot>(i);
Brian Carlstrom34f426c2011-10-04 12:58:02 -070080 const char* image_root_description = image_roots_descriptions_[i];
81 Object* image_root_object = image_header.GetImageRoot(image_root);
82 os << StringPrintf("%s: %p\n", image_root_description, image_root_object);
83 if (image_root_object->IsObjectArray()) {
84 // TODO: replace down_cast with AsObjectArray (g++ currently has a problem with this)
85 ObjectArray<Object>* image_root_object_array
86 = down_cast<ObjectArray<Object>*>(image_root_object);
87 // = image_root_object->AsObjectArray<Object>();
88 for (int i = 0; i < image_root_object_array->GetLength(); i++) {
89 os << StringPrintf("\t%d: %p\n", i, image_root_object_array->Get(i));
90 }
91 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -070092 }
93 os << "\n";
94
95 os << "OBJECTS:\n" << std::flush;
96 OatDump state(image_space, os);
97 HeapBitmap* heap_bitmap = Heap::GetLiveBits();
98 DCHECK(heap_bitmap != NULL);
99 heap_bitmap->Walk(OatDump::Callback, &state);
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700100 os << "\n";
101
102 os << "STATS:\n" << std::flush;
103 UniquePtr<File> file(OS::OpenFile(image_filename.c_str(), false));
104 state.stats_.file_bytes = file->Length();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700105 size_t header_bytes = sizeof(ImageHeader);
106 state.stats_.header_bytes = header_bytes;
107 size_t alignment_bytes = RoundUp(header_bytes, kObjectAlignment) - header_bytes;
108 state.stats_.alignment_bytes += alignment_bytes;
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700109 state.stats_.Dump(os);
110
111 os << std::flush;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700112 }
113
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700114 private:
115
Elliott Hughesd1bb4f62011-09-23 14:09:45 -0700116 OatDump(const Space& dump_space, std::ostream& os) : dump_space_(dump_space), os_(os) {
117 }
118
119 ~OatDump() {
120 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700121
Brian Carlstrom78128a62011-09-15 17:21:19 -0700122 static void Callback(Object* obj, void* arg) {
123 DCHECK(obj != NULL);
124 DCHECK(arg != NULL);
125 OatDump* state = reinterpret_cast<OatDump*>(arg);
126 if (!state->InDumpSpace(obj)) {
127 return;
128 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700129
130 size_t object_bytes = obj->SizeOf();
131 size_t alignment_bytes = RoundUp(object_bytes, kObjectAlignment) - object_bytes;
132 state->stats_.object_bytes += object_bytes;
133 state->stats_.alignment_bytes += alignment_bytes;
134
Brian Carlstrom78128a62011-09-15 17:21:19 -0700135 std::string summary;
136 StringAppendF(&summary, "%p: ", obj);
137 if (obj->IsClass()) {
138 Class* klass = obj->AsClass();
139 StringAppendF(&summary, "CLASS %s", klass->GetDescriptor()->ToModifiedUtf8().c_str());
Brian Carlstrome10b6972011-09-26 13:49:03 -0700140 std::stringstream ss;
141 ss << " (" << klass->GetStatus() << ")";
142 summary += ss.str();
Brian Carlstrom78128a62011-09-15 17:21:19 -0700143 } else if (obj->IsMethod()) {
144 Method* method = obj->AsMethod();
145 StringAppendF(&summary, "METHOD %s", PrettyMethod(method).c_str());
146 } else if (obj->IsField()) {
147 Field* field = obj->AsField();
148 Class* type = field->GetType();
149 std::string type_string;
150 type_string += (type == NULL) ? "<UNKNOWN>" : type->GetDescriptor()->ToModifiedUtf8();
151 StringAppendF(&summary, "FIELD %s", PrettyField(field).c_str());
152 } else if (obj->IsArrayInstance()) {
153 StringAppendF(&summary, "ARRAY %d", obj->AsArray()->GetLength());
154 } else if (obj->IsString()) {
155 StringAppendF(&summary, "STRING %s", obj->AsString()->ToModifiedUtf8().c_str());
156 } else {
157 StringAppendF(&summary, "OBJECT");
158 }
159 StringAppendF(&summary, "\n");
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700160 std::string descriptor = obj->GetClass()->GetDescriptor()->ToModifiedUtf8();
161 StringAppendF(&summary, "\tclass %p: %s\n", obj->GetClass(), descriptor.c_str());
162 state->stats_.descriptor_to_bytes[descriptor] += object_bytes;
163 state->stats_.descriptor_to_count[descriptor] += 1;
164 // StringAppendF(&summary, "\tsize %d (alignment padding %d)\n",
165 // object_bytes, RoundUp(object_bytes, kObjectAlignment) - object_bytes);
Brian Carlstrom78128a62011-09-15 17:21:19 -0700166 if (obj->IsMethod()) {
167 Method* method = obj->AsMethod();
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700168 if (!method->IsPhony()) {
Brian Carlstrome10b6972011-09-26 13:49:03 -0700169 const ByteArray* code = method->GetCodeArray();
170 const int8_t* code_base = NULL;
171 const int8_t* code_limit = NULL;
172 if (code != NULL) {
173 size_t code_bytes = code->GetLength();
174 code_base = code->GetData();
175 code_limit = code_base + code_bytes;
176 if (method->IsNative()) {
177 state->stats_.managed_to_native_code_bytes += code_bytes;
178 } else {
179 state->stats_.managed_code_bytes += code_bytes;
180 }
Brian Carlstrome24fa612011-09-29 00:53:55 -0700181 } else {
182 code_base = reinterpret_cast<const int8_t*>(method->GetCode());
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700183 }
Brian Carlstrome10b6972011-09-26 13:49:03 -0700184 StringAppendF(&summary, "\tCODE %p-%p\n", code_base, code_limit);
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700185
Ian Rogersff1ed472011-09-20 13:46:24 -0700186 const ByteArray* invoke = method->GetInvokeStubArray();
Brian Carlstrome10b6972011-09-26 13:49:03 -0700187 const int8_t* invoke_base = NULL;
188 const int8_t* invoke_limit = NULL;
189 if (invoke != NULL) {
190 size_t native_to_managed_code_bytes = invoke->GetLength();
191 invoke_base = invoke->GetData();
192 invoke_limit = invoke_base + native_to_managed_code_bytes;
193 state->stats_.native_to_managed_code_bytes += native_to_managed_code_bytes;
194 StringAppendF(&summary, "\tJNI STUB %p-%p\n", invoke_base, invoke_limit);
195 }
Ian Rogersff1ed472011-09-20 13:46:24 -0700196 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700197 if (method->IsNative()) {
198 if (method->IsRegistered()) {
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700199 StringAppendF(&summary, "\tNATIVE REGISTERED %p\n", method->GetNativeMethod());
Brian Carlstrom78128a62011-09-15 17:21:19 -0700200 } else {
201 StringAppendF(&summary, "\tNATIVE UNREGISTERED\n");
202 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700203 DCHECK(method->GetRegisterMapHeader() == NULL);
204 DCHECK(method->GetRegisterMapData() == NULL);
205 DCHECK(method->GetMappingTable() == NULL);
206 } else if (method->IsAbstract()) {
207 StringAppendF(&summary, "\tABSTRACT\n");
208 DCHECK(method->GetRegisterMapHeader() == NULL);
209 DCHECK(method->GetRegisterMapData() == NULL);
210 DCHECK(method->GetMappingTable() == NULL);
211 } else if (method->IsPhony()) {
212 StringAppendF(&summary, "\tPHONY\n");
213 DCHECK(method->GetRegisterMapHeader() == NULL);
214 DCHECK(method->GetRegisterMapData() == NULL);
215 DCHECK(method->GetMappingTable() == NULL);
216 } else {
217 size_t register_map_bytes = (method->GetRegisterMapHeader()->GetLength() +
218 method->GetRegisterMapData()->GetLength());
219 state->stats_.register_map_bytes += register_map_bytes;
220
Brian Carlstrome10b6972011-09-26 13:49:03 -0700221 if (method->GetMappingTable() != NULL) {
222 size_t pc_mapping_table_bytes = method->GetMappingTable()->GetLength();
223 state->stats_.pc_mapping_table_bytes += pc_mapping_table_bytes;
224 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700225
226 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
227 class DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache();
228 const DexFile& dex_file = class_linker->FindDexFile(dex_cache);
229 const DexFile::CodeItem* code_item = dex_file.GetCodeItem(method->GetCodeItemOffset());
230 size_t dex_instruction_bytes = code_item->insns_size_ * 2;
231 state->stats_.dex_instruction_bytes += dex_instruction_bytes;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700232 }
233 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700234 state->os_ << summary << std::flush;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700235 }
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700236
237 bool InDumpSpace(const Object* object) {
238 const byte* o = reinterpret_cast<const byte*>(object);
239 return (o >= dump_space_.GetBase() && o < dump_space_.GetLimit());
240 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700241
242 public:
243 struct Stats {
244 size_t file_bytes;
245
246 size_t header_bytes;
247 size_t object_bytes;
248 size_t alignment_bytes;
249
250 size_t managed_code_bytes;
251 size_t managed_to_native_code_bytes;
252 size_t native_to_managed_code_bytes;
253
254 size_t register_map_bytes;
255 size_t pc_mapping_table_bytes;
256
257 size_t dex_instruction_bytes;
258
259 Stats()
260 : file_bytes(0),
261 header_bytes(0),
262 object_bytes(0),
263 alignment_bytes(0),
264 managed_code_bytes(0),
265 managed_to_native_code_bytes(0),
266 native_to_managed_code_bytes(0),
267 register_map_bytes(0),
268 pc_mapping_table_bytes(0),
269 dex_instruction_bytes(0) {}
270
271 typedef std::tr1::unordered_map<std::string,size_t> TableBytes;
272 TableBytes descriptor_to_bytes;
273
274 typedef std::tr1::unordered_map<std::string,size_t> TableCount;
275 TableCount descriptor_to_count;
276
277 double PercentOfFileBytes(size_t size) {
278 return (static_cast<double>(size) / static_cast<double>(file_bytes)) * 100;
279 }
280
281 double PercentOfObjectBytes(size_t size) {
282 return (static_cast<double>(size) / static_cast<double>(object_bytes)) * 100;
283 }
284
285 void Dump(std::ostream& os) {
286 os << StringPrintf("\tfile_bytes = %d\n", file_bytes);
287 os << "\n";
288
289 os << "\tfile_bytes = header_bytes + object_bytes + alignment_bytes\n";
290 os << StringPrintf("\theader_bytes = %10d (%2.0f%% of file_bytes)\n",
291 header_bytes, PercentOfFileBytes(header_bytes));
292 os << StringPrintf("\tobject_bytes = %10d (%2.0f%% of file_bytes)\n",
293 object_bytes, PercentOfFileBytes(object_bytes));
294 os << StringPrintf("\talignment_bytes = %10d (%2.0f%% of file_bytes)\n",
295 alignment_bytes, PercentOfFileBytes(alignment_bytes));
296 os << "\n";
297 os << std::flush;
298 CHECK_EQ(file_bytes, header_bytes + object_bytes + alignment_bytes);
299
300 os << "\tobject_bytes = sum of descriptor_to_bytes values below:\n";
301 size_t object_bytes_total = 0;
302 typedef TableBytes::const_iterator It; // TODO: C++0x auto
303 for (It it = descriptor_to_bytes.begin(), end = descriptor_to_bytes.end(); it != end; ++it) {
304 const std::string& descriptor = it->first;
305 size_t bytes = it->second;
306 size_t count = descriptor_to_count[descriptor];
307 double average = static_cast<double>(bytes) / static_cast<double>(count);
308 double percent = PercentOfObjectBytes(bytes);
Brian Carlstromf153fe12011-09-27 16:27:12 -0700309 os << StringPrintf("\t%32s %8d bytes %6d instances "
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700310 "(%3.0f bytes/instance) %2.0f%% of object_bytes\n",
311 descriptor.c_str(), bytes, count,
312 average, percent);
313
314 object_bytes_total += bytes;
315 }
316 os << "\n";
317 os << std::flush;
318 CHECK_EQ(object_bytes, object_bytes_total);
319
320 os << StringPrintf("\tmanaged_code_bytes = %8d (%2.0f%% of object_bytes)\n",
321 managed_code_bytes, PercentOfObjectBytes(managed_code_bytes));
322 os << StringPrintf("\tmanaged_to_native_code_bytes = %8d (%2.0f%% of object_bytes)\n",
323 managed_to_native_code_bytes,
324 PercentOfObjectBytes(managed_to_native_code_bytes));
325 os << StringPrintf("\tnative_to_managed_code_bytes = %8d (%2.0f%% of object_bytes)\n",
326 native_to_managed_code_bytes,
327 PercentOfObjectBytes(native_to_managed_code_bytes));
328 os << "\n";
329 os << std::flush;
330
331 os << StringPrintf("\tregister_map_bytes = %7d (%2.0f%% of object_bytes)\n",
332 register_map_bytes, PercentOfObjectBytes(register_map_bytes));
333 os << StringPrintf("\tpc_mapping_table_bytes = %7d (%2.0f%% of object_bytes)\n",
334 pc_mapping_table_bytes, PercentOfObjectBytes(pc_mapping_table_bytes));
335 os << "\n";
336 os << std::flush;
337
338 os << StringPrintf("\tdex_instruction_bytes = %d\n", dex_instruction_bytes);
339 os << StringPrintf("\tmanaged_code_bytes expansion = %.2f\n",
340 static_cast<double>(managed_code_bytes)
341 / static_cast<double>(dex_instruction_bytes));
342 os << "\n";
343 os << std::flush;
344
345 }
346 } stats_;
347
348 private:
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700349 const Space& dump_space_;
350 std::ostream& os_;
Elliott Hughesd1bb4f62011-09-23 14:09:45 -0700351
352 DISALLOW_COPY_AND_ASSIGN(OatDump);
Brian Carlstrom78128a62011-09-15 17:21:19 -0700353};
354
355int oatdump(int argc, char** argv) {
356 // Skip over argv[0].
357 argv++;
358 argc--;
359
360 if (argc == 0) {
361 fprintf(stderr, "no arguments specified\n");
362 usage();
363 }
364
Brian Carlstrom78128a62011-09-15 17:21:19 -0700365 const char* image_filename = NULL;
366 const char* boot_image_filename = NULL;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700367 std::string host_prefix;
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700368 std::ostream* os = &std::cout;
369 UniquePtr<std::ofstream> out;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700370
371 for (int i = 0; i < argc; i++) {
372 const StringPiece option(argv[i]);
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700373 if (option.starts_with("--image=")) {
Brian Carlstrom78128a62011-09-15 17:21:19 -0700374 image_filename = option.substr(strlen("--image=")).data();
Brian Carlstrome24fa612011-09-29 00:53:55 -0700375 } else if (option.starts_with("--boot-image=")) {
376 boot_image_filename = option.substr(strlen("--boot-image=")).data();
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700377 } else if (option.starts_with("--host-prefix=")) {
378 host_prefix = option.substr(strlen("--host-prefix=")).data();
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700379 } else if (option.starts_with("--output=")) {
380 const char* filename = option.substr(strlen("--output=")).data();
381 out.reset(new std::ofstream(filename));
382 if (!out->good()) {
383 fprintf(stderr, "failed to open output filename %s\n", filename);
384 usage();
385 }
386 os = out.get();
Brian Carlstrom78128a62011-09-15 17:21:19 -0700387 } else {
388 fprintf(stderr, "unknown argument %s\n", option.data());
389 usage();
390 }
391 }
392
393 if (image_filename == NULL) {
394 fprintf(stderr, "--image file name not specified\n");
395 return EXIT_FAILURE;
396 }
397
Brian Carlstrom78128a62011-09-15 17:21:19 -0700398 Runtime::Options options;
399 std::string image_option;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700400 std::string oat_option;
Brian Carlstrom78128a62011-09-15 17:21:19 -0700401 std::string boot_image_option;
Brian Carlstrome24fa612011-09-29 00:53:55 -0700402 std::string boot_oat_option;
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700403 if (boot_image_filename != NULL) {
404 boot_image_option += "-Ximage:";
405 boot_image_option += boot_image_filename;
406 options.push_back(std::make_pair(boot_image_option.c_str(), reinterpret_cast<void*>(NULL)));
Brian Carlstrom78128a62011-09-15 17:21:19 -0700407 }
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700408 image_option += "-Ximage:";
409 image_option += image_filename;
410 options.push_back(std::make_pair(image_option.c_str(), reinterpret_cast<void*>(NULL)));
411
412 if (!host_prefix.empty()) {
413 options.push_back(std::make_pair("host-prefix", host_prefix.c_str()));
414 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700415
416 UniquePtr<Runtime> runtime(Runtime::Create(options, false));
417 if (runtime.get() == NULL) {
418 fprintf(stderr, "could not create runtime\n");
419 return EXIT_FAILURE;
420 }
Brian Carlstrom78128a62011-09-15 17:21:19 -0700421
422 Space* image_space = Heap::GetSpaces()[Heap::GetSpaces().size()-2];
423 CHECK(image_space != NULL);
424 const ImageHeader& image_header = image_space->GetImageHeader();
425 if (!image_header.IsValid()) {
426 fprintf(stderr, "invalid image header %s\n", image_filename);
427 return EXIT_FAILURE;
428 }
Brian Carlstrom916e74e2011-09-23 11:42:01 -0700429 OatDump::Dump(image_filename, *os, *image_space, image_header);
Brian Carlstrom78128a62011-09-15 17:21:19 -0700430 return EXIT_SUCCESS;
431}
432
433} // namespace art
434
435int main(int argc, char** argv) {
436 return art::oatdump(argc, argv);
437}