how to debug application as root in eclipse in Ubuntu?
- Enable your user to run gdb as root without being asked for any password:
sudo visudo
Add the following line after all other rules:<youruser> ALL=(root) NOPASSWD:/usr/bin/gdb
- Create or modify a debug configuration in eclipse to run gdb as root
e.g. in Run > Debug Configurations > C/C++ Application > YourProject Debug:
change Debugger > Main > GDB debugger fromgdb
tosudo -U <youruser> gdb
Update (and warning!):
In his comment nategoose pointed out that this answer should come with a warning:
Enabling a user to use sudo
for gdb
like suggested in my answer in fact gives admin privileges to him/her which in many cases might be an undesired side effect. I therefore consider the answer appropriate in an environment where it's not assumed that the user would try to harm the system (e.g. it's your own personal computer or a virtual machine)
For a multi-(non-trusted)-user environment I think it might be a better idead to utilize unix' file capabilities to enable gdb
to debug an application without the need of admin privileges
ex. test ALL=(root) NOPASSWD:/usr/bin/gdb
test means user account in linux
but before you do this, you would better to make another account because if you restart your computer it will ask password but it doesn't work. So I had to re-insatll ubuntu.
'IT News > Ubuntu' 카테고리의 다른 글
리눅스에서 CPU 정보를 확인하는 8가지 명령어 (cpuinfo, lscpu, hardinfo, lshw, nproc, dmidecode, cpuid, inxi) (0) | 2017.01.10 |
---|---|
ubuntu 64bit 13.10에서 32bit 바이너리 실행 방법. (0) | 2014.09.04 |
리눅스 드라이버를 지원하는 DAQ 리스트 입니다 (0) | 2014.09.01 |