pyGdbToolkit 0.1.0__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.
@@ -0,0 +1,586 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyGdbToolkit
3
+ Version: 0.1.0
4
+ Summary: A complete toolkit for gdb-based audit and debugging
5
+ Author: Florent Valette, Philippe Thierry
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
17
+
18
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
19
+
20
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
21
+
22
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
23
+
24
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
25
+
26
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
27
+
28
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
29
+
30
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
31
+
32
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
33
+
34
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
35
+
36
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
37
+
38
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
39
+
40
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
41
+
42
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
43
+
44
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
45
+
46
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
47
+
48
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
49
+
50
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
51
+
52
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
53
+
54
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
55
+
56
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
57
+
58
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
59
+
60
+ END OF TERMS AND CONDITIONS
61
+
62
+ APPENDIX: How to apply the Apache License to your work.
63
+
64
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
65
+
66
+ Copyright [yyyy] [name of copyright owner]
67
+
68
+ Licensed under the Apache License, Version 2.0 (the "License");
69
+ you may not use this file except in compliance with the License.
70
+ You may obtain a copy of the License at
71
+
72
+ http://www.apache.org/licenses/LICENSE-2.0
73
+
74
+ Unless required by applicable law or agreed to in writing, software
75
+ distributed under the License is distributed on an "AS IS" BASIS,
76
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
77
+ See the License for the specific language governing permissions and
78
+ limitations under the License.
79
+
80
+ Project-URL: Homepage, https://github.com/h2lab
81
+ Project-URL: Repository, https://github.com/h2lab/pyGdbToolkit
82
+ Project-URL: Issues, https://github.com/h2lab/pyGdbToolkit/issues
83
+ Classifier: Development Status :: 4 - Beta
84
+ Classifier: Intended Audience :: Developers
85
+ Classifier: Topic :: Software Development :: Debuggers
86
+ Classifier: License :: OSI Approved :: Apache Software License
87
+ Classifier: Programming Language :: Python :: 3
88
+ Classifier: Programming Language :: Python :: 3 :: Only
89
+ Classifier: Programming Language :: Python :: 3.12
90
+ Classifier: Programming Language :: Python :: 3.13
91
+ Classifier: Programming Language :: Python :: 3.14
92
+ Requires-Python: >=3.12
93
+ Description-Content-Type: text/markdown
94
+ Requires-Dist: requests>=2.32
95
+ Requires-Dist: rich>=13.6
96
+ Provides-Extra: dev
97
+ Requires-Dist: black; extra == "dev"
98
+ Requires-Dist: flake8; extra == "dev"
99
+ Requires-Dist: flake8-docstrings; extra == "dev"
100
+ Requires-Dist: mypy; extra == "dev"
101
+ Requires-Dist: pytest; extra == "dev"
102
+ Requires-Dist: pytest-cov; extra == "dev"
103
+ Requires-Dist: types-gdb; extra == "dev"
104
+
105
+ <!--
106
+ SPDX-FileType: DOCUMENTATION
107
+ SPDX-FileCopyrightText: 2026 H2Lab Development Team
108
+ SPDX-License-Identifier: Apache-2.0
109
+ -->
110
+ # pyGdbToolkit
111
+
112
+ Rich-based GDB commands for inspecting and diagnosing embedded debugging
113
+ targets, especially Arm Cortex-M microcontrollers.
114
+
115
+ ## Why pyGdbToolkit?
116
+
117
+ Embedded debugging often requires switching between GDB, vendor tools, CMSIS
118
+ headers, SVD files, and ad-hoc scripts. pyGdbToolkit brings the most useful
119
+ inspection tasks into GDB itself and presents the results as readable Rich
120
+ tables.
121
+
122
+ It helps answer questions such as:
123
+
124
+ - Which processor and STM32 product line is connected?
125
+ - Which fault registers and stacked context explain a Cortex-M exception?
126
+ - What is the current call-stack layout, including NVIC and FPU frames?
127
+ - What are the live values and decoded bitfields of peripheral registers?
128
+ - Is the Cortex-M security configuration correctly set up?
129
+
130
+ The toolkit reads target memory through GDB, so it works with the GDB target
131
+ connection already used by the debugging session. It does not require a
132
+ separate probe protocol or vendor IDE.
133
+
134
+ ## Requirements
135
+
136
+ - GDB with embedded Python support
137
+ - Python 3.12 or newer
138
+ - An Arm Cortex-M target for the Cortex-M-specific commands
139
+ - `requests` and `rich` (installed automatically with the package)
140
+
141
+ ## Installation
142
+
143
+ Install the package in the Python environment used by GDB. From a clone of
144
+ this repository, an editable installation is convenient during development:
145
+
146
+ ```console
147
+ python3 -m venv .venv
148
+ . .venv/bin/activate
149
+ python -m pip install --upgrade pip
150
+ python -m pip install -e .
151
+ ```
152
+
153
+ For a regular installation, use `python -m pip install .` instead. The Python
154
+ interpreter used for installation must be compatible with GDB's embedded
155
+ Python interpreter. If GDB uses a different Python installation, install the
156
+ package with that interpreter or add the installed package directory to
157
+ `sys.path` in `gdbinit`.
158
+
159
+ ## Loading the commands in GDB
160
+
161
+ The repository includes a [`gdbinit`](gdbinit) example that configures an Arm
162
+ target, connects to a local GDB server, resets the target, and loads the
163
+ package. Run GDB from the repository directory with:
164
+
165
+ ```gdb
166
+ set architecture arm
167
+ target extended-remote localhost:3333
168
+ monitor reset halt
169
+ python
170
+ import subprocess,sys
171
+ paths = subprocess.check_output('python3 -c "import os,sys;print(os.linesep.join(sys.path).strip())"',shell=True).decode("utf-8").split()
172
+ sys.path.extend(paths)
173
+ end
174
+ py import pyGdbToolkit
175
+ ```
176
+
177
+ The `py import pyGdbToolkit` line registers the commands provided by the
178
+ package. Change or comment out `target extended-remote localhost:3333` and
179
+ `monitor reset halt` when the target is configured by another tool or GDB
180
+ server. To use this file explicitly, start GDB with `gdb -x gdbinit`.
181
+
182
+ ## Command reference
183
+
184
+ ### `lscpu`
185
+
186
+ Displays the Arm CPU identity and, for supported STM32 devices, the
187
+ electronic signatures needed to identify the documented product line.
188
+
189
+ ```
190
+ (gdb) lscpu
191
+ Cortex-M CPU report
192
+
193
+ Property Value
194
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
195
+ Core type Cortex-M33
196
+ Core revision r0p4
197
+ Implementer Arm
198
+ MCU ROM JEP106 identity bank 0, code 0x20
199
+ Vendor STMicroelectronics
200
+ Product line STM32U595/U599/U5A5/U5A9
201
+ Part number STM32U595/U599/U5A5/U5A9 (exact ordering code unavailable from MCU-ROM
202
+ part)
203
+ RAM 2512 KiB
204
+ Flash 4096 KiB
205
+ Package type 0xF70C (raw package code; package type mapping unavailable)
206
+ Serial number 0x000900263936500820313148 (96-bit UID)
207
+ ```
208
+
209
+ `lscpu` reads the architected CPUID register and discovers the Cortex-M
210
+ CoreSight ROM table. It validates the component identity, uses the JEP106
211
+ vendor identity and component part number to select a documented STM32
212
+ profile, and reads only that profile's signature locations. It does not use
213
+ legacy DBGMCU identification registers or guess an exact ordering code.
214
+
215
+
216
+ ### `fault_info`
217
+
218
+ Analyzes Cortex-M fault status registers and the stacked exception frame. It
219
+ decodes HardFault, MemManage, BusFault, UsageFault, and SecureFault details,
220
+ resolves stacked `PC` and `LR` addresses when symbols are available, and
221
+ reports likely causes such as invalid execution, null-pointer access, stack
222
+ overflow, divide-by-zero, or unaligned access.
223
+
224
+ ```gdb
225
+ (gdb) fault_info
226
+ ARM Cortex-M Fault Overview
227
+
228
+ Property Value
229
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
230
+ Target Core Cortex-M33 (r0p4) - Arm
231
+ Active Exception HardFault (Exception #3)
232
+ Execution Mode HANDLER (in exception)
233
+ Current PC 0x080013FC [?]
234
+ Current LR 0xFFFFFFB0 (valid EXC_RETURN)
235
+ Current xPSR 0x69000003 (IPSR=3, T=1)
236
+
237
+ Stacked frame at crash time (Stack: MSP @ 0x200017C8 | Return to:
238
+ Handler (Secure) | Frame: Basic (8 registers))
239
+
240
+ Register Stacked Value Details / Symbol
241
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
242
+ r0 0x00000002
243
+ r1 0x20001804
244
+ r2 0x00000000
245
+ r3 0x20000134
246
+ r12 0x200007E8
247
+ lr 0x00000000 Caller: ?
248
+ pc 0x00000000 <-- Faulting instruction: ?
249
+ xpsr 0x6800000B IPSR=11, T=0 (ARM (invalid on Cortex-M))
250
+
251
+ SCB (System Control Block) Status Registers
252
+
253
+ Register Value Active Flags & Meaning
254
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
255
+ CFSR 0x00000101 IACCVIOL: MPU/security violation on instruction fetch (XN) (MemManage)
256
+ IBUSERR: Bus error on instruction fetch (BusFault)
257
+ ├─ MMFSR 0x01 1 active flag(s)
258
+ ├─ BFSR 0x01 1 active flag(s)
259
+ └─ UFSR 0x0000 0 active flag(s)
260
+ HFSR 0x40000000 FORCED: Fault escalated to HardFault (source handler disabled/masked)
261
+ MMFAR 0x200017DC [INVALID] Region: SRAM
262
+ BFAR 0x200017DC [INVALID] Region: SRAM
263
+ DFSR 0x00000008 VCATCH: Vector catch triggered
264
+ SHCSR 0x00050084 Enabled configurable handlers: MemManage, UsageFault
265
+ VTOR 0x08000000 Vector table @ CODE (Flash / ROM)
266
+
267
+ Diagnostics & Probable Causes
268
+ • HardFault escalation: A BusFault was forced to HardFault (source handler disabled in SHCSR).
269
+ • Instruction Fetch BusFault: Attempted execution from an invalid or inaccessible memory region
270
+ (corrupted function pointer, overwritten vtable).
271
+ • MPU violation on instruction: Attempted execution in an MPU region marked eXecute-Never (XN). --Type <RET> for more, q to quit, c to continue without paging--
272
+
273
+ • Crash location: Instruction at 0x00000000 (?), called from 0x00000000 (?).
274
+ ```
275
+
276
+ The command accepts no arguments and is intended to be run after the target
277
+ has stopped in a fault handler.
278
+
279
+ `showstack` and `showstack dump` provide an overview. `showstack frame list`
280
+ lists consecutive frames, while `showstack frame <N>` gives a detailed report
281
+ for one frame. `showstack select` accepts `msp`, `psp`, or `auto` and affects
282
+ subsequent inspections.
283
+
284
+ ### `svd`
285
+
286
+ Loads CMSIS-SVD descriptions and uses them to inspect, modify, monitor, and
287
+ export live peripheral register state.
288
+
289
+ ```gdb
290
+ (gdb) svd load
291
+ (gdb) svd read /path/to/STM32F401.svd
292
+ (gdb) svd show GPIOA
293
+ (gdb) svd show GPIOA MODER
294
+ (gdb) svd write GPIOA MODER 0xA8000000
295
+ (gdb) svd monitor USART1 SR
296
+ (gdb) svd dump all /tmp/mcu-state.json
297
+ (gdb) svd list
298
+ ```
299
+
300
+ - `svd load` detects the target and loads a matching SVD when possible.
301
+ - `svd read <file.svd>` loads a local SVD explicitly.
302
+ - `svd show <peripheral> [<register>]` reads a peripheral or decodes one
303
+ register's bitfields.
304
+ - `svd write <peripheral> <register> <value>` writes and reads back a value.
305
+ - `svd monitor <peripheral> <register>` installs a write watchpoint and shows
306
+ changed bitfields when it triggers.
307
+ - `svd dump <peripheral|all> <file.json>` exports a live JSON snapshot.
308
+ - `svd list` lists the loaded device peripherals.
309
+
310
+ Here is a typical example output:
311
+ ```
312
+ (gdb) svd read STM32N657.svd
313
+ SVD File Loaded Successfully
314
+
315
+ Property Value
316
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
317
+ File Path /path/to/STM32N657.svd
318
+ Device Name STM32N657
319
+ Version 1.0
320
+ Peripherals Loaded 248
321
+ ```
322
+
323
+ Use `svd help` for the complete command syntax.
324
+
325
+ ### `rtos`
326
+
327
+ Selects an RTOS and inspects its project and tasks from GDB. **Camelot is the
328
+ only supported RTOS today**; the `rtos select <name>` command and per-RTOS
329
+ modules are designed so additional RTOS implementations can be added later.
330
+
331
+ ```gdb
332
+ (gdb) rtos list
333
+ (gdb) rtos select camelot
334
+ (gdb) rtos load-project --from /path/to/camelot/project
335
+ (gdb) rtos show
336
+ (gdb) rtos show task calculator-app
337
+ (gdb) rtos showsched 8
338
+ (gdb) continue
339
+ ```
340
+
341
+ - `rtos list` lists supported RTOS names and marks the current selection.
342
+ - `rtos load-project --from <path>` reads the Camelot `project.toml` and loads
343
+ symbols from the built kernel and application ELFs. The project must already
344
+ be built; dummy ELFs are ignored.
345
+ - `rtos show` displays the kernel and task memory layout and build-time task
346
+ metadata, including the idle task's mapping.
347
+ - `rtos show task <taskname>` reads a stopped target's live task state, pending
348
+ events, and stack usage. GDB resolves symbols in the task backtrace when
349
+ available; a suspended task's saved PC/LR do not provide a complete unwind.
350
+ Loaded SVD data can supply names for pending interrupts.
351
+ - `rtos showsched <num>` observes the next `<num>` calls to `sched_elect()` and
352
+ displays a Rich scheduling chart when the requested elections have occurred.
353
+ Continue the target after installing the trace.
354
+
355
+
356
+
357
+ ```
358
+ (gdb) rtos showsched 8
359
+ Tracing 8 scheduler elections. Continue the target to collect them.
360
+ (gdb) c
361
+ Continuing.
362
+ Task scheduling: elections 1-8
363
+
364
+ Task 1 2 3 4 5 6 7 8
365
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
366
+ calculator-app ● ● · · · · · ·
367
+ idle · · ● ● ● ● ● ●
368
+ ```
369
+
370
+ ```
371
+ (gdb) rtos show
372
+ Kernel
373
+
374
+ Region Address range Access
375
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
376
+ text 0x08000000-0x0800A248 R-X
377
+ ram 0x20000000-0x20001848 RW-
378
+
379
+ .task_list: 0x08000270-0x080008B0 (8 slots, 200 bytes each)
380
+ Task: idle
381
+
382
+ Region Address range Access
383
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
384
+ text 0x0800C000-0x0800C500 R-X
385
+ ram 0x20004000-0x20004200 RW-
386
+
387
+ No task metadata in .task_list
388
+ Task: calculator-app
389
+
390
+ Region Address range Access
391
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
392
+ text 0x0800D000-0x0800F880 R-X
393
+ ram 0x20008000-0x20008560 RW-
394
+
395
+ Metadata: calculator-app (slot 0 at 0x08000270)
396
+
397
+ Field Value
398
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
399
+ magic 0xDEADCAFE
400
+ version 1
401
+ label 0xC001F002
402
+ priority 2
403
+ quantum 2
404
+ capabilities 0x3
405
+ flags 0x1
406
+ [...]
407
+ ```
408
+
409
+ ```
410
+ (gdb) rtos show task calculator-app
411
+ Task: calculator-app
412
+
413
+ Region Address range Access
414
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
415
+ text 0x0800D000-0x0800F880 R-X
416
+ ram 0x20008000-0x20008560 RW-
417
+
418
+ Kernel context
419
+
420
+ Field Value
421
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
422
+ State JOB_STATE_WAITFOREVENT
423
+ Handle 0x0005B883
424
+ Saved SP 0x200084C4
425
+
426
+ Stack
427
+
428
+ Measure Value
429
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
430
+ Bounds 0x20008424-0x2000854C
431
+ SP 0x200084C4 (saved)
432
+ Usage 136/296 bytes (45.9%)
433
+
434
+ Pending events
435
+
436
+ Type Source Value
437
+ ━━━━━━━━━━━━━━━━━━━━━━━
438
+ None
439
+
440
+ Backtrace
441
+
442
+ Frame Location
443
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
444
+ saved pc 0x0800ED84 __sys_wait_for_event + 8
445
+ saved prev_lr 0x0800D0AF main + 130
446
+ saved lr 0xFFFFFFBC
447
+ Note Full unwinding of an inactive task requires its register context in GDB
448
+ ```
449
+
450
+ ### `secscan`
451
+
452
+ Audits the security configuration of a Cortex-M-based SoC and produces a
453
+ clear security report. The audit covers generic Arm Cortex-M security
454
+ mechanisms and adds STM32-specific checks when the target is identified as an
455
+ STM32 device.
456
+
457
+ ```gdb
458
+ (gdb) secscan audit
459
+ secscan audit summary
460
+ Core: Cortex-M33 | Vendor: STMicroelectronics | Device: STM32U595/U599/U5A5/U5A9
461
+ Generated: 2026-09-20T09:26:08+00:00
462
+ FAIL: 1 WARN: 5 INFO: 6 PASS: 9
463
+
464
+ MPU
465
+
466
+ Severity Finding Detail
467
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
468
+ FAIL MPU is disabled MPU_CTRL.ENABLE=0 while 8 region(s) are implemented; no memory
469
+ protection is active.
470
+
471
+ CMSIS Core Security
472
+
473
+ Severity Finding Detail
474
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
475
+ WARN Configurable fault handlers disabled MemManage, BusFault, UsageFault disabled in
476
+ SHCSR; these faults will escalate to HardFault.
477
+ WARN Division-by-zero trap disabled CCR.DIV_0_TRP=0: integer division by zero
478
+ silently returns 0 instead of faulting.
479
+ INFO Unaligned-access trap disabled CCR.UNALIGN_TRP=0: unaligned accesses are
480
+ silently allowed except for LDM/STM/PUSH/POP.
481
+ INFO Debug access is currently enabled DHCSR.C_DEBUGEN=1: ensure the debug port is
482
+ disabled/locked in production.
483
+
484
+ TrustZone (SAU)
485
+
486
+ Severity Finding Detail
487
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
488
+ INFO TrustZone-M not used SAU implements 0 regions and is disabled; this is likely a
489
+ non-secure-only build.
490
+
491
+ Fault Handlers (VTOR)
492
+
493
+ Severity Finding Detail
494
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
495
+ INFO Vector table base VTOR=0x08000000.
496
+ PASS NMI handler is present 0x080013FD.
497
+ PASS HardFault handler is present 0x080013FD.
498
+ PASS MemManage handler is present 0x080013FD.
499
+ WARN MemManage handler configured but not SHCSR bit 16 is clear; faults will
500
+ enabled escalate to HardFault instead.
501
+ PASS BusFault handler is present 0x080013FD.
502
+ WARN BusFault handler configured but not SHCSR bit 17 is clear; faults will
503
+ enabled escalate to HardFault instead.
504
+ PASS UsageFault handler is present 0x080013FD.
505
+ WARN UsageFault handler configured but not SHCSR bit 18 is clear; faults will
506
+ enabled escalate to HardFault instead.
507
+ PASS SVCall handler is present 0x080013FD.
508
+ PASS PendSV handler is present 0x080013FD.
509
+ PASS SysTick handler is present 0x080013FD.
510
+ [...]
511
+ (gdb) secscan report /tmp/security-report.json
512
+ ```
513
+
514
+ - `secscan audit` analyzes the MPU configuration, checks that regions are
515
+ valid and non-overlapping, and verifies suitable write/read/execute
516
+ permissions. It also checks that stacks and RAM are non-executable and that
517
+ executable Flash is not writable.
518
+ - The audit checks the security-related CMSIS peripheral mechanisms available
519
+ on the target and analyzes whether Arm TrustZone is enabled and correctly
520
+ configured.
521
+ - It verifies the VTOR and critical exception handlers, including UsageFault
522
+ and MemManage, and checks that the core fault mechanisms are present.
523
+ - On STM32 targets, it also checks the device's read-out protection (RDP)
524
+ state.
525
+ - `secscan report <report.json>` writes a clear report of the security state
526
+ to a JSON file.
527
+
528
+ ## More documentation
529
+
530
+ The [`doc/`](doc/) directory contains deeper technical documentation:
531
+
532
+ - [`fault_info`](doc/fault_info.md)
533
+ - [`lscpu`](doc/lscpu.md)
534
+ - [`rtos` commands](doc/rtos.md) and [Camelot support](doc/rtos-camelot.md)
535
+ - [`secscan`](secscan.md)
536
+ - [unified session](doc/session.md)
537
+ - [`svd`](doc/svd.md)
538
+
539
+ ## STM32 `lscpu` metadata
540
+
541
+ `lscpu` reads CPUID, then discovers the memory-mapped MCU CoreSight ROM table
542
+ at `0xE00FE000`; if no valid table is found there, it tries `0xE00FF000`. A
543
+ valid first table is traversed through its nested entries rather than probing a
544
+ second independent root. The selected table's Component and Peripheral ID
545
+ registers provide the JEP106 bank/code identity and 12-bit component part used
546
+ to select a vendor profile. `lscpu` then reads only the selected profile's
547
+ documented electronic-signature locations. No Debug Port, MEM-AP, or vendor
548
+ debug-identification register is required or read. In particular, the strict
549
+ no-DBGMCU policy has no legacy register fallback.
550
+
551
+ An unknown, invalid, or inaccessible MCU ROM root, or an ST part not in the
552
+ MCU-ROM mapping, produces a generic Cortex-M report instead of guessing from
553
+ legacy device identifiers. The local signature catalog is derived from ST's
554
+ official CMSIS device headers (addresses, fixed SRAM blocks, and `FLASH_SIZE`
555
+ fallback semantics); headers are not vendored:
556
+
557
+ - [`cmsis-device-c0`](https://github.com/STMicroelectronics/cmsis-device-c0),
558
+ [`cmsis-device-f0`](https://github.com/STMicroelectronics/cmsis-device-f0),
559
+ [`cmsis-device-f1`](https://github.com/STMicroelectronics/cmsis-device-f1),
560
+ [`cmsis-device-f2`](https://github.com/STMicroelectronics/cmsis-device-f2),
561
+ [`cmsis-device-f3`](https://github.com/STMicroelectronics/cmsis-device-f3),
562
+ [`cmsis-device-f4`](https://github.com/STMicroelectronics/cmsis-device-f4), and
563
+ [`cmsis-device-f7`](https://github.com/STMicroelectronics/cmsis-device-f7)
564
+ - [`cmsis-device-g0`](https://github.com/STMicroelectronics/cmsis-device-g0),
565
+ [`cmsis-device-g4`](https://github.com/STMicroelectronics/cmsis-device-g4),
566
+ [`cmsis-device-l0`](https://github.com/STMicroelectronics/cmsis-device-l0),
567
+ [`cmsis-device-l1`](https://github.com/STMicroelectronics/cmsis-device-l1),
568
+ [`cmsis-device-l4`](https://github.com/STMicroelectronics/cmsis-device-l4),
569
+ [`cmsis-device-l5`](https://github.com/STMicroelectronics/cmsis-device-l5),
570
+ [`cmsis-device-u0`](https://github.com/STMicroelectronics/cmsis-device-u0),
571
+ [`cmsis-device-u5`](https://github.com/STMicroelectronics/cmsis-device-u5),
572
+ [`cmsis-device-wb`](https://github.com/STMicroelectronics/cmsis-device-wb),
573
+ [`cmsis-device-wba`](https://github.com/STMicroelectronics/cmsis-device-wba), and
574
+ [`cmsis-device-wl`](https://github.com/STMicroelectronics/cmsis-device-wl)
575
+ - [H5](https://github.com/STMicroelectronics/cmsis-device-h5),
576
+ [H7](https://github.com/STMicroelectronics/cmsis-device-h7),
577
+ [H7RS](https://github.com/STMicroelectronics/cmsis-device-h7rs), and
578
+ [U3](https://github.com/STMicroelectronics/cmsis-device-u3)
579
+ - [C5 Device Family Pack](https://github.com/STMicroelectronics/stm32c5xx-dfp)
580
+ and [N6 CMSIS headers](https://github.com/STMicroelectronics/cmsis-device-n6)
581
+
582
+ The MCU-ROM component part identifies a documented product line, not an
583
+ orderable SKU. `lscpu` therefore never invents an exact ordering code. Where ST
584
+ does not publish a family-specific package-code-to-package-name mapping, it
585
+ prints the raw package code and explicitly says that the package type cannot be
586
+ mapped.
@@ -0,0 +1,36 @@
1
+ pyGdbToolkit/__init__.py,sha256=afz17VLGxVpa9cbagpXQ4InlnfbwDConrDnJLRmcSOE,1461
2
+ pyGdbToolkit/cmd_faultinfo.py,sha256=VxeP7Qj5qb0mfVGm6gDW31FkfMuHhknCcSksPCBYSYg,3237
3
+ pyGdbToolkit/cmd_lscpu.py,sha256=yjVOFDheDqJYwwLvwYFEAjhZFSLxUYy0jjSdkiVxWek,3722
4
+ pyGdbToolkit/cmd_profile.py,sha256=RBINJAxNsd2FIBPmkgVxgfyGF2DSX4803QXUCeu_-vI,47755
5
+ pyGdbToolkit/cmd_rtos.py,sha256=1go-uBQiqMPicRVPr1e8usPQX2-YeT0mo1KpDN0PCVo,12227
6
+ pyGdbToolkit/cmd_secscan.py,sha256=Z9nFtCWfx2b3AUjtk6Q2CY8jJvqFJ0wvDe60-is7h5w,16594
7
+ pyGdbToolkit/cmd_svd.py,sha256=Pky7vAMAQZHYfjQd6Ti6bt04KEFQrmkfddkt4cQfqsc,40731
8
+ pyGdbToolkit/diagnostic_runtime.py,sha256=TbCbcQwjrk-4Yx0kvgAz1dG9dggEc67VAVaKeVVoQ4I,1800
9
+ pyGdbToolkit/session.py,sha256=B3DkdU5tGktp8tgfB7RcxVgoEoAoVlm6XL7kAhPsUGI,7638
10
+ pyGdbToolkit/svd.py,sha256=Djzz1fttLEcr6MKHjsOjVHebuCKtgJQCsmeqT1BVSCI,35779
11
+ pyGdbToolkit/target_memory.py,sha256=Yu5YAWxDWSO3zC7eJ22x5sLFhQF0YFqKdmF3UL7ruC0,5756
12
+ pyGdbToolkit/arch/__init__.py,sha256=NZfO8idcG2KQLX-IddVTeW8xXSverz8wnEh5Lw32pDU,2149
13
+ pyGdbToolkit/arch/base.py,sha256=ghu_7kG_28kTxR5NvR5SQSb1fItoDwU-_4xaaBzJMhY,4458
14
+ pyGdbToolkit/arch/diagnostics.py,sha256=sny-z6jg5-sbKb7V29mqTJHuzmZVy0lM4W54TAGKLGk,10009
15
+ pyGdbToolkit/arch/registry.py,sha256=w9CqCR3MnAs-SJ1oOa0nI4rfihUtpAyUnDNlpAr6Tgw,1404
16
+ pyGdbToolkit/arch/arm/__init__.py,sha256=nlMJ_ciSWd5k0grZlyQOUG0HLGgwklje_Wg5qTfCkOg,447
17
+ pyGdbToolkit/arch/arm/coresight.py,sha256=kWF2YQw04ISu6ZZUSruQBC8z3RFSfgZ5Ac2GSgTuK4o,13899
18
+ pyGdbToolkit/arch/arm/cortex_m.py,sha256=rOi0hW1nHgbyjAiE35niOouVCSpKFg_4zJ1MwrbsJPs,14361
19
+ pyGdbToolkit/arch/arm/fault.py,sha256=V9liLNEC00NCbbSzaZmDwyAcapdee5m_UOQ-3R4SzHc,25654
20
+ pyGdbToolkit/arch/arm/models.py,sha256=-5lLbHOdZpyxXHwUX72gHJe0wvS-n-y1r9o23EnbnTs,1804
21
+ pyGdbToolkit/arch/arm/mpu.py,sha256=U7nvghsTk6F4jI1sVgaTTPsa_f3Y4ji8KSogcbGC90w,16981
22
+ pyGdbToolkit/arch/arm/probe.py,sha256=_JhUWmjCp5JuRUdLjkM_wjvn3aorIvLBnrrGpRerKy0,248
23
+ pyGdbToolkit/arch/arm/sau.py,sha256=NHcX6XOwuNlxz6oHbRxF21G5X10SN8mo6FPptiB6ERo,8129
24
+ pyGdbToolkit/arch/arm/security.py,sha256=3gjPd213JK-qe5GwiK52fudvBNRF8bkvs8SE09lhhlo,32708
25
+ pyGdbToolkit/arch/arm/session_state.py,sha256=kejDNY3Q8gWWtSoXDVIlI_8OJj2Ldlf6OJaPfFpR22k,3022
26
+ pyGdbToolkit/arch/arm/target.py,sha256=ayyB9up23HWoF8-PXIT2H5QE5I252NlK6-UJnsfOpWA,904
27
+ pyGdbToolkit/arch/arm/providers/__init__.py,sha256=YQ0imNUML8bkJt322B2xLvBOyZUDs3HVPDXY4WVfMHg,442
28
+ pyGdbToolkit/arch/arm/providers/base.py,sha256=-sdA_ZZ_cH8fw9hZXZ-syy59RjQ-fxSY0IS7D0nsreg,2713
29
+ pyGdbToolkit/arch/arm/providers/manufacturers/__init__.py,sha256=rajH93AtdUEi2lnfpZU4Amj-J7Ovx32ZM5rIPQxvlc8,149
30
+ pyGdbToolkit/arch/arm/providers/manufacturers/stm32.py,sha256=nuv7OVYoeN0vpTKKYSdGn0RxQh45gBupEbeXxaFMIII,25497
31
+ pyGdbToolkit/rtos/__init__.py,sha256=rFPaKK43KkzMjZl1c9TEF6iNxiMF1cqA1HS6KYbNifM,212
32
+ pyGdbToolkit/rtos/camelot.py,sha256=w9uTc0ld-PHbdJWNmzmJEsgzF9X51ubHxr60fUmsuDY,21653
33
+ pygdbtoolkit-0.1.0.dist-info/METADATA,sha256=tJs24aWElW7k-MHFvdgaub7n0VG21DipKd3Dxqs9c2k,35019
34
+ pygdbtoolkit-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
35
+ pygdbtoolkit-0.1.0.dist-info/top_level.txt,sha256=ft1DlNCh4w6nmE3fQ-KpWGKJs6fRRieZB_I2AmDPWIA,13
36
+ pygdbtoolkit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pyGdbToolkit