在我的程序中,IP 前缀存储为 Trie。我想从程序生成的 linux coredump 中转储 trie。我已经有一个 C 函数,它遍历树并打印存储在树中的前缀。但是,使用 gdb 我无法通过调用此函数来转储 trie。是否可以编写一个程序来加载核心并通过链接转储 Trie 的库来调用此函数。 (我正在考虑使用 Python gdb 模块,但这需要我将 C 程序转换为 Python)。
感谢您的帮助。
最佳答案
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).
当然:您可以将源代码构建到共享库中,将共享库包装到 Python 中,然后让 Python 加载并调用它。
但是将 C 程序转换为纯 Python 可能更容易。
关于C 程序模仿 gdb 调用函数在核心上执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44274528/