use gdb api instead of "unsafe" pointer calculation / manual calculation
Tested with Python3 and GDB 10.1 via remote attach to process with ~10.000 vars and cp * and RHEL7 running all tests.
Tested with Python3 and GDB 10.1 via remote attach to process with ~10.000 vars and cp * and RHEL7 running all tests.