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

Attaching gdb from junest, to a process launched outside of junest fails #269

Open
jcelerier opened this issue Aug 19, 2021 · 7 comments
Open

Comments

@jcelerier
Copy link

Hello,

I installed Junest in the hope of being able to use GDB 10 on my raspberry pi (running Debian Buster).
If I run Debian's gdb 8 I can attach to my process.
But if I run under junest's gdb 10.2, then I get a "ptrace: operation not permitted" error.
I tried running under root and junest -f but that did not change anything.

What else could I look at ?

Thanks !

@fsquillace
Copy link
Owner

Can you provide the exact steps that brought you to the error? I can try to reproduce.

@jcelerier
Copy link
Author

I'll look into my bash history !

@jcelerier
Copy link
Author

jcelerier commented Sep 7, 2021

pi $ git clone git://github.com/fsquillace/junest ~/.local/share/junest
pi $ export PATH=~/.local/share/junest/bin:$PATH
pi $ junest setup
pi $ junest -f
junest-root $ pacman -S gdb
junest-root $ exit
pi $ junest
junest $ gdb
(gdb) attach <some pid>
Attaching to process <...>
ptrace: Operation not permitted.

@fsquillace
Copy link
Owner

Not all processes can be debugged. Consider that this can happen even if you try using gdb outside junest, I'd suggest to try that first if you can.

In order to enable ptrace capabilities in junest you'd need to run something like:

junest -f -b "--cap-add ALL"

I am inclined to use it --cap-add ALL as default option when running as fakeroot. I will check if there are no side-effects.

@jcelerier
Copy link
Author

jcelerier commented Sep 21, 2021

Not all processes can be debugged. Consider that this can happen even if you try using gdb outside junest, I'd suggest to try that first if you can.

I can debug the process I want with my Pi's /usr/bin/gdb without issues (except that it's too old for the DWARF-5 debug info format used by the app I want to debug)

I'll try the ptrace thing, thanks !

@fsquillace
Copy link
Owner

Cool, thanks. Let me know if that works 🤞

@fsquillace
Copy link
Owner

In the latest junest change I put --cap-add ALL as default to the ns fakeroot mode.

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

No branches or pull requests

2 participants