This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, Uli Weigand debugged and fixed a problem with the bi-arch gdb on s390*. The problem is the bit size of the thread register. For 31 bit the thread pointer is stored in %a0, a 32 bit register. For 64 bit it is stored in %a0 and %a1, since the size of the access registers have not been increased from 32 bit to 64 bit. So far so good. ptrace delivers the access register as 32 bit values on s390-32. On s390-64 bit ptrace delivers the access registers as 64 bit (!) values. The reason is that the ptrace interface is defined on an array of longs. Since the thread register is stored in %a0 and %a1 in the proper high/low order on s390-64 this works out. The ptrace register number 18 is either %a0 on s390-32 or %a0 and %a1 on s390-64. Unluckily this doesn't work for the descriptor for 32 bit programs running on a 64 bit system. The thread pointer is stored in the upper half of the ptrace register 18. Uli solution is to add another argument to the REGISTER macro which specifies the bit size of the thread register. His patch obviously doesn't change the behaviour of the other nptl architectures and he tested it for s390*. blue skies, Martin. nptl/ChangeLog: 2003-12-11 Ulrich Weigand <uweigand@de.ibm.com> * sysdeps/alpha/tls.h (DB_THREAD_SELF): Pass bit size of thread register as second paramter to the REGISTER macro. * sysdeps/ia64/tls.h (DB_THREAD_SELF): Likewise. * sysdeps/powerpc/tls.h (DB_THREAD_SELF): Likewise. * sysdeps/sh/tls.h (DB_THREAD_SELF): Likewise. * sysdeps/sparc/tls.h (DB_THREAD_SELF): Likewise. * sysdeps/s390/tls.h (DB_THREAD_SELF): Pass __WORDSIZE as bit size of thread register as second parameter to REGISTER macro. nptl_db/ChangeLog: 2003-12-11 Ulrich Weigand <uweigand@de.ibm.com> * db_info.c (REGISTER): Add bit size of thread register as second parameter to REGISTER macro. diff -urN libc/nptl/sysdeps/alpha/tls.h libc-s390/nptl/sysdeps/alpha/tls.h --- libc/nptl/sysdeps/alpha/tls.h 2003-09-09 09:00:21.000000000 +0200 +++ libc-s390/nptl/sysdeps/alpha/tls.h 2003-12-11 17:50:33.000000000 +0100 @@ -120,7 +120,7 @@ /* Magic for libthread_db to know how to do THREAD_SELF. */ # define DB_THREAD_SELF \ - REGISTER (64, 32 * 8, - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) + REGISTER (64, 64, 32 * 8, - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) /* Identifier for the current thread. THREAD_SELF is usable but sometimes more expensive than necessary as in this case. */ diff -urN libc/nptl/sysdeps/ia64/tls.h libc-s390/nptl/sysdeps/ia64/tls.h --- libc/nptl/sysdeps/ia64/tls.h 2003-12-11 17:49:43.000000000 +0100 +++ libc-s390/nptl/sysdeps/ia64/tls.h 2003-12-11 17:50:33.000000000 +0100 @@ -123,7 +123,7 @@ # define THREAD_SELF (__thread_self - 1) /* Magic for libthread_db to know how to do THREAD_SELF. */ -# define DB_THREAD_SELF REGISTER (64, 13 * 8, -sizeof (struct pthread)) +# define DB_THREAD_SELF REGISTER (64, 64, 13 * 8, -sizeof (struct pthread)) /* Access to data in the thread descriptor is easy. */ #define THREAD_GETMEM(descr, member) \ diff -urN libc/nptl/sysdeps/powerpc/tls.h libc-s390/nptl/sysdeps/powerpc/tls.h --- libc/nptl/sysdeps/powerpc/tls.h 2003-09-09 09:00:21.000000000 +0200 +++ libc-s390/nptl/sysdeps/powerpc/tls.h 2003-12-11 17:50:33.000000000 +0100 @@ -131,9 +131,9 @@ /* Magic for libthread_db to know how to do THREAD_SELF. */ # define DB_THREAD_SELF \ - REGISTER (32, PT_THREAD_POINTER * 4, \ + REGISTER (32, 32, PT_THREAD_POINTER * 4, \ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) \ - REGISTER (64, PT_THREAD_POINTER * 8, \ + REGISTER (64, 64, PT_THREAD_POINTER * 8, \ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE) /* Read member of the thread descriptor directly. */ diff -urN libc/nptl/sysdeps/s390/tls.h libc-s390/nptl/sysdeps/s390/tls.h --- libc/nptl/sysdeps/s390/tls.h 2003-09-09 09:00:21.000000000 +0200 +++ libc-s390/nptl/sysdeps/s390/tls.h 2003-12-11 17:50:33.000000000 +0100 @@ -138,7 +138,8 @@ # define THREAD_SELF ((struct pthread *) __builtin_thread_pointer ()) /* Magic for libthread_db to know how to do THREAD_SELF. */ -# define DB_THREAD_SELF REGISTER (32, 18 * 4, 0) REGISTER (64, 18 * 8, 0) +# define DB_THREAD_SELF REGISTER (32, __WORDSIZE, 18 * 4, 0) \ + REGISTER (64, __WORDSIZE, 18 * 8, 0) /* Access to data in the thread descriptor is easy. */ #define THREAD_GETMEM(descr, member) \ diff -urN libc/nptl/sysdeps/sh/tls.h libc-s390/nptl/sysdeps/sh/tls.h --- libc/nptl/sysdeps/sh/tls.h 2003-09-09 09:00:21.000000000 +0200 +++ libc-s390/nptl/sysdeps/sh/tls.h 2003-12-11 17:50:33.000000000 +0100 @@ -118,7 +118,7 @@ __self - 1;}) /* Magic for libthread_db to know how to do THREAD_SELF. */ -# define DB_THREAD_SELF REGISTER (32, REG_GBR * 4, 0) +# define DB_THREAD_SELF REGISTER (32, 32, REG_GBR * 4, 0) /* Read member of the thread descriptor directly. */ # define THREAD_GETMEM(descr, member) (descr->member) diff -urN libc/nptl/sysdeps/sparc/tls.h libc-s390/nptl/sysdeps/sparc/tls.h --- libc/nptl/sysdeps/sparc/tls.h 2003-09-09 09:00:21.000000000 +0200 +++ libc-s390/nptl/sysdeps/sparc/tls.h 2003-12-11 17:50:33.000000000 +0100 @@ -107,7 +107,7 @@ /* Magic for libthread_db to know how to do THREAD_SELF. */ # define DB_THREAD_SELF_INCLUDE <sys/ucontext.h> # define DB_THREAD_SELF \ - REGISTER (32, REG_G7 * 4, 0) REGISTER (64, REG_G7 * 8, 0) + REGISTER (32, 32, REG_G7 * 4, 0) REGISTER (64, 64, REG_G7 * 8, 0) /* Access to data in the thread descriptor is easy. */ #define THREAD_GETMEM(descr, member) \ diff -urN libc/nptl_db/db_info.c libc-s390/nptl_db/db_info.c --- libc/nptl_db/db_info.c 2003-09-09 08:58:25.000000000 +0200 +++ libc-s390/nptl_db/db_info.c 2003-12-11 17:50:33.000000000 +0100 @@ -91,8 +91,8 @@ # define REGISTER_THREAD_AREA(bits, regofs, scale) \ DB_DEFINE_DESC (_thread_db_register##bits##_thread_area, \ bits, (scale), (regofs)); -# define REGISTER(bits, regofs, bias) \ - DB_DEFINE_DESC (_thread_db_register##bits, bits, (uint32_t)(bias), (regofs)); +# define REGISTER(bits, size, regofs, bias) \ + DB_DEFINE_DESC (_thread_db_register##bits, size, (uint32_t)(bias), (regofs)); DB_THREAD_SELF #endif
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |