In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the advanced skills of CPU thread debugging in iOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Preparation in advance
Open symbol table in build setting
1. Import header file
# import
This is the mac os executable dynamic link library header file built-in functions that we need to use
two。 Copy the following code to the place of your related call
/ / 1uint32_t count = _ dyld_image_count (); DDLogInfo (@ "Dyld image count% d", count); / / 2for (int I = 0; I < count; iTunes +) {char * image_name = (char *) _ dyld_get_image_name (I); / / 3const struct mach_header * mh = _ dyld_get_image_header (I); intptr_t vmaddr_slide = _ dyld_get_image_vmaddr_slide (I) / / 4NSLog (@ "Image name% s at address 0x%llx and ASLR slide 0x%lx.\ n", image_name, (mach_vm_address_t) mh, vmaddr_slide);}
Let me explain the above code.
1. Take out the number of current images
two。 Ergodic mirror
3. Get the image first address
4. Printing
Then run your program.
Then take a look at the console and filter the typing in ASLR our log.
Then click Product in the project.
Right-click show in finder
The next step is to open the terminal cd to this directory (you can open the terminal and enter cd space to drag that folder)
Then take a look at pwd.
3. The console searches for the code that we print log.
Find our first home address.
Note: this step is very important. if it doesn't work, please try again several times.
Take out the first address searched in the ASLR of the main function and copy it back to the terminal for input
Atos-arch arm64-o com_kwai_gif.app.dSYM/Contents/Resources/DWARF/com_kwai_gif-l 0x1006b8000
Note: here is the symbol table path, if you don't know where to find it, please google it.
Let's test whether it works.
First click on the panel at the top of the console
Then enter bt in consolo
If you see the following content, it has been successful.
4. The real machine runs to find unknown threads.
First, click Profile in the Xcode project to run instruments. Here, after running the project, Xcode9.4 can be seamlessly converted to instruments.
We found that the relevant thread has no name and does not know the name of the object, just a hexadecimal address.
Let's find a random address and enter it in the terminal.
Okay, if you have any questions, please delete the product and recompile the symbol table.
This is the end of the content of "what are the advanced skills of CPU thread debugging in iOS". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.