* [PATCH] Remove support for using the bsd-uthread target on FreeBSD.
@ 2017-04-04 18:43 John Baldwin
2017-04-04 19:52 ` Simon Marchi
0 siblings, 1 reply; 3+ messages in thread
From: John Baldwin @ 2017-04-04 18:43 UTC (permalink / raw)
To: gdb-patches
The bsd-uthread target supports an old thread library ("libc_r") that
was last included in FreeBSD release 6.4 released in 2008. However,
this library has not been used as the default library since FreeBSD
5.0 (2003) and 4.11 (2005). Thread support for modern FreeBSD binaries
is provided via "normal" LWP support in core files and the native
FreeBSD target.
gdb/ChangeLog:
* amd64-fbsd-tdep.c: Remove "bsd-uthread.h" include.
(amd64fbsd_jmp_buf_reg_offset): Remove.
(amd64fbsd_supply_uthread): Remove function.
(amd64fbsd_collect_uthread): Remove function.
(amd64fbsd_init_abi): Don't set bsd-uthread callbacks.
* configure.tgt (i[34567]86-*-freebsd*): Remove bsd-uthread.o.
(x86_64-*-freebsd*): Remove bsd-uthread.o.
(fbsd-nat.c): Update comment.
* i386-fbsd-tdep.c: Remove "bsd-uthread.h" include.
(i386fbsd_jmp_buf_reg_offset): Remove.
(i386fbsd_supply_uthread): Remove function.
(i386fbsd_collect_uthread): Remove function.
(i386fbsd_init_abi): Don't set bsd-uthread callbacks.
---
gdb/ChangeLog | 16 ++++++++++++
gdb/amd64-fbsd-tdep.c | 67 ---------------------------------------------------
gdb/configure.tgt | 4 +--
gdb/fbsd-nat.c | 2 +-
gdb/i386-fbsd-tdep.c | 59 ---------------------------------------------
5 files changed, 19 insertions(+), 129 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fc8dbe18da..bd86e7f9ca 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,19 @@
+2017-04-04 John Baldwin <jhb@FreeBSD.org>
+
+ * amd64-fbsd-tdep.c: Remove "bsd-uthread.h" include.
+ (amd64fbsd_jmp_buf_reg_offset): Remove.
+ (amd64fbsd_supply_uthread): Remove function.
+ (amd64fbsd_collect_uthread): Remove function.
+ (amd64fbsd_init_abi): Don't set bsd-uthread callbacks.
+ * configure.tgt (i[34567]86-*-freebsd*): Remove bsd-uthread.o.
+ (x86_64-*-freebsd*): Remove bsd-uthread.o.
+ (fbsd-nat.c): Update comment.
+ * i386-fbsd-tdep.c: Remove "bsd-uthread.h" include.
+ (i386fbsd_jmp_buf_reg_offset): Remove.
+ (i386fbsd_supply_uthread): Remove function.
+ (i386fbsd_collect_uthread): Remove function.
+ (i386fbsd_init_abi): Don't set bsd-uthread callbacks.
+
2017-04-04 Simon Marchi <simon.marchi@polymtl.ca>
* remote.c (set_general_thread, set_continue_thread): Use ptid_t
diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c
index b8ef25821b..48bb209325 100644
--- a/gdb/amd64-fbsd-tdep.c
+++ b/gdb/amd64-fbsd-tdep.c
@@ -28,7 +28,6 @@
#include "x86-xstate.h"
#include "amd64-tdep.h"
-#include "bsd-uthread.h"
#include "fbsd-tdep.h"
#include "solib-svr4.h"
@@ -150,28 +149,6 @@ int amd64fbsd_sc_reg_offset[] =
-1 /* %gs */
};
-/* From /usr/src/lib/libc/amd64/gen/_setjmp.S. */
-static int amd64fbsd_jmp_buf_reg_offset[] =
-{
- -1, /* %rax */
- 1 * 8, /* %rbx */
- -1, /* %rcx */
- -1, /* %rdx */
- -1, /* %rsi */
- -1, /* %rdi */
- 3 * 8, /* %rbp */
- 2 * 8, /* %rsp */
- -1, /* %r8 ... */
- -1,
- -1,
- -1, /* ... %r11 */
- 4 * 8, /* %r12 ... */
- 5 * 8,
- 6 * 8,
- 7 * 8, /* ... %r15 */
- 0 * 8 /* %rip */
-};
-
/* Implement the core_read_description gdbarch method. */
static const struct target_desc *
@@ -226,46 +203,6 @@ amd64fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
}
static void
-amd64fbsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- gdb_byte buf[8];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (amd64fbsd_jmp_buf_reg_offset); i++)
- {
- if (amd64fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- read_memory (addr + amd64fbsd_jmp_buf_reg_offset[i], buf, 8);
- regcache_raw_supply (regcache, i, buf);
- }
- }
-}
-
-static void
-amd64fbsd_collect_uthread (const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- gdb_byte buf[8];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (amd64fbsd_jmp_buf_reg_offset); i++)
- {
- if (amd64fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- regcache_raw_collect (regcache, i, buf);
- write_memory (addr + amd64fbsd_jmp_buf_reg_offset[i], buf, 8);
- }
- }
-}
-
-static void
amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -298,10 +235,6 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_core_read_description (gdbarch,
amd64fbsd_core_read_description);
- /* FreeBSD provides a user-level threads implementation. */
- bsd_uthread_set_supply_uthread (gdbarch, amd64fbsd_supply_uthread);
- bsd_uthread_set_collect_uthread (gdbarch, amd64fbsd_collect_uthread);
-
/* FreeBSD uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index cb909e7f5e..252a66276e 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -201,7 +201,7 @@ i[34567]86-*-dicos*)
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
# Target: FreeBSD/i386
gdb_target_obs="i386-tdep.o i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \
- bsd-uthread.o fbsd-tdep.o solib-svr4.o"
+ fbsd-tdep.o solib-svr4.o"
;;
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
# Target: NetBSD/i386
@@ -685,7 +685,7 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
# Target: FreeBSD/amd64
gdb_target_obs="amd64-tdep.o amd64-fbsd-tdep.o i386-tdep.o \
i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \
- bsd-uthread.o fbsd-tdep.o solib-svr4.o"
+ fbsd-tdep.o solib-svr4.o"
;;
x86_64-*-mingw* | x86_64-*-cygwin*)
# Target: MingW/amd64
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index d99f436070..25952c3a69 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -321,7 +321,7 @@ fbsd_fetch_kinfo_proc (pid_t pid, struct kinfo_proc *kp)
FreeBSD's first thread support was via a "reentrant" version of libc
(libc_r) that first shipped in 2.2.7. This library multiplexed all
of the threads in a process onto a single kernel thread. This
- library is supported via the bsd-uthread target.
+ library was supported via the bsd-uthread target.
FreeBSD 5.1 introduced two new threading libraries that made use of
multiple kernel threads. The first (libkse) scheduled M user
diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c
index b0bf7270bb..594b8f6f0a 100644
--- a/gdb/i386-fbsd-tdep.c
+++ b/gdb/i386-fbsd-tdep.c
@@ -28,7 +28,6 @@
#include "i386-tdep.h"
#include "i387-tdep.h"
-#include "bsd-uthread.h"
#include "fbsd-tdep.h"
#include "solib-svr4.h"
@@ -224,20 +223,6 @@ int i386fbsd_sc_reg_offset[] =
8 + 16 * 4 /* %gs */
};
-/* From /usr/src/lib/libc/i386/gen/_setjmp.S. */
-static int i386fbsd_jmp_buf_reg_offset[] =
-{
- -1, /* %eax */
- -1, /* %ecx */
- -1, /* %edx */
- 1 * 4, /* %ebx */
- 2 * 4, /* %esp */
- 3 * 4, /* %ebp */
- 4 * 4, /* %esi */
- 5 * 4, /* %edi */
- 0 * 4 /* %eip */
-};
-
/* Get XSAVE extended state xcr0 from core dump. */
uint64_t
@@ -333,46 +318,6 @@ i386fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
}
static void
-i386fbsd_supply_uthread (struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- gdb_byte buf[4];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (i386fbsd_jmp_buf_reg_offset); i++)
- {
- if (i386fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- read_memory (addr + i386fbsd_jmp_buf_reg_offset[i], buf, 4);
- regcache_raw_supply (regcache, i, buf);
- }
- }
-}
-
-static void
-i386fbsd_collect_uthread (const struct regcache *regcache,
- int regnum, CORE_ADDR addr)
-{
- gdb_byte buf[4];
- int i;
-
- gdb_assert (regnum >= -1);
-
- for (i = 0; i < ARRAY_SIZE (i386fbsd_jmp_buf_reg_offset); i++)
- {
- if (i386fbsd_jmp_buf_reg_offset[i] != -1
- && (regnum == -1 || regnum == i))
- {
- regcache_raw_collect (regcache, i, buf);
- write_memory (addr + i386fbsd_jmp_buf_reg_offset[i], buf, 4);
- }
- }
-}
-
-static void
i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@@ -400,10 +345,6 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
tdep->sc_reg_offset = i386fbsd_sc_reg_offset;
tdep->sc_num_regs = ARRAY_SIZE (i386fbsd_sc_reg_offset);
- /* FreeBSD provides a user-level threads implementation. */
- bsd_uthread_set_supply_uthread (gdbarch, i386fbsd_supply_uthread);
- bsd_uthread_set_collect_uthread (gdbarch, i386fbsd_collect_uthread);
-
i386_elf_init_abi (info, gdbarch);
/* FreeBSD uses SVR4-style shared libraries. */
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Remove support for using the bsd-uthread target on FreeBSD.
2017-04-04 18:43 [PATCH] Remove support for using the bsd-uthread target on FreeBSD John Baldwin
@ 2017-04-04 19:52 ` Simon Marchi
2017-04-04 21:28 ` John Baldwin
0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2017-04-04 19:52 UTC (permalink / raw)
To: John Baldwin; +Cc: gdb-patches
On 2017-04-04 14:38, John Baldwin wrote:
> The bsd-uthread target supports an old thread library ("libc_r") that
> was last included in FreeBSD release 6.4 released in 2008. However,
> this library has not been used as the default library since FreeBSD
> 5.0 (2003) and 4.11 (2005). Thread support for modern FreeBSD binaries
> is provided via "normal" LWP support in core files and the native
> FreeBSD target.
Thanks again!
By any chance, would you know the same information but for obsd and
nbsd? If not I'll inquire on the relevant mailing lists.
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Remove support for using the bsd-uthread target on FreeBSD.
2017-04-04 19:52 ` Simon Marchi
@ 2017-04-04 21:28 ` John Baldwin
0 siblings, 0 replies; 3+ messages in thread
From: John Baldwin @ 2017-04-04 21:28 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches, Mark Kettenis (mark.kettenis@xs4all.nl)
On Tuesday, April 04, 2017 03:52:28 PM Simon Marchi wrote:
> On 2017-04-04 14:38, John Baldwin wrote:
> > The bsd-uthread target supports an old thread library ("libc_r") that
> > was last included in FreeBSD release 6.4 released in 2008. However,
> > this library has not been used as the default library since FreeBSD
> > 5.0 (2003) and 4.11 (2005). Thread support for modern FreeBSD binaries
> > is provided via "normal" LWP support in core files and the native
> > FreeBSD target.
>
>
> Thanks again!
>
> By any chance, would you know the same information but for obsd and
> nbsd? If not I'll inquire on the relevant mailing lists.
The nbsd architectures in GDB don't use bsd-uthread, only obsd.
Looking at cvsweb for OpenBSD, it seems that OpenBSD switched the default
threading library from a uthread-style libc_r to a LWP-based librthreads
for its thread support in 2012:
http://marc.info/?l=openbsd-cvs&m=132928856921225&w=2
This seems to have been released in OpenBSD 5.1? I believe that the older
uthread-library last shipped in OpenBSD 5.0 in 2011. Presumably Mark (cc'd)
can confirm?
--
John Baldwin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-04 21:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 18:43 [PATCH] Remove support for using the bsd-uthread target on FreeBSD John Baldwin
2017-04-04 19:52 ` Simon Marchi
2017-04-04 21:28 ` John Baldwin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox