{"id":15950163,"url":"https://github.com/vuvova/gdb-tools","last_synced_at":"2025-04-10T00:19:37.505Z","repository":{"id":57433294,"uuid":"90655454","full_name":"vuvova/gdb-tools","owner":"vuvova","description":"Various tools to improve the gdb experience","archived":false,"fork":false,"pushed_at":"2023-07-09T14:06:43.000Z","size":70,"stargazers_count":125,"open_issues_count":4,"forks_count":17,"subscribers_count":11,"default_branch":"arpeggio","last_synced_at":"2025-04-02T23:13:50.844Z","etag":null,"topics":["gdb","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vuvova.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-08T17:37:12.000Z","updated_at":"2024-11-29T08:33:31.000Z","dependencies_parsed_at":"2025-01-17T12:12:55.459Z","dependency_job_id":"95ded64d-8d42-4eaa-aacd-7ded6627f05d","html_url":"https://github.com/vuvova/gdb-tools","commit_stats":{"total_commits":62,"total_committers":2,"mean_commits":31.0,"dds":"0.016129032258064502","last_synced_commit":"c9dd6fa10576f155c401ee7b1c2c8c9d3d15cb2c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuvova%2Fgdb-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuvova%2Fgdb-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuvova%2Fgdb-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vuvova%2Fgdb-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vuvova","download_url":"https://codeload.github.com/vuvova/gdb-tools/tar.gz/refs/heads/arpeggio","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131559,"owners_count":21052873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gdb","python"],"created_at":"2024-10-07T12:58:21.867Z","updated_at":"2025-04-10T00:19:37.485Z","avatar_url":"https://github.com/vuvova.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gdb-tools\n\nThis repository contains various tools used to make the time spent in gdb more\ncomfortable.\n\nTo install these tools, first install the modules with\n\n    pip install gdb-tools\n\nThen you need to import corresponding modules into your gdb. Add, for example,\n\n    py import duel\n\ninto your `~/.gdbinit`. If you plan to use `pretty_printer` module, I'd\nrecommend to put all your python gdb enhancements in `~/.gdb.py` and source it\nfrom `~/.gdbinit`.\n\n## pretty_printer.py\n\nA convenience helper to write **gdb pretty-printers**. Import this module and\nwrite new pretty printers as easy as\n```python\nfrom pretty_printer import PrettyPrinter\n\n@PrettyPrinter\ndef st_bitmap(val):\n    s=''\n    for i in range((val['n_bits']+31)//32):\n        s = format(int(val['bitmap'][i]), '032b') + s\n    return \"b'\" + s[-int(val['n_bits']):] + \"'\"\n```\nHere `val` is a `gdb.Value` object to print, and `st_bitmap` is the type to\npretty-print (alternatively, a type can be passed to the decorator as an\nargument, useful for types that aren't valid Python identifiers). If the type\nhas a name, either typedef'ed name or the underlying actual type can be used in\nthe pretty printer definition (useful, for types like\n`typedef int set_of_flags`). Pointers are resolved automatically:\n```\n(gdb) p map\n$1 = b'001010111'\n(gdb) p \u0026map\n$1 = (st_bitmap *) 0x7fff8610 b'001010111'\n```\n\nImport this module into your `~/.gdb.py` and create your own pretty printers\nthere.\n\n## DUEL — Debugging U (might) Even Like\n\nA high level language for exploring various data structures. Created by\nMichael Golan in 1993, who implemented it for gdb 4.x. \"Insanely cool\",\naccording to gdb developers. This is **DUEL.py** — a pure python implementation\nthat uses gdb Python API and the [Arpeggio](https://github.com/igordejanovic/Arpeggio)\nparser. Install arpeggio (or copy it into `duel/` — it's only 20K) and\n`import duel` into your `~/.gdb.py`. Few examples of what DUEL can do:\n\nCommand | Explanation\n------------ | -------------\n`dl ?` | short help\n`dl x[10..20,22,24,40..60]` | display `x[i]` for the selected indexes\n`dl x[9..0]` | display `x[i]` backwards\n`dl x[..100] \u003e? 5 \u003c? 10` | display `x[i]` if `5\u003cx[i]\u003c10`\n`dl val[..50].(is_dx ? x : y)` | `val[i].x` or `val[i].y` depending on `val[i].is_dx`\n`dl x[i:=..100] \u003e? x[i+1]` | check whether `x[i]` is sorted\n`dl (x[..100] \u003e? 0)[[2]]` | return the 3rd positive `x[i]`\n`dl argv[0..]@0` | `argv[0]`, `argv[1]`, etc until first null\n`dl emp[0..]@(code==0)` | `emp[0]`, `emp[1]`, etc until `emp[n].code==0`\n`dl head--\u003enext-\u003eval` | `val` of each element in a linked list\n`dl head--\u003e(left,right)-\u003eval` | `val` of each element in a binary tree\n`dl head--\u003enext[[20]]` | element 20 of list\n`dl #/head--\u003enext` | count elements on a linked list\n`dl #/(head--\u003enext-val\u003e?5)` | count those over 5\n`dl head--\u003e(next!=?head)` | expand cyclic linked list\n\nOr read the [manual](https://github.com/vuvova/gdb-tools/blob/arpeggio/duel/help.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvuvova%2Fgdb-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvuvova%2Fgdb-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvuvova%2Fgdb-tools/lists"}