aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-linux-nat.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-08-26 19:34:53 +0000
committerAndrew Cagney <cagney@redhat.com>2003-08-26 19:34:53 +0000
commitcc7ad3eab346356ca03eab6d987401d12fbffd45 (patch)
treef81a0d3daa84fd72f76ba5fb45587ddba2b103bf /gdb/i386-linux-nat.c
parentaf8b88dd22728115a948af995888e982bb3942b6 (diff)
downloadgdb-cc7ad3eab346356ca03eab6d987401d12fbffd45.zip
gdb-cc7ad3eab346356ca03eab6d987401d12fbffd45.tar.gz
gdb-cc7ad3eab346356ca03eab6d987401d12fbffd45.tar.bz2
2003-08-26 Andrew Cagney <cagney@redhat.com>
* i386-linux-nat.c (ps_get_thread_area): Make "desc" four "int"s in size. Add comments.
Diffstat (limited to 'gdb/i386-linux-nat.c')
-rw-r--r--gdb/i386-linux-nat.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 4e348d9..dbf91b7 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -687,11 +687,31 @@ i386_linux_dr_set (int regnum, unsigned long value)
perror_with_name ("Couldn't write debug register");
}
+/* Called by libthread_db. Return's a pointer to the thread local
+ storage (or it's descriptor). */
extern ps_err_e
ps_get_thread_area(const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
{
- unsigned long int desc[3];
+ /* NOTE: cagney/2003-08-26: The definition of this buffer is found
+ in the kernel header <asm-i386/ldt.h>. It, after padding, is 4 x
+ 4 byte integers in size: "entry_number", "base_addr", "limit",
+ and a bunch of status bits.
+
+ The values returned by this ptrace call should be part of the
+ regcache buffer, and ps_get_thread_area should channel its
+ request through the regcache. That way remote targets could
+ provide the value using the remote protocol and not this direct
+ call.
+
+ Is this function needed? I'm guessing that the "base" is the
+ address of a a descriptor that libthread_db uses to find the
+ thread local address base that GDB needs. Perhaphs that
+ descriptor is defined by the ABI. Anyway, given that
+ libthread_db calls this function without prompting (gdb
+ requesting tls base) I guess it needs info in there anyway. */
+ unsigned int desc[4];
+ gdb_assert (sizeof (int) == 4);
#define PTRACE_GET_THREAD_AREA 25
if (ptrace (PTRACE_GET_THREAD_AREA,