This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Data walker extension


Hi there,


I've written an extension for gdb in python so you can walk over data structures (similar to mdb ::walk).

The principle of the thing is

pipe <for each element in a data structure> | if <element is interesting> | show <do some gdb command>

and variations thereon.


As an example, printing at all elements that have value 100 in a hypothetical list starting at `mylist_head` and is NULL terminated

pipe follow-until mylist_head; {} == 0; ((mylist_T *){})->next | if ((mylist_T *){})->value == 100 | show print *(mylist_T *){}


I was hoping people could try it out and give me some feedback. It's a bit raw at the moment (most error messages come with a stack trace and suchlike) but I'm finding it pretty useful already.


More complicated walkers can be written for specific applications, I've written some for neovim data structures in the bundled_walkers/ directory.

If people want to add or request specific walkers I'd like to hear that too.


The repo is here https://github.com/hardenedapple/gdb-walkers/


Thank you,

Matthew Malcomson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]