簡體   English   中英

如何獲取在模擬器上運行的 ios 應用程序的加載地址

[英]How to get the load address of an ios app running on simulator

如果沒有加載地址,就不可能在二進制文件上正確運行atos 我正在(lldb)內部調試一個 iOS 應用程序,該應用程序報告了一條診斷消息(線程清理報告),其中包含如下地址列表:

  1 ==================
  2 ^[[1m^[[31mWARNING: ThreadSanitizer: data race (pid=90559)
  3 ^[[1m^[[0m^[[1m^[[34m  Write of size 4 at 0x000113050868 by thread T35:
  4 ^[[1m^[[0m    #0 <null> <null>:2 (MyApp):x86_64+0x100d5963b)
  5     #1 <null> <null>:2 (MyApp):x86_64+0x100d5b09b)
  6     #2 <null> <null>:2 (MyApp):x86_64+0x100d59c3b)
  7     #3 <null> <null>:2 (MyApp):x86_64+0x100d59f1b)
  8     #4 <null> <null>:2 (MyApp):x86_64+0x10806a8b3)
  9     #5 <null> <null>:2 (MyApp):x86_64+0x10725557f)
 10     #6 <null> <null>:2 (MyApp):x86_64+0x106c406e3)
 11     #7 <null> <null>:2 (MyApp):x86_64+0x1081cfe78)
 12     #8 <null> <null>:2 (MyApp):x86_64+0x107d076b1)
 13     #9 <null> <null>:2 (MyApp):x86_64+0x1081d1f1d)
 14     #10 <null> <null>:2 (MyApp):x86_64+0x1081d2206)
 15     #11 <null> <null>:2 (MyApp):x86_64+0x107d0735b)
 16     #12 <null> <null>:2 (MyApp):x86_64+0x107d05dc9)
 17     #13 <null> <null>:2 (MyApp):x86_64+0x108375009)
 18     #14 __tsan::invoke_and_release_block(void*) <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x7428b)
 19     #15 _dispatch_client_callout <null>:2 (libdispatch.dylib:x86_64+0x4c0b)
 20
 21 ^[[1m^[[34m  Previous write of size 4 at 0x000113050868 by thread T6:
 22 ^[[1m^[[0m    #0 <null> <null>:2 (MyApp):x86_64+0x100d5963b)
 23     #1 <null> <null>:2 (MyApp):x86_64+0x100d5b09b)
 24     #2 <null> <null>:2 (MyApp):x86_64+0x100d59c3b)
 25     #3 <null> <null>:2 (MyApp):x86_64+0x100d59f1b)
 26     #4 <null> <null>:2 (MyApp):x86_64+0x10806a8b3)
 27     #5 <null> <null>:2 (MyApp):x86_64+0x10725557f)
 28     #6 <null> <null>:2 (MyApp):x86_64+0x107255c6f)
 29     #7 <null> <null>:2 (MyApp):x86_64+0x1072520ca)
 30     #8 <null> <null>:2 (MyApp):x86_64+0x10727f576)
 31     #9 <null> <null>:2 (MyApp):x86_64+0x1072c8ded)
 32     #10 <null> <null>:2 (MyApp):x86_64+0x1072c70e3)
 33     #11 <null> <null>:2 (MyApp):x86_64+0x1072c90b7)
 34     #12 <null> <null>:2 (MyApp):x86_64+0x1072b8b4f)
 35     #13 <null> <null>:2 (MyApp):x86_64+0x1072b907a)
 36     #14 <null> <null>:2 (MyApp):x86_64+0x108375009)
 37     #15 __tsan::invoke_and_release_block(void*) <null>:2 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x7428b)
 38     #16 _dispatch_client_callout <null>:2 (libdispatch.dylib:x86_64+0x4c0b)
 39 
 40 ^[[1m^[[32m  Location is global '<null>' at 0x000000000000 (MyApp)+0x00010c9d2868)
 41 
 42 ^[[1m^[[0m^[[1m^[[36m  Thread T35 (tid=65692125, running) is a GCD worker thread
 43 
 44 ^[[1m^[[0m^[[1m^[[36m  Thread T6 (tid=65688838, running) is a GCD worker thread
 45 
 46 ^[[1m^[[0mSUMMARY: ThreadSanitizer: data race (MyApp):x86_64+0x100d5963b)

例如,我可以從 lldb session 中進行image lookup -va 0x100d5963b 0x100d5963b。 我覺得這太乏味了。 有沒有辦法獲取加載地址,以便我可以通過將此報告放在文件中來在所有地址上運行atos

lldb 具有target module lookup -a顯示模塊名稱及其加載地址的標志。

例如,

Address: MyApp[0x0000000109b99868] (MyApp.__TEXT.__cstring + 75576)
      Summary: "foo"

還有另一個標志列出所有模塊及其加載地址:

target module list

請注意,它將打印所有模塊及其加載地址,並且您可能需要 grep 才能找到您要查找的模塊。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM