Skip to main content
Minor formatting improvement
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there're some people mentioned), you can redirect it. For example, if your new virtual terminal is:

tty
/dev/pts/16
$ tty
/dev/pts/16

Attach gdbgdb to your program (find the pidpid with psps and grepgrep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)
(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdbgdb, you can interact with it from the new terminal.

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there're some people mentioned), you can redirect it. For example, if your new virtual terminal is:

tty
/dev/pts/16

Attach gdb to your program (find the pid with ps and grep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdb, you can interact with it from the new terminal.

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there're some people mentioned), you can redirect it. For example, if your new virtual terminal is:

$ tty
/dev/pts/16

Attach gdb to your program (find the pid with ps and grep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdb, you can interact with it from the new terminal.

added 1 character in body
Source Link

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there'sthere're some people mentioned), you can redirect it. For example, if your new virtual terminal is:

tty
/dev/pts/16

Attach gdb to your program (find the pid with ps and grep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdb, you can interact with it from the new terminal.

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there's some people mentioned), you can redirect it. For example, if your new virtual terminal is:

tty
/dev/pts/16

Attach gdb to your program (find the pid with ps and grep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdb, you can interact with it from the new terminal.

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there're some people mentioned), you can redirect it. For example, if your new virtual terminal is:

tty
/dev/pts/16

Attach gdb to your program (find the pid with ps and grep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdb, you can interact with it from the new terminal.

Source Link

If you need to hook the currently running program in another virtual terminal (lost access of it or something likely, I see there's some people mentioned), you can redirect it. For example, if your new virtual terminal is:

tty
/dev/pts/16

Attach gdb to your program (find the pid with ps and grep), and

(gdb) close(0)
(gdb) close(1)
(gdb) call open("/dev/pts/16", 2, 0)
(gdb) call open("/dev/pts/16", 2, 1)

Then quit gdb, you can interact with it from the new terminal.