[lldb-dev] inferior can't get terminal size with TIOCGWINSZ

Jay Foad jay.foad at gmail.com
Fri Dec 19 07:33:25 PST 2014


Hi,

I've noticed that an inferior running in the same terminal as lldb
doesn't seem to be able to get the terminal size with TIOCGWINSZ. Is
this expected? I don't have the same problem with gdb.

Test case is below, running on Darwin 14 over an SSH connection.

Thanks,
Jay.


$ cat winsz.c
#include <stdio.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>

int main() {
  struct winsize size;
  int tty = isatty(0);
  int ret = ioctl(0, TIOCGWINSZ, &size);
  printf("tty %d ret %d row %d col %d\n", tty, ret, size.ws_row, size.ws_col);
}
$ clang -o winsz winsz.c
$ ./winsz
tty 1 ret 0 row 24 col 80
$ lldb winsz
(lldb) target create "winsz"
Current executable set to 'winsz' (x86_64).
(lldb) run
Process 43730 launched: '/Users/jay/winsz' (x86_64)
tty 1 ret 0 row 0 col 0
Process 43730 exited with status = 0 (0x00000000)
(lldb)



More information about the lldb-dev mailing list