This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 157a65f1ec49022ae14310d773b7b9668e05dfae (commit)
from 84367d277312a8efb03967e52a69cc4e15d9a7ed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 157a65f1ec49022ae14310d773b7b9668e05dfae
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sat May 30 03:23:46 2015 -0500
use static directories
The list might not exist on target when cross-compiling.
-----------------------------------------------------------------------
Summary of changes:
test/misc/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 09ff5c3..a15ff97 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -37,7 +37,7 @@ DODIFF_tst-statvfs := 1
OPTS_bug-glob1 := $(PWD)
OPTS_tst-fnmatch := < tst-fnmatch.input
-MNTENTS = $(shell mount | while read dev on mp rest; do echo $$mp; done)
+MNTENTS = / /sys /proc /dev
OPTS_tst-statfs := $(MNTENTS)
OPTS_tst-statvfs := $(MNTENTS)
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via 1775f37b1a35a22e186280b752913bda9f9ee7e9 (commit)
from ef28300bbc27306fca5bb1af155e94af32fc7fef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1775f37b1a35a22e186280b752913bda9f9ee7e9
Author: Waldemar Brodkorb <wbx(a)openadk.org>
Date: Sat May 30 03:23:46 2015 -0500
use static directories
The list might not exist on target when cross-compiling.
-----------------------------------------------------------------------
Summary of changes:
test/misc/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 09ff5c3..a15ff97 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -37,7 +37,7 @@ DODIFF_tst-statvfs := 1
OPTS_bug-glob1 := $(PWD)
OPTS_tst-fnmatch := < tst-fnmatch.input
-MNTENTS = $(shell mount | while read dev on mp rest; do echo $$mp; done)
+MNTENTS = / /sys /proc /dev
OPTS_tst-statfs := $(MNTENTS)
OPTS_tst-statvfs := $(MNTENTS)
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, 1.0 has been updated
via ef28300bbc27306fca5bb1af155e94af32fc7fef (commit)
from 650380248eaad577445c88b7314307d3acd166fc (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ef28300bbc27306fca5bb1af155e94af32fc7fef
Author: mirabilos <tg(a)mirbsd.org>
Date: Sun May 24 19:21:54 2015 +0200
implement experimental pure-sh testsuite runner and generation
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 4 +++
test/Makefile | 5 ++++
test/Test.mak | 14 +++++++++-
test/uclibcng-testrunner.sh | 62 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 84 insertions(+), 1 deletion(-)
create mode 100644 test/uclibcng-testrunner.sh
diff --git a/Makefile.in b/Makefile.in
index a86f29a..c8195ff 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -547,3 +547,7 @@ test check: test_compile
test_compile: $(LOCAL_INSTALL_PATH)
$(Q)$(MAKE) -C test compile \
$(if $(O),top_builddir=$(O)/)
+
+test_gen: $(LOCAL_INSTALL_PATH)
+ $(Q)$(MAKE) -C test gen \
+ $(if $(O),top_builddir=$(O)/)
diff --git a/test/Makefile b/test/Makefile
index e4f6418..a1fa728 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -47,6 +47,10 @@ test check all: run
run: subdirs_run
+gen:
+ -rm -f $(top_builddir)/test/uclibcng-testrunner.in
+ $(MAKE) run UCLIBCNG_GENERATE_TESTRUNNER=1
+
compile: $(top_builddir)$(LOCAL_INSTALL_PATH) subdirs_compile
$(top_builddir)$(LOCAL_INSTALL_PATH):
@@ -68,6 +72,7 @@ $(patsubst %, _dir_%, $(DIRS)) : dummy
$(patsubst %, _dirrun_%, $(DIRS)) : dummy
$(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run \
+ UCLIBCNG_TEST_SUBDIR=$(strip $(patsubst _dirrun_%, %, $@)) \
KCONFIG_CONFIG=$(KCONFIG_CONFIG)
$(patsubst %, _dircompile_%, $(DIRS)) : dummy
diff --git a/test/Test.mak b/test/Test.mak
index a56a201..52992a7 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -4,6 +4,8 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+shellescape='$(subst ','\'',$(1))'
+
ifeq ($(TESTS),)
TESTS := $(patsubst %.c,%,$(wildcard *.c))
endif
@@ -76,7 +78,7 @@ define exec_test
test -z "$$expected_ret" && export expected_ret=0 ; \
if ! test $$ret -eq $$expected_ret ; then \
echo "ret == $$ret ; expected_ret == $$expected_ret" ; \
- echo "The output of failed test is:"; \
+ echo "The output of the failed test is:"; \
cat "$(binary_name).out"; \
exit 1 ; \
fi
@@ -89,11 +91,21 @@ run: $(RUN_TARGETS)
$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc)
$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc)
$(RUN_TARGETS):
+ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER))
+ expected_ret="$(RET_$(tst_src_name))"; echo \
+ "$${expected_ret:-0}" \
+ $(call shellescape,$(tst_src_name)) \
+ $(call shellescape,$(binary_name)) \
+ $(call shellescape,$(UCLIBCNG_TEST_SUBDIR)) \
+ $(call shellescape,$(WRAPPER) $(WRAPPER_$(tst_src_name)) ./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name))) \
+ >>$(top_builddir)/test/uclibcng-testrunner.in
+else
$(exec_test)
$(diff_test)
ifeq ($(UCLIBC_ONLY),)
$(uclibc_glibc_diff_test)
endif
+endif
compile: $(COMPILE_TARGETS)
diff --git a/test/uclibcng-testrunner.sh b/test/uclibcng-testrunner.sh
new file mode 100644
index 0000000..943c950
--- /dev/null
+++ b/test/uclibcng-testrunner.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+#-
+# Copyright (c) 2015
+# Thorsten "mirabilos" Glaser <tg(a)mirbsd.org>
+#
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un-
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person's immediate fault when using the work as intended.
+#-
+# Testsuite runner
+
+die() {
+ echo >&2 E: "$*"
+ exit 1
+}
+
+test -s uclibcng-testrunner.in || die uclibcng-testrunner.in not found
+
+nfail=0
+npass=0
+while read expected_ret tst_src_name binary_name subdir cmd; do
+ printf '.... %s\r' "$binary_name"
+ (cd $subdir && eval "$cmd" >$binary_name.out 2>&1) </dev/null
+ ret=$?
+ test $ret = "$expected_ret" || {
+ echo "FAIL $binary_name got $ret expected $expected_ret"
+ nfail=`expr $nfail + 1`
+ sed 's/^/ /' <$subdir/$binary_name.out
+ continue
+ }
+ for x in $binary_name.out $test_src_name.out -; do
+ if test x"$x" = x"-"; then
+ echo "PASS $binary_name"
+ npass=`expr $npass + 1`
+ break
+ fi
+ test -e "$subdir/$x.good" || continue
+ if d=`diff -u "$subdir/$binary_name.out" "$subdir/$x.good"`; then
+ echo "PASS $binary_name"
+ npass=`expr $npass + 1`
+ else
+ echo "FAIL $binary_name expected output differs"
+ nfail=`expr $nfail + 1`
+ echo "$d" | sed 's/^/ /'
+ fi
+ break
+ done
+done <uclibcng-testrunner.in
+echo Total failed: $nfail
+echo Total passed: $npass
+test $nfail = 0
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via 84367d277312a8efb03967e52a69cc4e15d9a7ed (commit)
from ea66b60293ea587c078998cdf403f8475f5b5bdf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 84367d277312a8efb03967e52a69cc4e15d9a7ed
Author: mirabilos <tg(a)mirbsd.org>
Date: Sun May 24 19:21:54 2015 +0200
implement experimental pure-sh testsuite runner and generation
-----------------------------------------------------------------------
Summary of changes:
Makefile.in | 4 +++
test/Makefile | 5 ++++
test/Test.mak | 14 +++++++++-
test/uclibcng-testrunner.sh | 62 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 84 insertions(+), 1 deletion(-)
create mode 100644 test/uclibcng-testrunner.sh
diff --git a/Makefile.in b/Makefile.in
index dedb2aa..72458c1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -545,3 +545,7 @@ test check: test_compile
test_compile: $(LOCAL_INSTALL_PATH)
$(Q)$(MAKE) -C test compile \
$(if $(O),top_builddir=$(O)/)
+
+test_gen: $(LOCAL_INSTALL_PATH)
+ $(Q)$(MAKE) -C test gen \
+ $(if $(O),top_builddir=$(O)/)
diff --git a/test/Makefile b/test/Makefile
index e4f6418..a1fa728 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -47,6 +47,10 @@ test check all: run
run: subdirs_run
+gen:
+ -rm -f $(top_builddir)/test/uclibcng-testrunner.in
+ $(MAKE) run UCLIBCNG_GENERATE_TESTRUNNER=1
+
compile: $(top_builddir)$(LOCAL_INSTALL_PATH) subdirs_compile
$(top_builddir)$(LOCAL_INSTALL_PATH):
@@ -68,6 +72,7 @@ $(patsubst %, _dir_%, $(DIRS)) : dummy
$(patsubst %, _dirrun_%, $(DIRS)) : dummy
$(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run \
+ UCLIBCNG_TEST_SUBDIR=$(strip $(patsubst _dirrun_%, %, $@)) \
KCONFIG_CONFIG=$(KCONFIG_CONFIG)
$(patsubst %, _dircompile_%, $(DIRS)) : dummy
diff --git a/test/Test.mak b/test/Test.mak
index a56a201..52992a7 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -4,6 +4,8 @@
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+shellescape='$(subst ','\'',$(1))'
+
ifeq ($(TESTS),)
TESTS := $(patsubst %.c,%,$(wildcard *.c))
endif
@@ -76,7 +78,7 @@ define exec_test
test -z "$$expected_ret" && export expected_ret=0 ; \
if ! test $$ret -eq $$expected_ret ; then \
echo "ret == $$ret ; expected_ret == $$expected_ret" ; \
- echo "The output of failed test is:"; \
+ echo "The output of the failed test is:"; \
cat "$(binary_name).out"; \
exit 1 ; \
fi
@@ -89,11 +91,21 @@ run: $(RUN_TARGETS)
$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc)
$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc)
$(RUN_TARGETS):
+ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER))
+ expected_ret="$(RET_$(tst_src_name))"; echo \
+ "$${expected_ret:-0}" \
+ $(call shellescape,$(tst_src_name)) \
+ $(call shellescape,$(binary_name)) \
+ $(call shellescape,$(UCLIBCNG_TEST_SUBDIR)) \
+ $(call shellescape,$(WRAPPER) $(WRAPPER_$(tst_src_name)) ./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name))) \
+ >>$(top_builddir)/test/uclibcng-testrunner.in
+else
$(exec_test)
$(diff_test)
ifeq ($(UCLIBC_ONLY),)
$(uclibc_glibc_diff_test)
endif
+endif
compile: $(COMPILE_TARGETS)
diff --git a/test/uclibcng-testrunner.sh b/test/uclibcng-testrunner.sh
new file mode 100644
index 0000000..943c950
--- /dev/null
+++ b/test/uclibcng-testrunner.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+#-
+# Copyright (c) 2015
+# Thorsten "mirabilos" Glaser <tg(a)mirbsd.org>
+#
+# Provided that these terms and disclaimer and all copyright notices
+# are retained or reproduced in an accompanying document, permission
+# is granted to deal in this work without restriction, including un-
+# limited rights to use, publicly perform, distribute, sell, modify,
+# merge, give away, or sublicence.
+#
+# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
+# the utmost extent permitted by applicable law, neither express nor
+# implied; without malicious intent or gross negligence. In no event
+# may a licensor, author or contributor be held liable for indirect,
+# direct, other damage, loss, or other issues arising in any way out
+# of dealing in the work, even if advised of the possibility of such
+# damage or existence of a defect, except proven that it results out
+# of said person's immediate fault when using the work as intended.
+#-
+# Testsuite runner
+
+die() {
+ echo >&2 E: "$*"
+ exit 1
+}
+
+test -s uclibcng-testrunner.in || die uclibcng-testrunner.in not found
+
+nfail=0
+npass=0
+while read expected_ret tst_src_name binary_name subdir cmd; do
+ printf '.... %s\r' "$binary_name"
+ (cd $subdir && eval "$cmd" >$binary_name.out 2>&1) </dev/null
+ ret=$?
+ test $ret = "$expected_ret" || {
+ echo "FAIL $binary_name got $ret expected $expected_ret"
+ nfail=`expr $nfail + 1`
+ sed 's/^/ /' <$subdir/$binary_name.out
+ continue
+ }
+ for x in $binary_name.out $test_src_name.out -; do
+ if test x"$x" = x"-"; then
+ echo "PASS $binary_name"
+ npass=`expr $npass + 1`
+ break
+ fi
+ test -e "$subdir/$x.good" || continue
+ if d=`diff -u "$subdir/$binary_name.out" "$subdir/$x.good"`; then
+ echo "PASS $binary_name"
+ npass=`expr $npass + 1`
+ else
+ echo "FAIL $binary_name expected output differs"
+ nfail=`expr $nfail + 1`
+ echo "$d" | sed 's/^/ /'
+ fi
+ break
+ done
+done <uclibcng-testrunner.in
+echo Total failed: $nfail
+echo Total passed: $npass
+test $nfail = 0
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, master has been updated
via ea66b60293ea587c078998cdf403f8475f5b5bdf (commit)
from e9839e8dea61a44ec8861b48a2e943584dba167b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ea66b60293ea587c078998cdf403f8475f5b5bdf
Author: Waldemar Brodkorb <wbx(a)uclibc-ng.org>
Date: Thu May 21 21:38:31 2015 +0200
add thanks file
-----------------------------------------------------------------------
Summary of changes:
THANKS | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 THANKS
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..1d207bb
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,5 @@
+Thanks to following companies or people for hardware donations:
+
+Arcturus Networks Inc. - Blackfin + Coldfire Development Boards
+Cadence Design Systems, Inc. - Xilinx Kintex 7 FPGA KC705 incl. Daughterboard
+
hooks/post-receive
--
uClibc-ng - small C library for embedded systems
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "uClibc-ng - small C library for embedded systems".
The branch, upstream has been updated
via bfbcc35b0ff8e40570a99872fd538e344d8c7f75 (commit)
via 62175247d977c087e62f067d4db1445f88b61e7b (commit)
via 5b691e38f45e3fed19aea98775f79ab9cc00783f (commit)
via 9a1e4d650edcefc4eff9aa1a6e58949f91cdc80d (commit)
via 3010966c6dc170425452d0dda4922aaf1585b6b5 (commit)
via d5ecf4cf9e5479246c355b8accb85af291271ee8 (commit)
via 22176277c87aaf8d9f9a1fcf48e5a9b1e7872191 (commit)
from f1f98784e65ce9621a570af50998b1940e7fb81d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bfbcc35b0ff8e40570a99872fd538e344d8c7f75
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed May 6 22:38:38 2015 +0200
nptl_db: fix ommitting td_ta_setconcurrency
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 62175247d977c087e62f067d4db1445f88b61e7b
Author: Roland McGrath <roland(a)gnu.org>
Date: Tue Apr 28 11:07:24 2015 +0800
init.c (__nptl_initial_report_events): New variable.
(__pthread_initialize_minimal_internal): Initialize pd->report_events
to that.
This patch helps NPTL report TD_CREATE event, so that GDB could catch the
event and update its thread_list.
Link: http://lists.uclibc.org/pipermail/uclibc/2015-April/048921.html
[shengyong:
- original patch from glibc: commit 7d9d8bd18906fdd17364f372b160d7ab896ce909
- context adjust
- update nptl_db/ChangeLog]
Signed-off-by: Roland McGrath <roland(a)gnu.org>
Signed-off-by: Sheng Yong <shengyong1(a)huawei.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 5b691e38f45e3fed19aea98775f79ab9cc00783f
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Apr 29 23:52:18 2015 +0200
buildsys: pregen depends on xlocale
pt-initfini eventually depends on xlocale
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 9a1e4d650edcefc4eff9aa1a6e58949f91cdc80d
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Apr 29 10:41:42 2015 +0200
strftime: comment on %0xY %+nY %-nY
Would fix: date -u +%4Y%2m%2d%2H%2M%2S
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 3010966c6dc170425452d0dda4922aaf1585b6b5
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Wed Apr 29 10:22:18 2015 +0200
buildsys: swap V=1 with V=2 command printing
Previously V=1 did print abbreviated commands and V=2 the full commands.
Kbuild-based build-systems behave in the opposite way and this is
apparently confusing or inconvenient for users so swap our V handling to
be in line with kbuild (and automake as far as V=0 / V=1 is concerned).
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit d5ecf4cf9e5479246c355b8accb85af291271ee8
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Apr 23 23:17:00 2015 +0200
buildsys: LT{,.old} CRT prereq
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
commit 22176277c87aaf8d9f9a1fcf48e5a9b1e7872191
Author: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
Date: Thu Apr 23 23:15:45 2015 +0200
buildsys: Tweak pregen wrt headers_dep
Required for !NPTL, !context-funcs for example.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop(a)gmail.com>
-----------------------------------------------------------------------
Summary of changes:
Makefile.help | 4 +-
Makefile.in | 6 +-
Makerules | 5 +-
extra/locale/Makefile.in | 12 ++--
libc/misc/time/time.c | 24 ++++++++
libpthread/nptl/sysdeps/pthread/Makefile.in | 2 +-
libpthread/nptl_db/ChangeLog | 23 ++++++++
libpthread/nptl_db/Makefile.in | 8 +--
libpthread/nptl_db/db_info.c | 4 +-
libpthread/nptl_db/structs.def | 3 +-
libpthread/nptl_db/td_ta_map_lwp2thr.c | 69 ++++++++++++++++-------
libpthread/nptl_db/td_ta_thr_iter.c | 25 +++++----
libpthread/nptl_db/td_thr_event_enable.c | 24 +++++++-
libpthread/nptl_db/td_thr_get_info.c | 81 ++++++++++++++++-----------
libpthread/nptl_db/td_thr_getfpregs.c | 7 ++-
libpthread/nptl_db/td_thr_getgregs.c | 7 ++-
libpthread/nptl_db/td_thr_setfpregs.c | 7 ++-
libpthread/nptl_db/td_thr_setgregs.c | 7 ++-
libpthread/nptl_db/td_thr_tlsbase.c | 25 ++++++++-
libpthread/nptl_db/td_thr_validate.c | 16 ++----
libpthread/nptl_db/thread_dbP.h | 5 +-
21 files changed, 259 insertions(+), 105 deletions(-)
diff --git a/Makefile.help b/Makefile.help
index abc6471..f6c7627 100644
--- a/Makefile.help
+++ b/Makefile.help
@@ -53,8 +53,8 @@ help:
@echo 'Environment variables:'
@echo ' O=<abspath> - Use <abspath> as object directory'
@echo ' V="" - Quiet build (default)'
- @echo ' V=1 - Brief build (show defines, ld flags)'
- @echo ' V=2 - Very verbose build'
+ @echo ' V=1 - Very verbose build (show full commands)'
+ @echo ' V=2 - Brief build (show defines, ld flags)'
@echo ' CROSS_COMPILE= - Override CROSS_COMPILER_PREFIX from .config'
@echo ' ARCH= - Use given arch for config targets'
@echo ' SHELL= - Shell to use for make'
diff --git a/Makefile.in b/Makefile.in
index 2beeb7d..04671a4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,6 +29,7 @@ headers:
endif # ifeq ($(HAVE_DOT_CONFIG),y)
+include $(top_srcdir)extra/locale/Makefile.in
include $(top_srcdir)ldso/Makefile.in
include $(top_srcdir)libcrypt/Makefile.in
include $(top_srcdir)libintl/Makefile.in
@@ -39,7 +40,6 @@ include $(top_srcdir)libutil/Makefile.in
include $(top_srcdir)libpthread/Makefile.in
include $(top_srcdir)librt/Makefile.in
include $(top_srcdir)libubacktrace/Makefile.in
-include $(top_srcdir)extra/locale/Makefile.in
# last included to catch all the objects added by others (locales/threads)
include $(top_srcdir)libc/Makefile.in
@@ -186,9 +186,7 @@ headers: $(top_builddir)include/bits/uClibc_config.h | subdirs
subdirs: $(addprefix $(top_builddir),$(subdirs))
$(pregen-headers-y): $(headers_dep)
-
-pregen-headers: $(pregen-headers-y)
-pregen: headers pregen-headers
+pregen: headers $(pregen-headers-y) $(headers_dep)
$(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers)
$(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits
diff --git a/Makerules b/Makerules
index dd19cea..d6f7e24 100644
--- a/Makerules
+++ b/Makerules
@@ -94,7 +94,7 @@ else
export MAKE_IS_SILENT := n
SECHO := @echo
ifneq ($(V)$(VERBOSE),)
-ifeq ($(V),1)
+ifeq ($(V),2)
DISP := bri# brief, like pur but with defines
Q := @
else
@@ -430,6 +430,9 @@ CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
else
CTOR_TARGETS:=
endif
+ifeq ($(HAS_NO_THREADS)$(UCLIBC_HAS_THREADS_NATIVE),)
+$(lib-so-y): $(CTOR_TARGETS)
+endif
ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
CRTRELOC=$(top_builddir)lib/crtreloc.o
diff --git a/extra/locale/Makefile.in b/extra/locale/Makefile.in
index 1a2305b..efd07ed 100644
--- a/extra/locale/Makefile.in
+++ b/extra/locale/Makefile.in
@@ -29,7 +29,8 @@ BUILD_CFLAGS-gen_collate := -D_GNU_SOURCE
locale_headers-$(UCLIBC_HAS_LOCALE) := $(top_builddir)include/bits/uClibc_locale_data.h
-#DEPH-locale := $(top_builddir)include/bits/sysnum.h
+headers_dep += $(locale_headers-y)
+
DEPH-locale := $(top_builddir)include/bits/uClibc_config.h
DEPH-gen_collate := $(DEPH-locale)
DEPH-gen_ldc := $(addprefix $(locale_OUT)/,c8tables.h wctables.h locale_tables.h locale_collate.h) $(DEPH-locale)
@@ -46,9 +47,6 @@ locale_OBJ := $(locale_OUT)/locale_data.o
CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR)
-headers_dep += $(locale_headers-y)
-headers: $(locale_headers-y)
-
libc-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
libc-nomulti-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
@@ -68,7 +66,7 @@ $(locale_OUT)%.s: $(locale_OUT)%.S FORCE ; $(compile.s)
$(locale_OUT)%.dep:
-locale_headers: $(top_builddir)include/bits/uClibc_locale_data.h
+locale_headers: $(locale_headers-y)
# make sure that the host system has locales (this check is ok for uClibc/glibc)
# we do not know though which locales were really enabled for libc at build time
@@ -155,10 +153,10 @@ $(locale_OUT)/gen_wctype : $(locale_DIR)/gen_wctype.c
ifneq ($(V),)
ifeq ($(V),1)
-FLAG-locale-verbose := -v
+FLAG-locale-verbose := -v -v
endif
ifeq ($(V),2)
-FLAG-locale-verbose := -v -v
+FLAG-locale-verbose := -v
endif
endif
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index a3fccb2..03635d8 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -1084,7 +1084,25 @@ LOOP:
o_count = 1;
if ((*(o = (CHAR_T *)p) == '%') && (*++p != '%')) {
+#if 0 /* TODO, same for strptime */
+ /* POSIX.1-2008 allows %0xY %+nY %-nY etc. for certain formats.
+ * Just accept these for all (for now) */
+ const int plus = *p == '+';
+ CHAR_T *q = (CHAR_T *)p;
+ long int o_width = __XL_NPP(strtol)(p, &q, 0 __LOCALE_ARG);
+ if (o_width > 0 && o_width < 256) { /* arbitrary upper limit */
+ o_count = o_width;
+ if (plus) {
+ *s++ = '+';
+ --count;
+ }
+ p = q;
+ } else {
+ o_count = 2;
+ }
+#else
o_count = 2;
+#endif
mod = ILLEGAL_SPEC;
if ((*p == 'O') || (*p == 'E')) { /* modifier */
mod |= ((*p == 'O') ? NO_O_MOD : NO_E_MOD);
@@ -1317,7 +1335,13 @@ ISO_LOOP:
ccp = __XL_NPP(nl_langinfo)(_NL_ITEM(LC_TIME, field_val) __LOCALE_ARG);
fmt_to_wc(o, ccp);
} else {
+#if 0 /* TODO, same for strptime */
+ size_t min_count = ((i >> 1) & 3) + 1;
+ if (o_count < min_count)
+ o_count = min_count;
+#else
o_count = ((i >> 1) & 3) + 1;
+#endif
ccp = buf + o_count;
do {
*(char *)(--ccp) = '0' + (field_val % 10);
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
index 84adfe0..849c75f 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -78,7 +78,7 @@ $(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S
$(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
$(compile.S)
-$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(top_builddir)include/bits/uClibc_config.h
+$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(headers_dep)
$(compile.c)
$(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
$(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
diff --git a/libpthread/nptl_db/ChangeLog b/libpthread/nptl_db/ChangeLog
index 52c8491..92021cb 100644
--- a/libpthread/nptl_db/ChangeLog
+++ b/libpthread/nptl_db/ChangeLog
@@ -1,3 +1,26 @@
+2007-05-16 Roland McGrath <roland(a)redhat.com>
+
+ * td_thr_get_info.c: Fake the results for TH->th_unique == 0.
+ * td_thr_validate.c: Likewise.
+ * td_thr_setgregs.c: Likewise.
+ * td_thr_setfpregs.c: Likewise.
+ * td_thr_getgregs.c: Likewise.
+ * td_thr_getfpregs.c: Likewise.
+ * td_thr_tlsbase.c: Likewise.
+
+ * structs.def: Add DB_VARIABLE (__nptl_initial_report_events).
+ * db_info.c: Add necessary declaration.
+ * td_thr_event_enable.c: Set __nptl_initial_report_events too.
+
+ * td_ta_thr_iter.c (iterate_thread_list): Make FAKE_EMPTY bool.
+ Use th_unique=0 in fake descriptor before initialization.
+
+ * td_ta_map_lwp2thr.c (__td_ta_lookup_th_unique): New function, broken
+ out of ...
+ (td_ta_map_lwp2thr): ... here, call it. But don't before __stack_user
+ is initialized, then fake a handle with th_unique=0.
+ * thread_dbP.h: Declare it.
+
2004-09-09 Roland McGrath <roland(a)redhat.com>
* td_ta_map_lwp2thr.c (td_ta_map_lwp2thr): Don't abort if inferior's
diff --git a/libpthread/nptl_db/Makefile.in b/libpthread/nptl_db/Makefile.in
index 76102e6..5a493d8 100644
--- a/libpthread/nptl_db/Makefile.in
+++ b/libpthread/nptl_db/Makefile.in
@@ -22,13 +22,13 @@ libthread_db_FULL_NAME := libthread_db-$(VERSION).so
libthread_db_DIR := $(top_srcdir)libpthread/nptl_db
libthread_db_OUT := $(top_builddir)libpthread/nptl_db
-libthread_db_SRC := $(wildcard $(libthread_db_DIR)/td_*.c) \
- $(libthread_db_DIR)/fetch-value.c
+libthread_db_SRC := $(notdir $(wildcard $(libthread_db_DIR)/td_*.c) \
+ $(libthread_db_DIR)/fetch-value.c)
ifeq ($(UCLIBC_SUSV4_LEGACY),)
libthread_db_SRC := $(filter-out td_ta_setconcurrency.c,$(libthread_db_SRC))
endif
-libthread_db_OBJ := $(patsubst $(libthread_db_DIR)/%.c,$(libthread_db_OUT)/%.o,$(libthread_db_SRC))
+libthread_db_OBJ := $(addprefix $(libthread_db_OUT)/,$(libthread_db_SRC:.c=.o))
libthread_db-so-y := $(libthread_db_OBJ:.o=.oS)
ifeq ($(DOPIC),y)
@@ -37,7 +37,7 @@ else
libthread_db-a-y := $(libthread_db_OBJ)
endif
-libthread_db-multi-y := $(libthread_db_SRC)
+libthread_db-multi-y := $(addprefix $(libthread_db_DIR)/,$(libthread_db_SRC))
lib-a-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.a
lib-so-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.so
diff --git a/libpthread/nptl_db/db_info.c b/libpthread/nptl_db/db_info.c
index 521ad78..a57a053 100644
--- a/libpthread/nptl_db/db_info.c
+++ b/libpthread/nptl_db/db_info.c
@@ -1,7 +1,7 @@
/* This file is included by pthread_create.c to define in libpthread
all the magic symbols required by libthread_db.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -37,6 +37,8 @@ typedef struct
typedef struct link_map link_map;
+/* Actually static in nptl/init.c, but we only need it for typeof. */
+extern bool __nptl_initial_report_events;
#define schedparam_sched_priority schedparam.sched_priority
diff --git a/libpthread/nptl_db/structs.def b/libpthread/nptl_db/structs.def
index 915867b..bb571d4 100644
--- a/libpthread/nptl_db/structs.def
+++ b/libpthread/nptl_db/structs.def
@@ -1,5 +1,5 @@
/* List of types and symbols in libpthread examined by libthread_db.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -55,6 +55,7 @@ DB_FUNCTION (__nptl_death_event)
DB_SYMBOL (__nptl_threads_events)
DB_VARIABLE (__nptl_nthreads)
DB_VARIABLE (__nptl_last_event)
+DB_VARIABLE (__nptl_initial_report_events)
DB_ARRAY_VARIABLE (__pthread_keys)
DB_STRUCT (pthread_key_struct)
diff --git a/libpthread/nptl_db/td_ta_map_lwp2thr.c b/libpthread/nptl_db/td_ta_map_lwp2thr.c
index 9709777..6b4382f 100644
--- a/libpthread/nptl_db/td_ta_map_lwp2thr.c
+++ b/libpthread/nptl_db/td_ta_map_lwp2thr.c
@@ -1,5 +1,5 @@
/* Which thread is running on an LWP?
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -23,8 +23,8 @@
td_err_e
-td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
- lwpid_t lwpid, td_thrhandle_t *th)
+__td_ta_lookup_th_unique (const td_thragent_t *ta_arg,
+ lwpid_t lwpid, td_thrhandle_t *th)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
ps_err_e err;
@@ -117,9 +117,6 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
switch (ta->ta_howto)
{
- case ta_howto_unknown:
- return TD_DBERR;
-
default:
return TD_DBERR;
@@ -131,6 +128,7 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
0, regs, &addr);
if (terr != TD_OK)
return terr;
+
/* In this descriptor the nelem word is overloaded as the bias. */
addr += (int32_t) DB_DESC_NELEM (ta->ta_howto_data.reg);
th->th_unique = addr;
@@ -142,22 +140,22 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
if (&ps_get_thread_area == NULL)
return TD_NOCAPAB;
- /* A la x86-64, there is a constant magic index for get_thread_area. */
- if (ps_get_thread_area (ta->ph, lwpid,
- ta->ta_howto_data.const_thread_area,
- &th->th_unique) != PS_OK)
- return TD_ERR; /* XXX Other error value? */
- break;
+ /* A la x86-64, there is a magic index for get_thread_area. */
+ if (ps_get_thread_area (ta->ph, lwpid,
+ ta->ta_howto_data.const_thread_area,
+ &th->th_unique) != PS_OK)
+ return TD_ERR; /* XXX Other error value? */
+ break;
- case ta_howto_reg_thread_area:
+ case ta_howto_reg_thread_area:
if (&ps_get_thread_area == NULL)
return TD_NOCAPAB;
- /* A la i386, there is a register with an index for get_thread_area. */
- if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
- return TD_ERR;
- terr = _td_fetch_value_local (ta, ta->ta_howto_data.reg_thread_area, -1,
- 0, regs, &addr);
+ /* A la i386, a register holds the index for get_thread_area. */
+ if (ps_lgetregs (ta->ph, lwpid, regs) != PS_OK)
+ return TD_ERR;
+ terr = _td_fetch_value_local (ta, ta->ta_howto_data.reg_thread_area,
+ -1, 0, regs, &addr);
if (terr != TD_OK)
return terr;
/* In this descriptor the nelem word is overloaded as scale factor. */
@@ -171,7 +169,40 @@ td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
}
/* Found it. Now complete the `td_thrhandle_t' object. */
- th->th_ta_p = (td_thragent_t *) ta;
+ th->th_ta_p = ta;
return TD_OK;
}
+
+td_err_e
+td_ta_map_lwp2thr (const td_thragent_t *ta_arg,
+ lwpid_t lwpid, td_thrhandle_t *th)
+{
+ td_thragent_t *const ta = (td_thragent_t *) ta_arg;
+
+ /* We cannot rely on thread registers and such information at all
+ before __pthread_initialize_minimal has gotten far enough. They
+ sometimes contain garbage that would confuse us, left by the kernel
+ at exec. So if it looks like initialization is incomplete, we only
+ fake a special descriptor for the initial thread. */
+
+ psaddr_t list;
+ td_err_e err = DB_GET_SYMBOL (list, ta, __stack_user);
+ if (err != TD_OK)
+ return err;
+
+ err = DB_GET_FIELD (list, ta, list, list_t, next, 0);
+ if (err != TD_OK)
+ return err;
+
+ if (list == 0)
+ {
+ if (ps_getpid (ta->ph) != lwpid)
+ return TD_ERR;
+ th->th_ta_p = ta;
+ th->th_unique = 0;
+ return TD_OK;
+ }
+
+ return __td_ta_lookup_th_unique (ta_arg, lwpid, th);
+}
diff --git a/libpthread/nptl_db/td_ta_thr_iter.c b/libpthread/nptl_db/td_ta_thr_iter.c
index 1fd02ef..0f1b2bf 100644
--- a/libpthread/nptl_db/td_ta_thr_iter.c
+++ b/libpthread/nptl_db/td_ta_thr_iter.c
@@ -1,5 +1,6 @@
/* Iterate over a process's threads.
- Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2001,2002,2003,2004,2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -23,7 +24,7 @@
static td_err_e
iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback,
void *cbdata_p, td_thr_state_e state, int ti_pri,
- psaddr_t head, int fake_empty)
+ psaddr_t head, bool fake_empty)
{
td_err_e err;
psaddr_t next, ofs;
@@ -40,13 +41,13 @@ iterate_thread_list (td_thragent_t *ta, td_thr_iter_f *callback,
if (next == 0 && fake_empty)
{
- /* __pthread_initialize_minimal has not run.
- There is just the main thread to return. */
- td_thrhandle_t th;
- err = td_ta_map_lwp2thr (ta, ps_getpid (ta->ph), &th);
- if (err == TD_OK)
- err = callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
- return err;
+ /* __pthread_initialize_minimal has not run. There is just the main
+ thread to return. We cannot rely on its thread register. They
+ sometimes contain garbage that would confuse us, left by the
+ kernel at exec. So if it looks like initialization is incomplete,
+ we only fake a special descriptor for the initial thread. */
+ td_thrhandle_t th = { ta, 0 };
+ return callback (&th, cbdata_p) != 0 ? TD_DBERR : TD_OK;
}
/* Cache the offset from struct pthread to its list_t member. */
@@ -135,13 +136,15 @@ td_ta_thr_iter (const td_thragent_t *ta_arg, td_thr_iter_f *callback,
err = DB_GET_SYMBOL (list, ta, __stack_user);
if (err == TD_OK)
- err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri, list, 1);
+ err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri,
+ list, true);
/* And the threads with stacks allocated by the implementation. */
if (err == TD_OK)
err = DB_GET_SYMBOL (list, ta, stack_used);
if (err == TD_OK)
- err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri, list, 0);
+ err = iterate_thread_list (ta, callback, cbdata_p, state, ti_pri,
+ list, false);
return err;
}
diff --git a/libpthread/nptl_db/td_thr_event_enable.c b/libpthread/nptl_db/td_thr_event_enable.c
index f49682d..fd94580 100644
--- a/libpthread/nptl_db/td_thr_event_enable.c
+++ b/libpthread/nptl_db/td_thr_event_enable.c
@@ -1,5 +1,5 @@
/* Enable event process-wide.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -25,7 +25,25 @@ td_thr_event_enable (const td_thrhandle_t *th, int onoff)
{
LOG ("td_thr_event_enable");
- /* Write the new value into the thread data structure. */
- return DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread, report_events, 0,
+ if (th->th_unique != 0)
+ {
+ /* Write the new value into the thread data structure. */
+ td_err_e err = DB_PUT_FIELD (th->th_ta_p, th->th_unique, pthread,
+ report_events, 0,
+ (psaddr_t) 0 + (onoff != 0));
+ if (err != TD_OK)
+ return err;
+
+ /* Just in case we are in the window between initializing __stack_user
+ and copying from __nptl_initial_report_events, we set it too.
+ It doesn't hurt to do this for non-initial threads, since it
+ won't be consulted again anyway. It would take another fetch
+ to get the tid and determine this isn't the initial thread,
+ so just do it always. */
+ }
+
+ /* We are faking it for the initial thread before its thread
+ descriptor is set up. */
+ return DB_PUT_VALUE (th->th_ta_p, __nptl_initial_report_events, 0,
(psaddr_t) 0 + (onoff != 0));
}
diff --git a/libpthread/nptl_db/td_thr_get_info.c b/libpthread/nptl_db/td_thr_get_info.c
index 09d0d1a..27d5d70 100644
--- a/libpthread/nptl_db/td_thr_get_info.c
+++ b/libpthread/nptl_db/td_thr_get_info.c
@@ -1,5 +1,5 @@
/* Get thread information.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2001,2002,2003,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -31,35 +31,49 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
LOG ("td_thr_get_info");
- /* Copy the whole descriptor in once so we can access the several
- fields locally. Excess copying in one go is much better than
- multiple ps_pdread calls. */
- err = DB_GET_STRUCT (copy, th->th_ta_p, th->th_unique, pthread);
- if (err != TD_OK)
- return err;
-
- err = DB_GET_FIELD_ADDRESS (tls, th->th_ta_p, th->th_unique,
- pthread, specific, 0);
- if (err != TD_OK)
- return err;
-
- err = DB_GET_FIELD_LOCAL (schedpolicy, th->th_ta_p, copy, pthread,
- schedpolicy, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (schedprio, th->th_ta_p, copy, pthread,
- schedparam_sched_priority, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (tid, th->th_ta_p, copy, pthread, tid, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (cancelhandling, th->th_ta_p, copy, pthread,
- cancelhandling, 0);
- if (err != TD_OK)
- return err;
- err = DB_GET_FIELD_LOCAL (report_events, th->th_ta_p, copy, pthread,
- report_events, 0);
+ if (th->th_unique == 0)
+ {
+ /* Special case for the main thread before initialization. */
+ copy = NULL;
+ tls = 0;
+ cancelhandling = 0;
+ schedprio = 0;
+ tid = 0;
+ err = DB_GET_VALUE (report_events, th->th_ta_p,
+ __nptl_initial_report_events, 0);
+ }
+ else
+ {
+ /* Copy the whole descriptor in once so we can access the several
+ fields locally. Excess copying in one go is much better than
+ multiple ps_pdread calls. */
+ err = DB_GET_STRUCT (copy, th->th_ta_p, th->th_unique, pthread);
+ if (err != TD_OK)
+ return err;
+
+ err = DB_GET_FIELD_ADDRESS (tls, th->th_ta_p, th->th_unique,
+ pthread, specific, 0);
+ if (err != TD_OK)
+ return err;
+
+ err = DB_GET_FIELD_LOCAL (schedpolicy, th->th_ta_p, copy, pthread,
+ schedpolicy, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (schedprio, th->th_ta_p, copy, pthread,
+ schedparam_sched_priority, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (tid, th->th_ta_p, copy, pthread, tid, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (cancelhandling, th->th_ta_p, copy, pthread,
+ cancelhandling, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD_LOCAL (report_events, th->th_ta_p, copy, pthread,
+ report_events, 0);
+ }
if (err != TD_OK)
return err;
@@ -86,9 +100,10 @@ td_thr_get_info (const td_thrhandle_t *th, td_thrinfo_t *infop)
infop->ti_lid = tid == 0 ? ps_getpid (th->th_ta_p->ph) : (uintptr_t) tid;
infop->ti_traceme = report_events != 0;
- err = DB_GET_FIELD_LOCAL (infop->ti_startfunc, th->th_ta_p, copy, pthread,
- start_routine, 0);
- if (err == TD_OK)
+ if (copy != NULL)
+ err = DB_GET_FIELD_LOCAL (infop->ti_startfunc, th->th_ta_p, copy, pthread,
+ start_routine, 0);
+ if (copy != NULL && err == TD_OK)
{
uint32_t idx;
for (idx = 0; idx < TD_EVENTSIZE; ++idx)
diff --git a/libpthread/nptl_db/td_thr_getfpregs.c b/libpthread/nptl_db/td_thr_getfpregs.c
index ff4b599..4f4742a 100644
--- a/libpthread/nptl_db/td_thr_getfpregs.c
+++ b/libpthread/nptl_db/td_thr_getfpregs.c
@@ -1,5 +1,5 @@
/* Get a thread's floating-point register set.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -28,6 +28,11 @@ td_thr_getfpregs (const td_thrhandle_t *th, prfpregset_t *regset)
LOG ("td_thr_getfpregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lgetfpregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ regset) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_getgregs.c b/libpthread/nptl_db/td_thr_getgregs.c
index 497941b..d5f0f61 100644
--- a/libpthread/nptl_db/td_thr_getgregs.c
+++ b/libpthread/nptl_db/td_thr_getgregs.c
@@ -1,5 +1,5 @@
/* Get a thread's general register set.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -28,6 +28,11 @@ td_thr_getgregs (const td_thrhandle_t *th, prgregset_t regset)
LOG ("td_thr_getgregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lgetregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ regset) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_setfpregs.c b/libpthread/nptl_db/td_thr_setfpregs.c
index 3c4e8ed..3154953 100644
--- a/libpthread/nptl_db/td_thr_setfpregs.c
+++ b/libpthread/nptl_db/td_thr_setfpregs.c
@@ -1,5 +1,5 @@
/* Set a thread's floating-point register set.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -28,6 +28,11 @@ td_thr_setfpregs (const td_thrhandle_t *th, const prfpregset_t *fpregs)
LOG ("td_thr_setfpregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lsetfpregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ fpregs) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_setgregs.c b/libpthread/nptl_db/td_thr_setgregs.c
index 83d2cd9..5945dea 100644
--- a/libpthread/nptl_db/td_thr_setgregs.c
+++ b/libpthread/nptl_db/td_thr_setgregs.c
@@ -1,5 +1,5 @@
/* Set a thread's general register set.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -28,6 +28,11 @@ td_thr_setgregs (const td_thrhandle_t *th, prgregset_t gregs)
LOG ("td_thr_setgregs");
+ if (th->th_unique == 0)
+ /* Special case for the main thread before initialization. */
+ return ps_lsetregs (th->th_ta_p->ph, ps_getpid (th->th_ta_p->ph),
+ gregs) != PS_OK ? TD_ERR : TD_OK;
+
/* We have to get the state and the PID for this thread. */
err = DB_GET_FIELD (cancelhandling, th->th_ta_p, th->th_unique, pthread,
cancelhandling, 0);
diff --git a/libpthread/nptl_db/td_thr_tlsbase.c b/libpthread/nptl_db/td_thr_tlsbase.c
index f7d4c29..9f98bd9 100644
--- a/libpthread/nptl_db/td_thr_tlsbase.c
+++ b/libpthread/nptl_db/td_thr_tlsbase.c
@@ -1,5 +1,5 @@
/* Locate TLS data for a thread.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,8 +29,29 @@ td_thr_tlsbase (const td_thrhandle_t *th,
if (modid < 1)
return TD_NOTLS;
+ psaddr_t pd = th->th_unique;
+ if (pd == 0)
+ {
+ /* This is the fake handle for the main thread before libpthread
+ initialization. We are using 0 for its th_unique because we can't
+ trust that its thread register has been initialized. But we need
+ a real pointer to have any TLS access work. In case of dlopen'd
+ libpthread, initialization might not be for quite some time. So
+ try looking up the thread register now. Worst case, it's nonzero
+ uninitialized garbage and we get bogus results for TLS access
+ attempted too early. Tough. */
+
+ td_thrhandle_t main_th;
+ err = __td_ta_lookup_th_unique (th->th_ta_p, ps_getpid (th->th_ta_p->ph),
+ &main_th);
+ if (err == 0)
+ pd = main_th.th_unique;
+ if (pd == 0)
+ return TD_TLSDEFER;
+ }
+
/* Get the DTV pointer from the thread descriptor. */
- err = DB_GET_FIELD (dtv, th->th_ta_p, th->th_unique, pthread, dtvp, 0);
+ err = DB_GET_FIELD (dtv, th->th_ta_p, pd, pthread, dtvp, 0);
if (err != TD_OK)
return err;
diff --git a/libpthread/nptl_db/td_thr_validate.c b/libpthread/nptl_db/td_thr_validate.c
index 49c30c1..1b96b51 100644
--- a/libpthread/nptl_db/td_thr_validate.c
+++ b/libpthread/nptl_db/td_thr_validate.c
@@ -1,5 +1,5 @@
/* Validate a thread handle.
- Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999,2001,2002,2003,2004,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper(a)redhat.com>, 1999.
@@ -74,16 +74,10 @@ td_thr_validate (const td_thrhandle_t *th)
if (err == TD_OK)
err = check_thread_list (th, list, &uninit);
- if (err == TD_NOTHR && uninit)
- {
- /* __pthread_initialize_minimal has not run yet.
- But the main thread still has a valid ID. */
- td_thrhandle_t main_th;
- err = td_ta_map_lwp2thr (th->th_ta_p,
- ps_getpid (th->th_ta_p->ph), &main_th);
- if (err == TD_OK && th->th_unique != main_th.th_unique)
- err = TD_NOTHR;
- }
+ if (err == TD_NOTHR && uninit && th->th_unique == 0)
+ /* __pthread_initialize_minimal has not run yet.
+ There is only the special case thread handle. */
+ err = TD_OK;
}
return err;
diff --git a/libpthread/nptl_db/thread_dbP.h b/libpthread/nptl_db/thread_dbP.h
index 24623ef..b8399f7 100644
--- a/libpthread/nptl_db/thread_dbP.h
+++ b/libpthread/nptl_db/thread_dbP.h
@@ -1,5 +1,5 @@
/* Private header for thread debug library
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -254,4 +254,7 @@ extern td_err_e _td_store_value_local (td_thragent_t *ta,
extern td_err_e _td_check_sizeof (td_thragent_t *ta, uint32_t *sizep,
int sizep_name) attribute_hidden;
+extern td_err_e __td_ta_lookup_th_unique (const td_thragent_t *ta,
+ lwpid_t lwpid, td_thrhandle_t *th);
+
#endif /* thread_dbP.h */
hooks/post-receive
--
uClibc-ng - small C library for embedded systems