gdb-tools
This repository contains various tools used to make the time spent in gdb more comfortable.
To install these tools, first install the modules with
pip install gdb-tools
Then you need to import corresponding modules into your gdb. Add, for example,
py import duel
into your ~/.gdbinit. If you plan to use pretty_printer module, I'd
recommend to put all your python gdb enhancements in ~/.gdb.py and source it
from ~/.gdbinit.
pretty_printer.py
A convenience helper to write gdb pretty-printers. Import this module and write new pretty printers as easy as
from pretty_printer import PrettyPrinter
@PrettyPrinter
def st_bitmap(val):
s=''
for i in range((val['n_bits']+31)//32):
s = format(int(val['bitmap'][i]), '032b') + s
return "b'" + s[-int(val['n_bits']):] + "'"
Here val is a gdb.Value object to print, and st_bitmap is the type to
pretty-print (alternatively, a type can be passed to the decorator as an
argument, useful for types that aren't valid Python identifiers). If the type
has a name, either typedef'ed name or the underlying actual type can be used in
the pretty printer definition (useful, for types like
typedef int set_of_flags). Pointers are resolved automatically:
(gdb) p map
$1 = b'001010111'
(gdb) p &map
$1 = (st_bitmap *) 0x7fff8610 b'001010111'
Import this module into your ~/.gdb.py and create your own pretty printers
there.
DUEL — Debugging U (might) Even Like
A high level language for exploring various data structures. Created by
Michael Golan in 1993, who implemented it for gdb 4.x. "Insanely cool",
according to gdb developers. This is DUEL.py — a pure python implementation
that uses gdb Python API and the Arpeggio
parser. Install arpeggio (or copy it into duel/ — it's only 20K) and
import duel into your ~/.gdb.py. Few examples of what DUEL can do:
| Command | Explanation |
|---|---|
dl ? |
short help |
dl x[10..20,22,24,40..60] |
display x[i] for the selected indexes |
dl x[9..0] |
display x[i] backwards |
dl x[..100] >? 5 <? 10 |
display x[i] if 5<x[i]<10 |
dl val[..50].(is_dx ? x : y) |
val[i].x or val[i].y depending on val[i].is_dx |
dl x[i:=..100] >? x[i+1] |
check whether x[i] is sorted |
dl (x[..100] >? 0)[[2]] |
return the 3rd positive x[i] |
dl argv[0..]@0 |
argv[0], argv[1], etc until first null |
dl emp[0..]@(code==0) |
emp[0], emp[1], etc until emp[n].code==0 |
dl head-->next->val |
val of each element in a linked list |
dl head-->(left,right)->val |
val of each element in a binary tree |
dl head-->next[[20]] |
element 20 of list |
dl #/head-->next |
count elements on a linked list |
dl #/(head-->next-val>?5) |
count those over 5 |
dl head-->(next!=?head) |
expand cyclic linked list |
Or read the manual.
Metadata
Release files for gdb-tools 1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gdb-tools-1.5.tar.gz | 18.0 kB | Without provenance | Details for gdb-tools-1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gdb_tools-1.5-py3-none-any.whl | Python 3 | none | any | Details for gdb_tools-1.5-py3-none-any.whl |
Total release size: 35.5 kB
Release files / gdb-tools-1.5.tar.gz
| Download URL | gdb-tools-1.5.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34c7e2e4b57e7bcc49cea9384d753ebcbaf5bde4b9da1232d6496edc38f70b93
|
|
BLAKE2b-256 checksum How to use checksums |
119db9664d9108e09e095e3a232c69cc7e58771b3a8abc4f1da4b31a6e2c8be4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / gdb_tools-1.5-py3-none-any.whl
| Download URL | gdb_tools-1.5-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6d50b2a64d2c924a9fae6db9af7e9ab94a0974156ae97293fda921ea0abee0b
|
|
BLAKE2b-256 checksum How to use checksums |
35a8007aba6c6f75d0cce7ec20299556acc766c244b2dfd54bf172d0e73ab991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for gdb-tools 1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.