about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-06-09 16:02:40 +0000
committerUlrich Drepper <drepper@redhat.com>1998-06-09 16:02:40 +0000
commit69f234e8ff029cdd0ee7f91df7bcd006bbcab42f (patch)
treed403206549e0db96cb6f9abeffd0c9cafb62efb3
parentbf7997b65c7887d2acda95f5201d818a19d81711 (diff)
downloadglibc-69f234e8ff029cdd0ee7f91df7bcd006bbcab42f.tar.gz
glibc-69f234e8ff029cdd0ee7f91df7bcd006bbcab42f.tar.xz
glibc-69f234e8ff029cdd0ee7f91df7bcd006bbcab42f.zip
Update.
	* db2/btree/bt_close.c: Likewise.
	* db2/btree/bt_compare.c: Likewise.
	* db2/btree/bt_conv.c: Likewise.
	* db2/btree/bt_cursor.c: Likewise.
	* db2/btree/bt_delete.c: Likewise.
	* db2/btree/bt_open.c: Likewise.
	* db2/btree/bt_page.c: Likewise.
	* db2/btree/bt_put.c: Likewise.
	* db2/btree/bt_rec.c: Likewise.
	* db2/btree/bt_recno.c: Likewise.
	* db2/btree/bt_rsearch.c: Likewise.
	* db2/btree/bt_search.c: Likewise.
	* db2/btree/bt_split.c: Likewise.
	* db2/btree/bt_stat.c: Likewise.
	* db2/btree/btree.src: Likewise.
	* db2/btree/btree_auto.c: Likewise.
	* db2/clib/getlong.c: Likewise.
	* db2/common/db_appinit.c: Likewise.
	* db2/common/db_apprec.c: Likewise.
	* db2/common/db_byteorder.c: Likewise.
	* db2/common/db_err.c: Likewise.
	* db2/common/db_log2.c: Likewise.
	* db2/common/db_region.c: Likewise.
	* db2/common/db_salloc.c: Likewise.
	* db2/common/db_shash.c: Likewise.
	* db2/db/db.c: Likewise.
	* db2/db/db.src: Likewise.
	* db2/db/db_auto.c: Likewise.
	* db2/db/db_conv.c: Likewise.
	* db2/db/db_dispatch.c: Likewise.
	* db2/db/db_dup.c: Likewise.
	* db2/db/db_overflow.c: Likewise.
	* db2/db/db_pr.c: Likewise.
	* db2/db/db_rec.c: Likewise.
	* db2/db/db_ret.c: Likewise.
	* db2/db/db_thread.c: Likewise.
	* db2/db185/db185.c: Likewise.
	* db2/db185/db185_int.h: Likewise.
	* db2/dbm/dbm.c: Likewise.
	* db2/hash/hash.c: Likewise.
	* db2/hash/hash.src: Likewise.
	* db2/hash/hash_auto.c: Likewise.
	* db2/hash/hash_conv.c: Likewise.
	* db2/hash/hash_debug.c: Likewise.
	* db2/hash/hash_dup.c: Likewise.
	* db2/hash/hash_func.c: Likewise.
	* db2/hash/hash_page.c: Likewise.
	* db2/hash/hash_rec.c: Likewise.
	* db2/hash/hash_stat.c: Likewise.
	* db2/include/btree.h: Likewise.
	* db2/include/btree_ext.h: Likewise.
	* db2/include/clib_ext.h: Likewise.
	* db2/include/common_ext.h: Likewise.
	* db2/include/cxx_int.h: Likewise.
	* db2/include/db.h.src: Likewise.
	* db2/include/db_185.h.src: Likewise.
	* db2/include/db_am.h: Likewise.
	* db2/include/db_auto.h: Likewise.
	* db2/include/db_cxx.h: Likewise.
	* db2/include/db_dispatch.h: Likewise.
	* db2/include/db_ext.h: Likewise.
	* db2/include/db_int.h.src: Likewise.
	* db2/include/db_page.h: Likewise.
	* db2/include/db_shash.h: Likewise.
	* db2/include/db_swap.h: Likewise.
	* db2/include/hash.h: Likewise.
	* db2/include/hash_ext.h: Likewise.
	* db2/include/lock.h: Likewise.
	* db2/include/lock_ext.h: Likewise.
	* db2/include/log.h: Likewise.
	* db2/include/log_ext.h: Likewise.
	* db2/include/mp.h: Likewise.
	* db2/include/mp_ext.h: Likewise.
	* db2/include/mutex_ext.h: Likewise.
	* db2/include/os_ext.h: Likewise.
	* db2/include/os_func.h: Likewise.
	* db2/include/queue.h: Likewise.
	* db2/include/shqueue.h: Likewise.
	* db2/include/txn.h: Likewise.
	* db2/lock/lock.c: Likewise.
	* db2/lock/lock_conflict.c: Likewise.
	* db2/lock/lock_deadlock.c: Likewise.
	* db2/lock/lock_region.c: Likewise.
	* db2/lock/lock_util.c: Likewise.
	* db2/log/log.c: Likewise.
	* db2/log/log.src: Likewise.
	* db2/log/log_archive.c: Likewise.
	* db2/log/log_auto.c: Likewise.
	* db2/log/log_compare.c: Likewise.
	* db2/log/log_findckp.c: Likewise.
	* db2/log/log_get.c: Likewise.
	* db2/log/log_put.c: Likewise.
	* db2/log/log_rec.c: Likewise.
	* db2/log/log_register.c: Likewise.
	* db2/mp/mp_bh.c: Likewise.
	* db2/mp/mp_fget.c: Likewise.
	* db2/mp/mp_fopen.c: Likewise.
	* db2/mp/mp_fput.c: Likewise.
	* db2/mp/mp_fset.c: Likewise.
	* db2/mp/mp_open.c: Likewise.
	* db2/mp/mp_pr.c: Likewise.
	* db2/mp/mp_region.c: Likewise.
	* db2/mp/mp_sync.c: Likewise.
	* db2/mutex/68020.gcc: Likewise.
	* db2/mutex/mutex.c: Likewise.
	* db2/mutex/parisc.gcc: Likewise.
	* db2/mutex/parisc.hp: Likewise.
	* db2/mutex/sco.cc: Likewise.
	* db2/os/os_abs.c: Likewise.
	* db2/os/os_alloc.c: Likewise.
	* db2/os/os_config.c: Likewise.
	* db2/os/os_dir.c: Likewise.
	* db2/os/os_fid.c: Likewise.
	* db2/os/os_fsync.c: Likewise.
	* db2/os/os_map.c: Likewise.
	* db2/os/os_oflags.c: Likewise.
	* db2/os/os_open.c: Likewise.
	* db2/os/os_rpath.c: Likewise.
	* db2/os/os_rw.c: Likewise.
	* db2/os/os_seek.c: Likewise.
	* db2/os/os_sleep.c: Likewise.
	* db2/os/os_spin.c: Likewise.
	* db2/os/os_stat.c: Likewise.
	* db2/os/os_unlink.c: Likewise.
	* db2/progs/db_archive/db_archive.c: Likewise.
	* db2/progs/db_checkpoint/db_checkpoint.c: Likewise.
	* db2/progs/db_deadlock/db_deadlock.c: Likewise.
	* db2/progs/db_dump/db_dump.c: Likewise.
	* db2/progs/db_dump185/db_dump185.c: Likewise.
	* db2/progs/db_load/db_load.c: Likewise.
	* db2/progs/db_printlog/db_printlog.c: Likewise.
	* db2/progs/db_recover/db_recover.c: Likewise.
	* db2/progs/db_stat/db_stat.c: Likewise.
	* db2/txn/txn.c: Likewise.
	* db2/txn/txn.src: Likewise.
	* db2/txn/txn_auto.c: Likewise.
	* db2/txn/txn_rec.c: Likewise.
	* sysdeps/generic/libc-start.c: Always set __libc_stack_end.
	* sysdeps/i386/backtrace.c: Test whether frame pointer is legal
	before following it.
-rw-r--r--ChangeLog278
-rw-r--r--linuxthreads/ChangeLog10
-rw-r--r--sysdeps/generic/libc-start.c2
-rw-r--r--sysdeps/i386/backtrace.c12
4 files changed, 162 insertions, 140 deletions
diff --git a/ChangeLog b/ChangeLog
index 28e90b8efc..059f9651f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,143 +17,143 @@
 	* db2/db.h: Likewise.
 	* db2/db_185.h: Likewise.
 	* db2/db_int.h: Likewise.
-	* db2/bt_close.c: Likewise.
-	* db2/bt_compare.c: Likewise.
-	* db2/bt_conv.c: Likewise.
-	* db2/bt_cursor.c: Likewise.
-	* db2/bt_delete.c: Likewise.
-	* db2/bt_open.c: Likewise.
-	* db2/bt_page.c: Likewise.
-	* db2/bt_put.c: Likewise.
-	* db2/bt_rec.c: Likewise.
-	* db2/bt_recno.c: Likewise.
-	* db2/bt_rsearch.c: Likewise.
-	* db2/bt_search.c: Likewise.
-	* db2/bt_split.c: Likewise.
-	* db2/bt_stat.c: Likewise.
-	* db2/btree.src: Likewise.
-	* db2/btree_auto.c: Likewise.
-	* db2/getlong.c: Likewise.
-	* db2/db_appinit.c: Likewise.
-	* db2/db_apprec.c: Likewise.
-	* db2/db_byteorder.c: Likewise.
-	* db2/db_err.c: Likewise.
-	* db2/db_log2.c: Likewise.
-	* db2/db_region.c: Likewise.
-	* db2/db_salloc.c: Likewise.
-	* db2/db_shash.c: Likewise.
-	* db2/db.c: Likewise.
-	* db2/db.src: Likewise.
-	* db2/db_auto.c: Likewise.
-	* db2/db_conv.c: Likewise.
-	* db2/db_dispatch.c: Likewise.
-	* db2/db_dup.c: Likewise.
-	* db2/db_overflow.c: Likewise.
-	* db2/db_pr.c: Likewise.
-	* db2/db_rec.c: Likewise.
-	* db2/db_ret.c: Likewise.
-	* db2/db_thread.c: Likewise.
-	* db2/db185.c: Likewise.
-	* db2/db185_int.h: Likewise.
-	* db2/dbm.c: Likewise.
-	* db2/hash.c: Likewise.
-	* db2/hash.src: Likewise.
-	* db2/hash_auto.c: Likewise.
-	* db2/hash_conv.c: Likewise.
-	* db2/hash_debug.c: Likewise.
-	* db2/hash_dup.c: Likewise.
-	* db2/hash_func.c: Likewise.
-	* db2/hash_page.c: Likewise.
-	* db2/hash_rec.c: Likewise.
-	* db2/hash_stat.c: Likewise.
-	* db2/btree.h: Likewise.
-	* db2/btree_ext.h: Likewise.
-	* db2/clib_ext.h: Likewise.
-	* db2/common_ext.h: Likewise.
-	* db2/cxx_int.h: Likewise.
-	* db2/db.h.src: Likewise.
-	* db2/db_185.h.src: Likewise.
-	* db2/db_am.h: Likewise.
-	* db2/db_auto.h: Likewise.
-	* db2/db_cxx.h: Likewise.
-	* db2/db_dispatch.h: Likewise.
-	* db2/db_ext.h: Likewise.
-	* db2/db_int.h.src: Likewise.
-	* db2/db_page.h: Likewise.
-	* db2/db_shash.h: Likewise.
-	* db2/db_swap.h: Likewise.
-	* db2/hash.h: Likewise.
-	* db2/hash_ext.h: Likewise.
-	* db2/lock.h: Likewise.
-	* db2/lock_ext.h: Likewise.
-	* db2/log.h: Likewise.
-	* db2/log_ext.h: Likewise.
-	* db2/mp.h: Likewise.
-	* db2/mp_ext.h: Likewise.
-	* db2/mutex_ext.h: Likewise.
-	* db2/os_ext.h: Likewise.
-	* db2/os_func.h: Likewise.
-	* db2/queue.h: Likewise.
-	* db2/shqueue.h: Likewise.
-	* db2/txn.h: Likewise.
-	* db2/lock.c: Likewise.
-	* db2/lock_conflict.c: Likewise.
-	* db2/lock_deadlock.c: Likewise.
-	* db2/lock_region.c: Likewise.
-	* db2/lock_util.c: Likewise.
-	* db2/log.c: Likewise.
-	* db2/log.src: Likewise.
-	* db2/log_archive.c: Likewise.
-	* db2/log_auto.c: Likewise.
-	* db2/log_compare.c: Likewise.
-	* db2/log_findckp.c: Likewise.
-	* db2/log_get.c: Likewise.
-	* db2/log_put.c: Likewise.
-	* db2/log_rec.c: Likewise.
-	* db2/log_register.c: Likewise.
-	* db2/mp_bh.c: Likewise.
-	* db2/mp_fget.c: Likewise.
-	* db2/mp_fopen.c: Likewise.
-	* db2/mp_fput.c: Likewise.
-	* db2/mp_fset.c: Likewise.
-	* db2/mp_open.c: Likewise.
-	* db2/mp_pr.c: Likewise.
-	* db2/mp_region.c: Likewise.
-	* db2/mp_sync.c: Likewise.
-	* db2/68020.gcc: Likewise.
-	* db2/mutex.c: Likewise.
-	* db2/parisc.gcc: Likewise.
-	* db2/parisc.hp: Likewise.
-	* db2/sco.cc: Likewise.
-	* db2/os_abs.c: Likewise.
-	* db2/os_alloc.c: Likewise.
-	* db2/os_config.c: Likewise.
-	* db2/os_dir.c: Likewise.
-	* db2/os_fid.c: Likewise.
-	* db2/os_fsync.c: Likewise.
-	* db2/os_map.c: Likewise.
-	* db2/os_oflags.c: Likewise.
-	* db2/os_open.c: Likewise.
-	* db2/os_rpath.c: Likewise.
-	* db2/os_rw.c: Likewise.
-	* db2/os_seek.c: Likewise.
-	* db2/os_sleep.c: Likewise.
-	* db2/os_spin.c: Likewise.
-	* db2/os_stat.c: Likewise.
-	* db2/os_unlink.c: Likewise.
-	* db2/db_archive.c: Likewise.
-	* db2/db_checkpoint.c: Likewise.
-	* db2/db_deadlock.c: Likewise.
-	* db2/db_dump.c: Likewise.
-	* db2/db_dump185.c: Likewise.
-	* db2/db_load.c: Likewise.
-	* db2/db_printlog.c: Likewise.
-	* db2/db_recover.c: Likewise.
-	* db2/db_stat.c: Likewise.
-	* db2/txn.c: Likewise.
-	* db2/txn.src: Likewise.
-	* db2/txn_auto.c: Likewise.
-	* db2/txn_rec.c: Likewise.
+	* db2/btree/bt_close.c: Likewise.
+	* db2/btree/bt_compare.c: Likewise.
+	* db2/btree/bt_conv.c: Likewise.
+	* db2/btree/bt_cursor.c: Likewise.
+	* db2/btree/bt_delete.c: Likewise.
+	* db2/btree/bt_open.c: Likewise.
+	* db2/btree/bt_page.c: Likewise.
+	* db2/btree/bt_put.c: Likewise.
+	* db2/btree/bt_rec.c: Likewise.
+	* db2/btree/bt_recno.c: Likewise.
+	* db2/btree/bt_rsearch.c: Likewise.
+	* db2/btree/bt_search.c: Likewise.
+	* db2/btree/bt_split.c: Likewise.
+	* db2/btree/bt_stat.c: Likewise.
+	* db2/btree/btree.src: Likewise.
+	* db2/btree/btree_auto.c: Likewise.
+	* db2/clib/getlong.c: Likewise.
+	* db2/common/db_appinit.c: Likewise.
+	* db2/common/db_apprec.c: Likewise.
+	* db2/common/db_byteorder.c: Likewise.
+	* db2/common/db_err.c: Likewise.
+	* db2/common/db_log2.c: Likewise.
+	* db2/common/db_region.c: Likewise.
+	* db2/common/db_salloc.c: Likewise.
+	* db2/common/db_shash.c: Likewise.
+	* db2/db/db.c: Likewise.
+	* db2/db/db.src: Likewise.
+	* db2/db/db_auto.c: Likewise.
+	* db2/db/db_conv.c: Likewise.
+	* db2/db/db_dispatch.c: Likewise.
+	* db2/db/db_dup.c: Likewise.
+	* db2/db/db_overflow.c: Likewise.
+	* db2/db/db_pr.c: Likewise.
+	* db2/db/db_rec.c: Likewise.
+	* db2/db/db_ret.c: Likewise.
+	* db2/db/db_thread.c: Likewise.
+	* db2/db185/db185.c: Likewise.
+	* db2/db185/db185_int.h: Likewise.
+	* db2/dbm/dbm.c: Likewise.
+	* db2/hash/hash.c: Likewise.
+	* db2/hash/hash.src: Likewise.
+	* db2/hash/hash_auto.c: Likewise.
+	* db2/hash/hash_conv.c: Likewise.
+	* db2/hash/hash_debug.c: Likewise.
+	* db2/hash/hash_dup.c: Likewise.
+	* db2/hash/hash_func.c: Likewise.
+	* db2/hash/hash_page.c: Likewise.
+	* db2/hash/hash_rec.c: Likewise.
+	* db2/hash/hash_stat.c: Likewise.
+	* db2/include/btree.h: Likewise.
+	* db2/include/btree_ext.h: Likewise.
+	* db2/include/clib_ext.h: Likewise.
+	* db2/include/common_ext.h: Likewise.
+	* db2/include/cxx_int.h: Likewise.
+	* db2/include/db.h.src: Likewise.
+	* db2/include/db_185.h.src: Likewise.
+	* db2/include/db_am.h: Likewise.
+	* db2/include/db_auto.h: Likewise.
+	* db2/include/db_cxx.h: Likewise.
+	* db2/include/db_dispatch.h: Likewise.
+	* db2/include/db_ext.h: Likewise.
+	* db2/include/db_int.h.src: Likewise.
+	* db2/include/db_page.h: Likewise.
+	* db2/include/db_shash.h: Likewise.
+	* db2/include/db_swap.h: Likewise.
+	* db2/include/hash.h: Likewise.
+	* db2/include/hash_ext.h: Likewise.
+	* db2/include/lock.h: Likewise.
+	* db2/include/lock_ext.h: Likewise.
+	* db2/include/log.h: Likewise.
+	* db2/include/log_ext.h: Likewise.
+	* db2/include/mp.h: Likewise.
+	* db2/include/mp_ext.h: Likewise.
+	* db2/include/mutex_ext.h: Likewise.
+	* db2/include/os_ext.h: Likewise.
+	* db2/include/os_func.h: Likewise.
+	* db2/include/queue.h: Likewise.
+	* db2/include/shqueue.h: Likewise.
+	* db2/include/txn.h: Likewise.
+	* db2/lock/lock.c: Likewise.
+	* db2/lock/lock_conflict.c: Likewise.
+	* db2/lock/lock_deadlock.c: Likewise.
+	* db2/lock/lock_region.c: Likewise.
+	* db2/lock/lock_util.c: Likewise.
+	* db2/log/log.c: Likewise.
+	* db2/log/log.src: Likewise.
+	* db2/log/log_archive.c: Likewise.
+	* db2/log/log_auto.c: Likewise.
+	* db2/log/log_compare.c: Likewise.
+	* db2/log/log_findckp.c: Likewise.
+	* db2/log/log_get.c: Likewise.
+	* db2/log/log_put.c: Likewise.
+	* db2/log/log_rec.c: Likewise.
+	* db2/log/log_register.c: Likewise.
+	* db2/mp/mp_bh.c: Likewise.
+	* db2/mp/mp_fget.c: Likewise.
+	* db2/mp/mp_fopen.c: Likewise.
+	* db2/mp/mp_fput.c: Likewise.
+	* db2/mp/mp_fset.c: Likewise.
+	* db2/mp/mp_open.c: Likewise.
+	* db2/mp/mp_pr.c: Likewise.
+	* db2/mp/mp_region.c: Likewise.
+	* db2/mp/mp_sync.c: Likewise.
+	* db2/mutex/68020.gcc: Likewise.
+	* db2/mutex/mutex.c: Likewise.
+	* db2/mutex/parisc.gcc: Likewise.
+	* db2/mutex/parisc.hp: Likewise.
+	* db2/mutex/sco.cc: Likewise.
+	* db2/os/os_abs.c: Likewise.
+	* db2/os/os_alloc.c: Likewise.
+	* db2/os/os_config.c: Likewise.
+	* db2/os/os_dir.c: Likewise.
+	* db2/os/os_fid.c: Likewise.
+	* db2/os/os_fsync.c: Likewise.
+	* db2/os/os_map.c: Likewise.
+	* db2/os/os_oflags.c: Likewise.
+	* db2/os/os_open.c: Likewise.
+	* db2/os/os_rpath.c: Likewise.
+	* db2/os/os_rw.c: Likewise.
+	* db2/os/os_seek.c: Likewise.
+	* db2/os/os_sleep.c: Likewise.
+	* db2/os/os_spin.c: Likewise.
+	* db2/os/os_stat.c: Likewise.
+	* db2/os/os_unlink.c: Likewise.
+	* db2/progs/db_archive/db_archive.c: Likewise.
+	* db2/progs/db_checkpoint/db_checkpoint.c: Likewise.
+	* db2/progs/db_deadlock/db_deadlock.c: Likewise.
+	* db2/progs/db_dump/db_dump.c: Likewise.
+	* db2/progs/db_dump185/db_dump185.c: Likewise.
+	* db2/progs/db_load/db_load.c: Likewise.
+	* db2/progs/db_printlog/db_printlog.c: Likewise.
+	* db2/progs/db_recover/db_recover.c: Likewise.
+	* db2/progs/db_stat/db_stat.c: Likewise.
+	* db2/txn/txn.c: Likewise.
+	* db2/txn/txn.src: Likewise.
+	* db2/txn/txn_auto.c: Likewise.
+	* db2/txn/txn_rec.c: Likewise.
 
 	* elf/rtld.c: Move definition of __libc_stack_end to ...
 	* sysdeps/generic/dl-sysdep.h: ...here.
@@ -162,6 +162,10 @@
 	* sysdeps/unix/sysv/linux/bits/statvfs.h: Define ST_NODIRATIME.
 	* sysdeps/unix/sysv/linux/sys/mount.h: Define MS_NODIRATIME.
 
+	* sysdeps/generic/libc-start.c: Always set __libc_stack_end.
+	* sysdeps/i386/backtrace.c: Test whether frame pointer is legal
+	before following it.
+
 1998-06-08 21:44  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/unix/sysv/linux/fstatvfs.c: Handle constant option string
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index c89ef1e515..1daf1bc31c 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,13 @@
+1998-06-09 15:07  Ulrich Drepper  <drepper@cygnus.com>
+
+	* manager.c: Define __pthread_manager_adjust_prio and use it to
+	increase priority when needed.
+	* internals.h: Add prototype for __pthread_manager_adjust_prio.
+	* mutex.c: Optimize mutexes to wake up only one thread.
+	* pthread.c: Move PID of manager fro global variable in structure
+	element.
+	Patches by Xavier Leroy.
+
 1998-06-07 13:47  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/pthread/bits/libc-lock.h: Optimize cleanup handlers a bit.
diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c
index 1e07929e7e..c1a4c1e55f 100644
--- a/sysdeps/generic/libc-start.c
+++ b/sysdeps/generic/libc-start.c
@@ -39,10 +39,10 @@ __libc_start_main (int (*main) (int, char **, char **), int argc,
   int *dummy_addr = &_dl_starting_up;
 
   __libc_multiple_libcs = dummy_addr && !_dl_starting_up;
+#endif
 
   /* Store the lowest stack address.  */
   __libc_stack_end = stack_end;
-#endif
 
   /* Set the global _environ variable correctly.  */
   __environ = &argv[argc + 1];
diff --git a/sysdeps/i386/backtrace.c b/sysdeps/i386/backtrace.c
index 0d484c7723..5e84205b04 100644
--- a/sysdeps/i386/backtrace.c
+++ b/sysdeps/i386/backtrace.c
@@ -21,6 +21,11 @@
 #include <execinfo.h>
 
 
+/* This is a global variable set at program start time.  It marks the
+   highest used stack address.  */
+extern void *__libc_stack_end;
+
+
 /* This is the stack alyout we see with every stack frame.
 
             +-----------------+        +-----------------+
@@ -42,6 +47,7 @@ __backtrace (array, size)
 {
   /* We assume that all the code is generated with frame pointers set.  */
   register void *ebp __asm__ ("ebp");
+  register void *esp __asm__ ("esp");
   struct layout *current;
   int cnt = 0;
 
@@ -49,8 +55,10 @@ __backtrace (array, size)
   current = (struct layout *) ebp;
   while (cnt < size)
     {
-      if (current == NULL)
-	/* This means the toplevel is reached.  */
+      if (current < esp || current > __libc_stack_end)
+	/* This means the address is out of range.  Note that for the
+	   toplevel we see a frame pointer with value NULL which clearly is
+	   out of range.  */
 	break;
 
       array[cnt++] = current->return_address;