gdb/
authorDoug Evans <dje@google.com>
Sat, 19 Dec 2009 00:29:11 +0000 (00:29 +0000)
committerDoug Evans <dje@google.com>
Sat, 19 Dec 2009 00:29:11 +0000 (00:29 +0000)
* gdb_proc_service.h (psaddr_t): Fix type.
* linux-thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
signature to match glibc.
(thread_db_get_thread_local_address): Use psaddr_t for type of
address to match parameter of td_thr_tls_get_addr_p.
Cast through psaddr_t instead of (void*) to match parameter of
td_thr_tls_get_addr_p.

gdbserver/
* gdb_proc_service.h (psaddr_t): Fix type.
* thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
signature to match glibc.

gdb/ChangeLog
gdb/gdb_proc_service.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/gdb_proc_service.h
gdb/gdbserver/thread-db.c
gdb/linux-thread-db.c

index 16759d3e64094686bf76c503ccd195f28aa03412..16d3f66a04b615461ebcc471c5d177b36da76789 100644 (file)
@@ -1,3 +1,13 @@
+2009-12-18  Doug Evans  <dje@google.com>
+
+       * gdb_proc_service.h (psaddr_t): Fix type.
+       * linux-thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
+       signature to match glibc.
+       (thread_db_get_thread_local_address): Use psaddr_t for type of
+       address to match parameter of td_thr_tls_get_addr_p.
+       Cast through psaddr_t instead of (void*) to match parameter of
+       td_thr_tls_get_addr_p.
+
 2009-12-17  Stan Shebs  <stan@codesourcery.com>
 
        * breakpoint.c (bpstat_check_location): Check for tracepoints.
index de62c9db89713e0873a44d6818d25a1c2ef7f052..721f91c5620b52ab9d1c8730c1d104294bc43932 100644 (file)
@@ -47,7 +47,7 @@ typedef unsigned int lwpid_t;
 #endif
 
 #ifndef HAVE_PSADDR_T
-typedef unsigned long psaddr_t;
+typedef void *psaddr_t;
 #endif
 
 #ifndef HAVE_PRGREGSET_T
index 5a5c86067f2b054e5cf81dad5c8118492ba45ee4..a0a8dd60e43ec6217b0071e0875aef404db69972 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-18  Doug Evans  <dje@google.com>
+
+       * gdb_proc_service.h (psaddr_t): Fix type.
+       * thread-db.c (thread_db_info.td_thr_tls_get_addr_p): Fix
+       signature to match glibc.
+
 2009-12-16  Doug Evans  <dje@google.com>
 
        * linux-low.c (linux_read_memory): Fix argument to read.
index 4d153e6a189736cbe765b95310688bded3acc8ac..ab02e9eb286859d0e8d85f70056f300bca92f283 100644 (file)
@@ -54,7 +54,7 @@ typedef unsigned int lwpid_t;
 #endif
 
 #ifndef HAVE_PSADDR_T
-typedef unsigned long psaddr_t;
+typedef void *psaddr_t;
 #endif
 
 #ifndef HAVE_PRGREGSET_T
index ba6c668c49b18ac169d51e0aaf4db0c469514bf5..f27308263f4ed6e8bf18fcd7c3fad9a832e9104c 100644 (file)
@@ -71,8 +71,8 @@ struct thread_db
                                sigset_t *ti_sigmask_p,
                                unsigned int ti_user_flags);
   td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th,
-                                    void *map_address,
-                                    size_t offset, void **address);
+                                    psaddr_t map_address,
+                                    size_t offset, psaddr_t *address);
   const char ** (*td_symbol_list_p) (void);
 };
 
index c48b87006ef4ba839e2a08336b170bd9e6c27ad4..77ffa565abd07248de6b8fe38e6537e9088f196e 100644 (file)
@@ -153,8 +153,8 @@ struct thread_db_info
                                     int event);
 
   td_err_e (*td_thr_tls_get_addr_p) (const td_thrhandle_t *th,
-                                    void *map_address,
-                                    size_t offset, void **address);
+                                    psaddr_t map_address,
+                                    size_t offset, psaddr_t *address);
 };
 
 /* List of known processes using thread_db, and the required
@@ -1530,7 +1530,7 @@ thread_db_get_thread_local_address (struct target_ops *ops,
   if (thread_info != NULL && thread_info->private != NULL)
     {
       td_err_e err;
-      void *address;
+      psaddr_t address;
       struct thread_db_info *info;
 
       info = get_thread_db_info (GET_PID (ptid));
@@ -1544,8 +1544,11 @@ thread_db_get_thread_local_address (struct target_ops *ops,
       gdb_assert (lm != 0);
 
       /* Finally, get the address of the variable.  */
+      /* Note the cast through uintptr_t: this interface only works if
+        a target address fits in a psaddr_t, which is a host pointer.
+        So a 32-bit debugger can not access 64-bit TLS through this.  */
       err = info->td_thr_tls_get_addr_p (&thread_info->private->th,
-                                        (void *)(size_t) lm,
+                                        (psaddr_t)(uintptr_t) lm,
                                         offset, &address);
 
 #ifdef THREAD_DB_HAS_TD_NOTALLOC