When I just run adb shell, I get shell running from uid=2000(shell) gid=2000(shell), without ptrace access to my application.
How to open a
From this answer:
Contain the list of applications installed and their corresponding UID's.
Another answer in the same question suggests:
adb shell dumpsys package com.example.myapp | grep userId=
You can then open your shell as normal and run:
$ su
You should then have the same access and privileges as the app that uses that UID.