Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

call_function for non-kernel programs #471

Open
Tracked by #320
septatrix opened this issue Mar 6, 2025 · 3 comments
Open
Tracked by #320

call_function for non-kernel programs #471

septatrix opened this issue Mar 6, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@septatrix
Copy link
Contributor

septatrix commented Mar 6, 2025

I would like to call functions for/from normal userspace progs. The only available thing I found, however, was drgn.helpers.experimental.kmodify.call_function which seems to be reserved for usage when prog is the kernel. Is there an alternative for debugging normal programs?

PS: This is primarily for functions in coredumps, not in running programs. My current use-case is exploring binary files for which I am using the "Custom Programs" snipped but it might also be useful for paused, non-custom programs

@osandov
Copy link
Owner

osandov commented Mar 6, 2025

drgn doesn't have a way to do this for userspace at the moment, unfortunately. Adding this for live programs is feasible but needs a bunch of preparation work (see #320; I'll add this request there, too).

Doing this for core dumps would be an extra step on top of that. You need a running process to actually execute the function, so we'd have to do some extra craziness like run the binary with a breakpoint at main, or fabricate a process with its memory initialized from the core dump.

In short, I love the idea but am currently prioritizing kernel support.

@osandov osandov added the enhancement New feature or request label Mar 6, 2025
@septatrix
Copy link
Contributor Author

In short, I love the idea but am currently prioritizing kernel support.

Completely understandable, thanks for the great tool by the way. I am currently doing a kernel programming course at university where we develop our own simple filesystem and it is really helpful! I am actually using it to traverse the block device and output a DOT file to graphviz for debugging/visualization

@osandov
Copy link
Owner

osandov commented Mar 7, 2025

I am actually using it to traverse the block device and output a DOT file to graphviz for debugging/visualization

That sounds really cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants