aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-linux-nat.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-08-31 15:18:58 +0000
committerMark Kettenis <kettenis@gnu.org>2003-08-31 15:18:58 +0000
commit5bca7895b748abc3e01c88221778bda7e5ad3185 (patch)
tree79cb796396eb87544da5a7837267836568a90b4c /gdb/i386-linux-nat.c
parentbda34dc2c9e8f7a52128439cca8873660a3fee51 (diff)
downloadfsf-binutils-gdb-5bca7895b748abc3e01c88221778bda7e5ad3185.zip
fsf-binutils-gdb-5bca7895b748abc3e01c88221778bda7e5ad3185.tar.gz
fsf-binutils-gdb-5bca7895b748abc3e01c88221778bda7e5ad3185.tar.bz2
* i386-linux-nat.c (ps_get_thread_area): Don't define as extern.
Only define PTRACE_GET_THREAD_AREA is not already defined. Various style fixes in code and comments and some additional spelling fixes in comments. Move after functions dealing with debug registers. * x86-64-linux-nat.c (ps_get_thread_area): Don't define as extern. Fix coding-style.
Diffstat (limited to 'gdb/i386-linux-nat.c')
-rw-r--r--gdb/i386-linux-nat.c75
1 files changed, 40 insertions, 35 deletions
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index dbf91b7..e7a85fa 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -687,41 +687,6 @@ 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)
-{
- /* 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,
- lwpid, (void *) idx, (unsigned long) &desc) < 0)
- return PS_ERR;
-
- *(int *)base = desc[1];
- return PS_OK;
-}
-
void
i386_linux_dr_set_control (unsigned long control)
{
@@ -751,6 +716,46 @@ i386_linux_dr_get_status (void)
}
+/* Called by libthread_db. Returns a pointer to the thread local
+ storage (or its descriptor). */
+
+ps_err_e
+ps_get_thread_area (const struct ps_prochandle *ph,
+ lwpid_t lwpid, int idx, void **base)
+{
+ /* 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);
+
+#ifndef PTRACE_GET_THREAD_AREA
+#define PTRACE_GET_THREAD_AREA 25
+#endif
+
+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid,
+ (void *) idx, (unsigned long) &desc) < 0)
+ return PS_ERR;
+
+ *(int *)base = desc[1];
+ return PS_OK;
+}
+
+
/* Interpreting register set info found in core files. */
/* Provide registers to GDB from a core file.