cseq 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cseq/__init__.py +9 -0
- cseq/acceptance.py +162 -0
- cseq/api.py +328 -0
- cseq/binary.py +122 -0
- cseq/cache.py +420 -0
- cseq/cli.py +895 -0
- cseq/compile_db.py +98 -0
- cseq/config.py +138 -0
- cseq/cpu_rules.py +48 -0
- cseq/dependencies.py +202 -0
- cseq/docs.py +21 -0
- cseq/dwarf.py +115 -0
- cseq/event_store.py +378 -0
- cseq/explain.py +113 -0
- cseq/fast_parser.py +286 -0
- cseq/html.py +485 -0
- cseq/html_bundle.py +464 -0
- cseq/hybrid_parser.py +120 -0
- cseq/linker.py +117 -0
- cseq/marker.py +294 -0
- cseq/model.py +367 -0
- cseq/parser.py +797 -0
- cseq/parser_contract_cases.json +69 -0
- cseq/parser_dependency_lock.json +59 -0
- cseq/parser_environment.py +186 -0
- cseq/parser_migration.py +126 -0
- cseq/plugin.py +216 -0
- cseq/project.py +305 -0
- cseq/query.py +62 -0
- cseq/resources/README.md +171 -0
- cseq/resources/design.md +6197 -0
- cseq/resources/verification_report.html +26 -0
- cseq/runtime.py +177 -0
- cseq/runtime_address.py +79 -0
- cseq/runtime_cpu.py +87 -0
- cseq/scanner.py +54 -0
- cseq/sequence.py +281 -0
- cseq/server.py +104 -0
- cseq/source_index.py +227 -0
- cseq/static_store.py +280 -0
- cseq/trace_analysis.py +336 -0
- cseq/trace_diff.py +56 -0
- cseq/tree_sitter_parser.py +468 -0
- cseq/valueflow.py +179 -0
- cseq-0.0.1.dist-info/METADATA +181 -0
- cseq-0.0.1.dist-info/RECORD +49 -0
- cseq-0.0.1.dist-info/WHEEL +5 -0
- cseq-0.0.1.dist-info/entry_points.txt +2 -0
- cseq-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cseq
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: C source sequence analysis tool PoC
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Provides-Extra: parser-tree-sitter
|
|
8
|
+
Requires-Dist: tree-sitter==0.26.0; extra == "parser-tree-sitter"
|
|
9
|
+
Requires-Dist: tree-sitter-c==0.24.2; extra == "parser-tree-sitter"
|
|
10
|
+
|
|
11
|
+
# cseq
|
|
12
|
+
|
|
13
|
+
Cソースツリーから関数呼出し・分岐・コールバック・実行時markerを解析し、PlantUMLとインタラクティブHTMLを生成するシーケンス解析ツールです。
|
|
14
|
+
|
|
15
|
+
初回リリースは **Windows + Python 3.11以上** を主対象とします。Tree-sitterを高速な構文フロントエンドとして使用し、型・macro・関数ポインタ等で意味解析が必要な翻訳単位だけClangへ送ります。
|
|
16
|
+
|
|
17
|
+
## 主な機能
|
|
18
|
+
|
|
19
|
+
- ディレクトリ以下の `.c` / `.h` を再帰走査
|
|
20
|
+
- entry関数からのシーケンス生成
|
|
21
|
+
- 同名`static`関数を区別
|
|
22
|
+
- 外部未定義関数を内部calleeとして誤認しない
|
|
23
|
+
- `#if/#ifdef`、macro、compiler extensionのfail-soft解析
|
|
24
|
+
- 関数ポインタ、callback、dispatch tableの候補解決
|
|
25
|
+
- if/else、loop、無限loop、switch/case/defaultをSequence IRへ保持
|
|
26
|
+
- RTOS風の無限loopを有限表現
|
|
27
|
+
- CPU group / build configurationを外部設定可能
|
|
28
|
+
- runtime markerログの読込み、CPU/task evidence、静的経路との照合
|
|
29
|
+
- marker自動注入: source直接書換え / Overlay(原本非変更)の両方式
|
|
30
|
+
- PlantUML出力
|
|
31
|
+
- HTML UI: 検索、viewport、LOD、Canvas表示、path query、trace diff、marker suggestion
|
|
32
|
+
- 大きいruntime trace向けbundle/range出力
|
|
33
|
+
- optional linker map / binary symbol / DWARF evidence
|
|
34
|
+
|
|
35
|
+
## Windowsでの導入
|
|
36
|
+
|
|
37
|
+
PowerShell例です。
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
py -3.12 -m venv .venv
|
|
41
|
+
.\.venv\Scripts\Activate.ps1
|
|
42
|
+
python -m pip install --upgrade pip
|
|
43
|
+
pip install "cseq[parser-tree-sitter]"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
ローカルwheelから導入する場合:
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
pip install .\cseq-0.0.1-py3-none-any.whl[parser-tree-sitter]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Clang
|
|
53
|
+
|
|
54
|
+
単純なC構文だけならTree-sitterで解析できますが、macro、関数ポインタ、型曖昧性、compiler extension等のselective semantic refinementにはClangを推奨します。
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
winget install --id LLVM.LLVM --exact
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
確認:
|
|
61
|
+
|
|
62
|
+
```powershell
|
|
63
|
+
cseq doctor
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`current_execution_mode` が `tree-sitter+clang` なら両backendを利用できます。
|
|
67
|
+
|
|
68
|
+
## 最短利用例
|
|
69
|
+
|
|
70
|
+
```powershell
|
|
71
|
+
cseq analyze C:\path\to\project --entry main --json
|
|
72
|
+
cseq plantuml C:\path\to\project --entry main --output sequence.puml
|
|
73
|
+
cseq html C:\path\to\project --entry main --output sequence.html --mode auto
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
HTMLは小規模時はportable単一HTML、中規模以上ではbundle/rangeへ切替できます。
|
|
77
|
+
|
|
78
|
+
```powershell
|
|
79
|
+
cseq serve . --port 8000
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
range/bundleをブラウザで確認する際はローカルHTTP配信を推奨します。
|
|
83
|
+
|
|
84
|
+
## プロジェクト設定
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
cseq config init C:\path\to\project
|
|
88
|
+
cseq config validate C:\path\to\project\cseq.toml
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`cseq.toml`でentry、compile database、CPU group、build configuration等をプロジェクト固有名に合わせて設定します。cseq本体は特定企業・CPU名称を前提にしません。
|
|
92
|
+
|
|
93
|
+
`compile_commands.json` がある場合はClang semantic解析の精度向上に利用できます。
|
|
94
|
+
|
|
95
|
+
## Runtime marker
|
|
96
|
+
|
|
97
|
+
### 直接書換え
|
|
98
|
+
|
|
99
|
+
```powershell
|
|
100
|
+
cseq marker apply .\src\worker.c --contains "rx=%d" --id RX01 --manifest .\rx01.json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
manifestにbefore/after hashを保存し、安全条件が成立するときだけundoできます。
|
|
104
|
+
|
|
105
|
+
```powershell
|
|
106
|
+
cseq marker undo .\src\worker.c --manifest .\rx01.json
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Overlay(原本非変更)
|
|
110
|
+
|
|
111
|
+
```powershell
|
|
112
|
+
cseq marker apply .\src\worker.c `
|
|
113
|
+
--contains "rx=%d" `
|
|
114
|
+
--id RX01 `
|
|
115
|
+
--manifest .\rx01-overlay.json `
|
|
116
|
+
--overlay-output .\cseq-overlay\worker.c
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
元sourceは変更されず、marker注入済みコピーだけを生成します。
|
|
120
|
+
|
|
121
|
+
## Runtime log
|
|
122
|
+
|
|
123
|
+
marker形式:
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
[[CSEQ:RX01]] message...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
ログ形式は固定ではなくpatternで指定できます。
|
|
130
|
+
|
|
131
|
+
```powershell
|
|
132
|
+
cseq trace import run.log `
|
|
133
|
+
--pattern "[{cpu}] {time} {message}" `
|
|
134
|
+
--time-format "%H:%M:%S.%f" `
|
|
135
|
+
--json
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
CPU間で時刻が隣接しているだけでは因果関係とはみなしません。marker、payload、静的path等のevidenceを分離して扱います。
|
|
139
|
+
|
|
140
|
+
## HTML UI
|
|
141
|
+
|
|
142
|
+
```powershell
|
|
143
|
+
cseq html C:\path\to\project `
|
|
144
|
+
--entry main `
|
|
145
|
+
--runtime-log run.log `
|
|
146
|
+
--runtime-pattern "[{cpu}] {time} {message}" `
|
|
147
|
+
--runtime-time-format "%H:%M:%S.%f" `
|
|
148
|
+
--output sequence.html `
|
|
149
|
+
--mode auto
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
UIは大量eventを全DOM化せず、viewport/LOD/Canvas/range bundleを使います。初回リリースでは深い性能チューニングより、汎用性・正しさ・必要UIを優先します。
|
|
153
|
+
|
|
154
|
+
## 設計上の原則
|
|
155
|
+
|
|
156
|
+
- Silent Dropしない。解析不能領域はPARTIAL/OPAQUE等で明示する。
|
|
157
|
+
- static possible と runtime observed を混同しない。
|
|
158
|
+
- CPUのstatic/build/runtime evidenceを分離する。
|
|
159
|
+
- cross-CPU timestamp adjacencyだけで因果を断定しない。
|
|
160
|
+
- Tree-sitterとClangは代替関係ではなく、Fast Syntax + Selective Semantic Refinementとして併用する。
|
|
161
|
+
|
|
162
|
+
## 開発時検証
|
|
163
|
+
|
|
164
|
+
```powershell
|
|
165
|
+
python -m pytest -q
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Windows実機で全テスト、Tree-sitter/Clang統合acceptance、clean wheel installを確認してからrelease候補を作成します。
|
|
169
|
+
|
|
170
|
+
## 同梱ドキュメントの出力
|
|
171
|
+
|
|
172
|
+
インストール済みwheelから、README・設計書(清書版)・実装/検証成績書を1コマンドで取り出せます。
|
|
173
|
+
|
|
174
|
+
```powershell
|
|
175
|
+
cseq docs readme --output README.md
|
|
176
|
+
cseq docs design --output シーケンス解析_設計書.md
|
|
177
|
+
cseq docs report --output 実装・検証成績書.html
|
|
178
|
+
cseq docs all --output-dir .\cseq-docs
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`--output`を省略するとREADME/設計書/成績書の内容を標準出力します。`docs all` は3点を一括で出力します。
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
cseq/__init__.py,sha256=wtUDWEdB2XaabdKNv9w6XDVFBss1WOT-236KjxRmgcI,288
|
|
2
|
+
cseq/acceptance.py,sha256=yA5WmVd4o_k3HP59AzGuwE981APSULffAB5JW6C_TN8,7276
|
|
3
|
+
cseq/api.py,sha256=ChudUjO7wIBLYYZZQ09dtWq2t2ANdCBiy0YE7dn1bmw,11830
|
|
4
|
+
cseq/binary.py,sha256=yZCT3y6DbBtf95bjhpzPnX1lWeejxAKQIGuu1Obpm90,4262
|
|
5
|
+
cseq/cache.py,sha256=FUWCGo2L1q4LBl5hBaTCecmYTLJlUJMLGnRSDCq_bm0,20594
|
|
6
|
+
cseq/cli.py,sha256=sBOwfLLxsd_sieZe6lZz7BBZ67vP18BmXpYYSRQw6ZU,41973
|
|
7
|
+
cseq/compile_db.py,sha256=ucxMTZqYtEPaMWhBaPBahU1Bp0PNaJIU2sQjU_Wf7Pk,3402
|
|
8
|
+
cseq/config.py,sha256=gJwNECDBqI30RG1hVJp-bcM7xYi3ECmCGuHGgC9HmHM,5617
|
|
9
|
+
cseq/cpu_rules.py,sha256=hz3TiwKvKDTR1EUQPumXG530-dG-EdPPSGUPG5NyIHY,2217
|
|
10
|
+
cseq/dependencies.py,sha256=kqKgKNK6o15V9vmmrDqu3CArsTWvFhX8cSAE-7EyYt0,7069
|
|
11
|
+
cseq/docs.py,sha256=uoygaQrXgEn4LjREDeXkbPx8Ge2QUNdnktjt2XP4krU,1135
|
|
12
|
+
cseq/dwarf.py,sha256=j8144pa7JQ2URv70iuOUe-BflF49UEQ9S5c8mlTC0HY,3768
|
|
13
|
+
cseq/event_store.py,sha256=GC4NiLnuPwivZi1fJrRmJRrln_8eQQbTlSlNeIlYKEY,18431
|
|
14
|
+
cseq/explain.py,sha256=XYGcGenTJMuQ78Wr18sJMfNu4BoCROHXvBmJxdlaVOc,4619
|
|
15
|
+
cseq/fast_parser.py,sha256=CuVKhaeJ9nqx66EV6TwTFp6lWdmyK79bsN5eXFOY6Zw,10953
|
|
16
|
+
cseq/html.py,sha256=l8dHudhmBkujYXB63iy4nGHQklSK_lIYwf4so9mPJTw,28218
|
|
17
|
+
cseq/html_bundle.py,sha256=IlD-WuBUC-CGDwlFro12l9N_4raIF6Nt1kFo_HHAmTE,19048
|
|
18
|
+
cseq/hybrid_parser.py,sha256=mOc1sK2Cf8XMR9iyTRiKhnO6J6yDMQeesxhx35qa_jQ,4830
|
|
19
|
+
cseq/linker.py,sha256=IQ-RnPjJB_E4Scttz2y_Tkp-WiCywkPFBt8IXW_d0eg,4472
|
|
20
|
+
cseq/marker.py,sha256=Iyxg51yG0Va6RWed6vopBnOdyjdXGwlOSLJ5p6YTerE,9911
|
|
21
|
+
cseq/model.py,sha256=YLcVCwq6l9dyc4i4Vp4MNK9Yl6xhC-XUjiHu5obF7VI,11581
|
|
22
|
+
cseq/parser.py,sha256=f3kTs3Sa7iOrNDa4rA2FfIWfmIJevpV7GE3US1kCvxA,33445
|
|
23
|
+
cseq/parser_contract_cases.json,sha256=uFt9exENj2_Z1a5k-wqzAd2uErz7UDqPwq-kg9EH6zM,2144
|
|
24
|
+
cseq/parser_dependency_lock.json,sha256=2Tj_Zg8ZU4CmRXiIpYLTlwwnWJc4Y4ExOlgRejrc59E,2521
|
|
25
|
+
cseq/parser_environment.py,sha256=rA8efLQe8Kz6eKhBIWf5Jpg8M9-gXx3OxnDNbY5ZIE8,6906
|
|
26
|
+
cseq/parser_migration.py,sha256=VeqKroQCR32DJwvYqYiEVIqA5K457iAEbG3-deGcQGY,4378
|
|
27
|
+
cseq/plugin.py,sha256=tV0TRA8CjEuMqvDP6pctVsm4oM-FqEf6sTVq5sQPICk,7524
|
|
28
|
+
cseq/project.py,sha256=MxFQpmhbQ1Y5JxVXny6oR0gkpf16i3HlpbV9JlS_pf0,15455
|
|
29
|
+
cseq/query.py,sha256=SAJaciIQpkqiF7vZRW527K_gVjhD7ZvbGHXh4I9s9Mc,2246
|
|
30
|
+
cseq/runtime.py,sha256=QzzSEXCkgTa_HT-1yPu0Pjkm4mW-K6U3MAOKFCLIriI,5705
|
|
31
|
+
cseq/runtime_address.py,sha256=66CeInMIlZCI9-R_pGYhnqcXF-expYmlhjDPw5X7c6I,2644
|
|
32
|
+
cseq/runtime_cpu.py,sha256=3Tu9Nz-ohS5u7PSDOLRD2M3MTrBOyBJkTERcPV7snU8,3331
|
|
33
|
+
cseq/scanner.py,sha256=qzulBfT-AV0tBnYTKbAZ7C4DXvbPs0bJ05CzJ7Jb6ow,1779
|
|
34
|
+
cseq/sequence.py,sha256=Usdxy7tSr2XaA9EBbNxWQ8YdXnFPdfvfKgKsr0yyGqA,12090
|
|
35
|
+
cseq/server.py,sha256=TV9hN6lizTymWmOkL_4ZyMJnZtDmfbOLqO0dJRFr4no,3494
|
|
36
|
+
cseq/source_index.py,sha256=FuEktoY-024o7isP42z0bEuamgPboHvWgaCIGDgYr5M,8536
|
|
37
|
+
cseq/static_store.py,sha256=Yc_z14WdX8O5Jigia6yZpw-kzs9kTO6H172q8JLbyas,11795
|
|
38
|
+
cseq/trace_analysis.py,sha256=I5Cgv_lSS59ZcnuTRjyLD2eHk9cVwQ_N5n5n9g3f9L0,13031
|
|
39
|
+
cseq/trace_diff.py,sha256=FH_K2B7auZhLD_u6ppnxAnt-IabdE_ZCN9a8HXSeOHM,2548
|
|
40
|
+
cseq/tree_sitter_parser.py,sha256=1SuYCbhomzNfrA5jLxaA4xAcIgtxLFgM9XCWaCB2O40,20724
|
|
41
|
+
cseq/valueflow.py,sha256=QimhVw1tZ-iERDGsAbzF9NhYhuEYLaS7dRh67zsQE9I,6929
|
|
42
|
+
cseq/resources/README.md,sha256=G7Mr1YwN4WkqGvAFeJdR6IuS5iJqw420JXWGAZbf2zo,5604
|
|
43
|
+
cseq/resources/design.md,sha256=Fwd4GPRS7qnr0zh7AWZ6I8cBNzDVtBEgyEroGYAUbvM,120948
|
|
44
|
+
cseq/resources/verification_report.html,sha256=ViS3d0QefLArcDdd_k6D07Q3MyjdTI11MQIud4pel6w,6672
|
|
45
|
+
cseq-0.0.1.dist-info/METADATA,sha256=OsP7xi3Q028vop4_u5TAlVv_g-JrtXVXwm_ulO9utlU,5931
|
|
46
|
+
cseq-0.0.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
47
|
+
cseq-0.0.1.dist-info/entry_points.txt,sha256=dYICGnVHbEm2qWp_r74Eoqmaqw3nw3u2VawOYT7YwIE,39
|
|
48
|
+
cseq-0.0.1.dist-info/top_level.txt,sha256=OZmiBrgQbxwuBbO47clW6hjIALHpt7ZIShshj3zVHKY,5
|
|
49
|
+
cseq-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cseq
|