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

[Feature] allow external debugger to attach #14

Closed
kxxt opened this issue May 9, 2024 · 1 comment · Fixed by #27
Closed

[Feature] allow external debugger to attach #14

kxxt opened this issue May 9, 2024 · 1 comment · Fixed by #27
Assignees
Labels
difficulty-hard enhancement New feature or request priority-high tracer Core tracer component tui TUI
Milestone

Comments

@kxxt
Copy link
Owner

kxxt commented May 9, 2024

Use case:

I have an app my-app and another app B. There's a bug that occurs only when B executes my-app. I want to directly debug my-app when executing B.

And BTW it's very painful to debug multi-process applications in gdb.

How:

  • Add breakpoints on exec(e.g. break when exec my-app)
  • Ask if launching external debugger on breakpoint hit
  • Detach from the tracee to be debugged and launch external debugger(e.g. gdb in a new window) and let it attach to tracee.

Unresolved questions:

  • Is this compatible with seccomp-bpf optimization?
  • How could we transfer ptrace from tracexec to external debugger?
  • Should the breakpoint be triggered on syscall enter stop or syscall exit stop?

Caveats:

  • Further exec events will not be available for the detached tracee.

Alternative

Maybe I could implement gdb server protocol in tracexec and let gdb as a client connect to it. This way further exec events can also be traced.

@kxxt kxxt added enhancement New feature or request priority-low tui TUI tracer Core tracer component difficulty-hard labels May 9, 2024
@kxxt kxxt self-assigned this May 21, 2024
@kxxt kxxt added this to the 0.4 milestone May 21, 2024
@kxxt
Copy link
Owner Author

kxxt commented May 21, 2024

Flagging as high priority because it makes debugging a program invoked by a shell script much easier. I really like it! tracexec will become a debugger launcher. Solves https://stackoverflow.com/questions/5048112/use-gdb-to-debug-a-c-program-called-from-a-shell-script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty-hard enhancement New feature or request priority-high tracer Core tracer component tui TUI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant