How to automatically update gdb in tui mode?

If I debug files using gdb -tui, the original window always gets corrupted. Therefore, every time I click enter, I must immediately enter ctrl+ Lto get rid of this problem, as it gdbupdates the window. I am working on tty with gnu screen.

Is it possible to automatically update gdb in tui mode?
If gdb does not have this ability, Python may be the solution because gdb is able to create Python files, but I don't know about Python.

This Python snippet works fine in Bash, but not inside gdb:

import sys
r = "\033[2J"    # here I try to emulate [ctrl-L]
t = ""
while 1:
    i = sys.stdin.read(1)
    t = t +i
    if i == '\n':
        print(r)

Of course, I accept all other languages ​​supported by gdb.
Every help is appreciated.

, https://youtu.be/DqiH6Jym1JY, .

, gdb, show's, mess_up.c

#include <stdio.h>

int main(void){
    //int n = 120;
    int n;
    n = 120;
    char stuff[n+2];

    printf( "Max: %d\n", n );

    printf( "Sizeof int:  %d\n", sizeof(int)  );
    printf( "Sizeof char: %d\n", sizeof(char) );
    printf( "Sizeof n:  %d\n", sizeof n   );
    printf( "Sizeof stuff: %d\n", sizeof stuff  );

    fgets ( stuff , n , stdin );
    printf( "The stuff:\n%s\n", stuff );
    printf( "Sizeof stuff after input = %d\n", sizeof stuff  );

return 0;
}

ncurses, tic -V, ncurses 5.9.20140118

+4
1

. GDB?

~/.gdbinit :

define hook-next
  refresh
end

refresh , next .

:

define mynext
  next
  refresh
end

mynext next.

, C, C-hook-C, , .

. https://sourceware.org/gdb/current/onlinedocs/gdb/Define.html https://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks

/, .

0

Source: https://habr.com/ru/post/1650400/


All Articles