OLD | NEW |
1 # Traffic Annotation Extrator | 1 # Traffic Annotation Extrator |
2 This is a clang tool to extract network traffic annotations. The tool is run by | 2 This is a clang tool to extract network traffic annotations. The tool is run by |
3 `tools/traffic_annotation/auditor/traffic_annotation_auditor.py`. Refer to it | 3 `tools/traffic_annotation/auditor/traffic_annotation_auditor.py`. Refer to it |
4 for help on how to use. | 4 for help on how to use. |
5 | 5 |
6 ## Build on Linux | 6 ## Build on Linux |
7 `tools/clang/scripts/update.py --bootstrap --force-local-build | 7 `tools/clang/scripts/update.py --bootstrap --force-local-build |
8 --without-android --extra-tools traffic_annotation_extractor` | 8 --without-android --extra-tools traffic_annotation_extractor` |
9 | 9 |
10 ## Build on Window | 10 ## Build on Window |
11 1. Either open a `VS2015 x64 Native Tools Command Prompt`, or open a normal | 11 1. Either open a `VS2015 x64 Native Tools Command Prompt`, or open a normal |
12 command prompt and run `depot_tools\win_toolchain\vs_files\ | 12 command prompt and run `depot_tools\win_toolchain\vs_files\ |
13 $long_autocompleted_hash\win_sdk\bin\setenv.cmd /x64` | 13 $long_autocompleted_hash\win_sdk\bin\setenv.cmd /x64` |
14 2. Run `python tools/clang/scripts/update.py --bootstrap --force-local-build | 14 2. Run `python tools/clang/scripts/update.py --bootstrap --force-local-build |
15 --without-android --extra-tools traffic_annotation_extractor` | 15 --without-android --extra-tools traffic_annotation_extractor` |
16 | 16 |
17 ## Usage | 17 ## Usage |
18 Run `traffic_annotation_extractor --help` for parameters help. | 18 Run `traffic_annotation_extractor --help` for parameters help. |
19 | 19 |
20 Example for direct call: | 20 Example for direct call: |
21 `third_party/llvm-build/Release+Asserts/bin/traffic_annotation_extractor | 21 `third_party/llvm-build/Release+Asserts/bin/traffic_annotation_extractor |
22 -p=out/Debug components/spellcheck/browser/spelling_service_client.cc` | 22 -p=out/Debug components/spellcheck/browser/spelling_service_client.cc` |
23 | 23 |
24 Example for call using run_tool.py: | 24 Example for call using run_tool.py: |
25 `tools/clang/scripts/run_tool.py --tool=traffic_annotation_extractor | 25 `tools/clang/scripts/run_tool.py --tool=traffic_annotation_extractor |
26 --generate-compdb -p=out/Debug components/spellcheck/browser` | 26 --generate-compdb -p=out/Debug components/spellcheck/browser` |
27 | 27 |
28 The executable extracts network traffic annotations from given file paths based | 28 The executable extracts network traffic annotations and calls to network request |
29 on build parameters in build path, and writes them to llvm::outs. | 29 generation functions from given file paths based on build parameters in build |
30 Each output will have the following format: | 30 path, and writes them to llvm::outs. |
31 - Line 1: File path. | 31 |
32 - Line 2: Name of the function in which annotation is defined. | 32 Each annotation output will have the following format: |
33 - Line 3: Line number of annotation. | 33 - Line 1: "==== NEW ANNOTATION ====" |
34 - Line 4: Function type ("Definition", "Partial", "Completing", | 34 - Line 2: File path. |
| 35 - Line 3: Name of the function in which the annotation is defined. |
| 36 - Line 4: Line number of the annotation. |
| 37 - Line 5: Function type ("Definition", "Partial", "Completing", |
35 "BranchedCompleting"). | 38 "BranchedCompleting"). |
36 - Line 5: Unique id of annotation. | 39 - Line 6: Unique id of annotation. |
37 - Line 6: Completing id or group id, when applicable, empty otherwise. | 40 - Line 7: Completing id or group id, when applicable, empty otherwise. |
38 - Line 7-: Serialized protobuf of the annotation. | 41 - Line 8-: Serialized protobuf of the annotation. (Several lines) |
39 Outputs are enclosed by "==== NEW ANNOTATION ====" and | 42 - Last line: "==== ANNOTATION ENDS ====" |
40 "==== ANNOTATION ENDS ====" | 43 |
| 44 Each function call output will have the following format: |
| 45 - Line 1: "==== NEW CALL ====" |
| 46 - Line 2: File path. |
| 47 - Line 3: Name of the function in which the call is made. |
| 48 - Line 4: Name of the called function. |
| 49 - Line 5: Does the call have an annotation? |
| 50 - Line 6: "==== CALL ENDS ====" |
OLD | NEW |