Chinese Readme: 中文版readme.
WBBlades is a tool set based on Mach-O file parsing, including unused code detection (supporting ObjC and Swift), app size analysis, and log recovery without dSYM file.
$ git clone https://github.com/wuba/WBBlades.git $ cd WBBlades $ make install
If you see some message like
 70390 killed blades ,please
Unused Code Detection ObjC & Swift
$ blades -unused xxx.app -from xxx.a xxx.a ....
-from indicating that only the unused code in the following static libraries is analyzed. Without this parameter, the default is all classes in the APP.
App Size Analysis (Directly measure the size of .a or .framework after linking)
$ blades -size xxx.a xxx.framework ....
Supporting input a folder path, all static libraries under the folder will be analyzed.
Log Recovery without dSYM File (In the case of missing dSYM file, try
ObjC crash stack symbolization,
Swift is not supported)
$ blades -symbol xxx.app -logPath xxx.ips
|ObjC classes's static call||✅||
|ObjC classes's dynamic call||✅||
|ObjC dynamic call througn string concatenation||❌||
|ObjC load method||✅||
|ObjC & Swift being inherited||✅||
|ObjC & Swift being properties||✅||
|Swift class direct call||✅||
|Swift call using runtime||❌||
|Swift generic parameters||✅||
|Swfit class dynamic call in ObjC||✅||
|Swift type declaration in the container||❌||
|Swift multiple nesting||✅||
Supports quick detection of the linked size of a static library. No need to compile and link. For example: If you want to know how much app size will increase when an SDK is imported or updated, you can use
blades -size to estimate the size, without the need to connect the SDK to compile and link successfully to calculate.
In the case of losing the dSYM file, try to restore the log via
blades -symbol. **For example, in an app packaging, the dSYM file is cleared after a period of time, but the app file is retained. In this case, you can consider using blades for symbolization. **Before using the tool, pay attention to a few points:
If your app is a debug package or a package that does not strip the symbol table, you can use
dsymutil app -o xx.dSYMto extract the symbol table. Then use the symbol table to symbolize the log.
This tool only supports ObjC, and its principle is to determine the function of the crash by analyzing the address of the ObjC method in Mach-O. Therefore, it is not suitable for Swfit, C, and C++. In addition, tools are not omnipotent, and are only used as emergency supplementary technical means. In daily situations, it is recommended to use symbol tables for log symbolization.
We sincerely hope that developers can provide valuable comments and suggestions, and developers can provide feedback on suggestions and problems by submitting PR or Issue.