gdb read only mode ?
Is there way I can restrict gdb level to read only. So I will not be able to modify current data in gdb.
Can gdbserver or any other tool help in this case?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
If you don't want to allow devs to change things, why don't you give them a coredump ?
A coredump is a dump of the memory map of the process. With this and the binary who generate the coredump, you can debug your application without running it (just need debug information).
To generate a coredump, use
There's no read-only mode for gdb, and gdb isn't the only way to debug a program anyway (it has no special permissions). Gdb uses ptrace underneath, and the ptrace permissions are all-or-nothing.
There are security frameworks that restrict the use of ptrace. For example,
Recent Ubuntu versions restrict
ptrace to the parent process by default. But these restrictions are about who can use ptrace on what process, not what ptrace commands are permitted. I'm not aware of a framework that has fined-grained permissions that distinguish between ptrace commands.
You seem to want to allow developers to investigate problems live on production servers, without letting them modify the way these systems behave. A solution to this problem is to run all servers in virtual machines. If a problem occurs, make a snapshot of the virtual machine, copy it out, and let the developers work from the snapshot (disconnected from the network). That even makes the developers' work easier since they can restart their debugging as many times as they like, from the saved snapshot.