def METHOD_NAME(self, regname: str, which):
    """Supports fetching based on segmented addressing, a la fs:[0x30].
    Requires ptrace'ing the child directory if i386."""
    if pwndbg.gdblib.arch.current == "x86-64":
        return gdb_get_register(regname)
    # We can't really do anything if the process is remote.
    if pwndbg.gdblib.remote.is_remote():
        return 0
    # Use the lightweight process ID
    pid, lwpid, tid = gdb.selected_thread().ptid
    # Get the register
    ppvoid = ctypes.POINTER(ctypes.c_void_p)
    value = ppvoid(ctypes.c_void_p())
    value.contents.value = 0
    libc = ctypes.CDLL("libc.so.6")
    result = libc.ptrace(PTRACE_ARCH_PRCTL, lwpid, value, which)
    if result == 0:
        return (value.contents.value or 0) & pwndbg.gdblib.arch.ptrmask
    return 0