infertracebugs Command
See detailed error details, generally we may go directly to the source file to see these files, but infer also provide us with the infertracebugs command to view.
Command Detailed Description:
Localhost:ios_hello wuxian$ infertracebugs--help
usage:infertracebugs [-h] [-o <directory>] [--only-show] [ --no-source]
[--select n] [--max-level n]
Explore the error traces in infer reports.
Optional arguments:
-H,--help show this help message
and Exit-O-<directory>,--out <directory>
Set The Infer results directory
--only-show show the list of reports and exit
--no-source do not PR int code excerpts
--select n Select bug number N. If omitted, prompts you for
input.
--max-level N level of nested procedure calls to show. Can is "Max", in which case all
levels is shown. If omitted,
prompts you for input
The infertracebugs command locates specific information about an issue that you can navigate directly by using the parameters above, or by default and then step into the details screen by prompting.
We use the default way (Infertracebugs) to understand the way the command is used in a step-by-step manner
Execute the command, first list all the problem information
Localhost:ios_hello wuxian$ infertracebugs 0. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/appdelegate.m:20:error:memory_ LEAK memory dynamically allocated to Shadowpath on call-to-cgpathcreatewithrect () at line, column = not reach Able after line, column 5 1. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/appdelegate.m:25:error: Resource_leak RESOURCE acquired to FP by call to fopen () at line, Column 8 was not released after line, column 5 2. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/appdelegate.m:29:warning: Parameter_not_null_checked PARAMETER callback is isn't CHECKED for NULL, there could bes a null pointer dereference:po Inter callback could be null and was dereferenced at line, column 5 3. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/appdelegate.m:34:error:null_ dereference Pointer Str last assignEd on line could was null and is dereferenced at line, column 12 4. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/appdelegate.m:39:error: Premature_nil_termination_argument Pointer str Last assigned on line could is NIL which results in a call to Arra Ywithobjects:with 1 arguments instead of 3 (nil indicates that the last argument of this variadic method have been reached ) at line 12, column 5. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/hello.m:20:error:null_ dereference pointer hello last assigned on line could be null and was dereferenced at line 12, column 6. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/hello.m:25:warning:ivar_not_ null_checked Instance variable Hello, _hello is not CHECKED for NULL, there could bes a null pointer dereference : pointer Ret_hello last assigned on line + could be null and was dereferenced at line, ColumN 12 7. /users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/hello.m:30:warning:parameter_ not_null_checked Parameter Hello isn't CHECKED for NULL, there could bes a null pointer dereference:pointer Ret_hel Lo last assigned on line could be null and are dereferenced at line 12
–select
The above information shows that after the completion, there will be an interactive line, you need to enter a number, this number is listed above the problem sequence number, you can not enter more than the list of problem ordinal range, this interaction line is not set –select parameters appear.
We enter the correct number (in this case, 0-7 is a valid value), for example: 0
Choose report to display (default=0): 0
And then there's a hint line –max-level
Set the level of nested calls, I do not know the actual effect of this parameter, because I try different values, the results are the same.
Choose maximum level of nested procedures calls (Default=max): Max
Then infer will show us the details of this issue:
/users/wuxian/downloads/infer-osx-v0.1.0/infer/examples/ios_hello/helloworldapp/appdelegate.m:20:error:memory_ LEAK
memory dynamically allocated to Shadowpath on call-to-cgpathcreatewithrect () at line, column was not Reachab Le after line, column 5
Showing all 2 steps of the trace
/users/wuxian/downloads/infer-osx-v0.1.0/infer/exampl Es/ios_hello/helloworldapp/appdelegate.m:19:start of Procedure Memory_leak_bug @implementation Appdelegate
>-(void) Memory_leak_bug { cgpathref Shadowpath = Cgpathcreatewithrect ( Self.inputView.bounds, NULL); /USERS/WUXIAN/DOWNLOADS/INFER-OSX-V0.1.0/INFER/EXAMPLES/IOS_HELLO/HELLOWORLDAPP/APPDELEGATE.M}
: £ º (void) memory_leak_bug {
> cgpathref shadowpath = Cgpathcreatewithrect ( Self.inputView.bounds, NULL); 22}
The interactive method above is equivalent to