OLD | NEW |
(Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import os |
| 6 import sys |
| 7 |
| 8 |
| 9 _SHRINK_TO_FIT_CLONE = ('blink::ContiguousContainerBase::shrinkToFit() ' |
| 10 '[clone .part.1234] [clone .isra.2]') |
| 11 _ELF_OUTPUT = """002b6e20 t $t |
| 12 00000010 N $d |
| 13 002b6bb8 t $t |
| 14 002a0010 t {} |
| 15 0028d900 t startup._GLOBAL__sub_I_page_allocator.cc |
| 16 002a0010 t FooAlias() |
| 17 002b6bb8 t $t |
| 18 002a0010 t BarAlias() |
| 19 002a0000 t blink::ContiguousContainerBase::shrinkToFit() |
| 20 002a0000 t BazAlias(bool) |
| 21 002b6bb8 t $t |
| 22 """.format(_SHRINK_TO_FIT_CLONE) |
| 23 |
| 24 _SHRINK_TO_FIT = ('blink::ContiguousContainerBase::shrinkToFit() ' |
| 25 '[clone .part.1234] [clone .isra.2]') |
| 26 _OBJECT_OUTPUTS = { |
| 27 'obj/third_party/icu/icuuc/ucnv_ext.o': [ |
| 28 '01010101 t ' + _SHRINK_TO_FIT, |
| 29 '01010101 t _GLOBAL__sub_I_SkDeviceProfile.cpp', |
| 30 '01010101 t foo_bar', |
| 31 '002a0000 t BazAlias(bool)', |
| 32 '01010101 r vtable for ChromeMainDelegate', |
| 33 '01010101 r vtable for chrome::mojom::FieldTrialRecorder', |
| 34 ('01010101 t ucnv_extMatchFromU(int const*, int, unsigned short const*,' |
| 35 ' int, unsigned short const*, int, unsigned int*, signed char, signed ' |
| 36 'char)'), |
| 37 ], |
| 38 'obj/third_party/WebKit.a': [ |
| 39 '', |
| 40 'PaintChunker.o:', |
| 41 '01010101 t ' + _SHRINK_TO_FIT, |
| 42 '010101 t (anonymous namespace)::kAnimationFrameTimeHistogramClassPath', |
| 43 '010101 r vtable for ChromeMainDelegateAndroid', |
| 44 ('01010101 r blink::(anonymous namespace)::CSSValueKeywordsHash::findVa' |
| 45 'lueImpl(char const*, unsigned int)::value_word_list'), |
| 46 '', |
| 47 'ContiguousContainer.o:', |
| 48 '01010101 d chrome::mojom::FilePatcher::Name_', |
| 49 '01010101 r vtable for chrome::mojom::FieldTrialRecorderProxy', |
| 50 '01010101 r google::protobuf::internal::pLinuxKernelMemoryBarrier', |
| 51 '01010101 r base::android::kBaseRegisteredMethods', |
| 52 ('01010101 r base::android::(anonymous namespace)::g_renderer_histogram' |
| 53 '_code'), |
| 54 ('01010101 r base::android::(anonymous namespace)::g_library_version_nu' |
| 55 'mber'), |
| 56 ('01010101 t blink::ContiguousContainerBase::ContiguousContainerBase(bl' |
| 57 'ink::ContiguousContainerBase&&)'), |
| 58 ('01010101 t (anonymous namespace)::blink::PaintChunker::releasePaintCh' |
| 59 'unks() [clone .part.1]'), |
| 60 ], |
| 61 'obj/base/base/page_allocator.o': [ |
| 62 '01010101 t _GLOBAL__sub_I_page_allocator.cc', |
| 63 '01010101 t _GLOBAL__sub_I_bbr_sender.cc', |
| 64 '01010101 t _GLOBAL__sub_I_pacing_sender.cc', |
| 65 '01010101 t _GLOBAL__sub_I_bbr_sender.cc', |
| 66 '01010101 t extFromUUseMapping(aj, int)', |
| 67 '01010101 t extFromUUseMapping(signed char, unsigned int, int)', |
| 68 '01010101 t Name', |
| 69 '01010101 v vtable for mojo::MessageReceiver', |
| 70 '01010101 r kMethodsAnimationFrameTimeHistogram', |
| 71 '01010101 r google::protobuf::internal::pLinuxKernelCmpxchg', |
| 72 ], |
| 73 'obj/third_party/ffmpeg/libffmpeg_internal.a': [ |
| 74 '', |
| 75 'fft_float.o:', |
| 76 '01010101 b ff_cos_65536', |
| 77 '01010101 b ff_cos_131072', |
| 78 '002a0010 t FooAlias()', |
| 79 '002b6bb8 t $t', |
| 80 '002a0010 t BarAlias()', |
| 81 '' |
| 82 'fft_fixed.o:' |
| 83 '01010101 b ff_cos_131072_fixed', |
| 84 ], |
| 85 '../../third_party/gvr-android-sdk/libgvr_shim_static_arm.a': [ |
| 86 '', |
| 87 'libcontroller_api_impl.a_controller_api_impl.o:' |
| 88 '01010101 d .Lswitch.table.45', |
| 89 '', |
| 90 'libport_android_jni.a_jni_utils.o:', |
| 91 '(anonymous namespace)::kSystemClassPrefixes', |
| 92 ], |
| 93 } |
| 94 |
| 95 def _PrintHeader(path): |
| 96 sys.stdout.write('\n') |
| 97 sys.stdout.write(path + ':\n') |
| 98 |
| 99 |
| 100 def _PrintOutput(path): |
| 101 if path.endswith(os.path.join('mock_output_directory', 'elf')): |
| 102 sys.stdout.write(_ELF_OUTPUT) |
| 103 else: |
| 104 lines = _OBJECT_OUTPUTS.get(path) |
| 105 assert lines, 'No mock_nm.py entry for: ' + path |
| 106 sys.stdout.write('\n'.join(lines)) |
| 107 sys.stdout.write('\n') |
| 108 |
| 109 |
| 110 def main(): |
| 111 paths = [p for p in sys.argv[1:] if not p.startswith('-')] |
| 112 if len(paths) == 1: |
| 113 _PrintOutput(paths[0]) |
| 114 else: |
| 115 for path in paths: |
| 116 _PrintHeader(path) |
| 117 _PrintOutput(path) |
| 118 |
| 119 |
| 120 if __name__ == '__main__': |
| 121 main() |
OLD | NEW |