Umesh
Umesh

Reputation: 21

C program to mimic gdb call function to execute on core

In my program, IP prefixes are stored as a Trie. I would like to dump the trie from linux coredump generated by the program. I already have a C function which traverses through the tree and prints the prefixes stored in Tree. However, using gdb I can't dump the trie by calling this function. Is it possible to write a program to load the core and call this function by linking the library which dumps the Trie. ( I am thinking of using Python gdb module, but that would require me to convert the C program to Python).

Upvotes: 1

Views: 154

Answers (1)

Employed Russian
Employed Russian

Reputation: 213526

Is it possible to write a program to load the core and call this function by linking the library which dumps the Trie. ( I am thinking of using Python gdb module, but that would require me to convert the C program to Python).

Sure: you can build your source into a shared library, wrap your shared library into Python and have Python load and call it.

But it likely much easier to convert your C program into plain Python instead.

Upvotes: 1

Related Questions