aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-thread.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-11-09 01:23:30 +0000
committerJason Molenda <jmolenda@apple.com>1999-11-09 01:23:30 +0000
commit11cf87416416e13eff634a70b4954fe6a3912720 (patch)
treea6dc7a21bb3d45b89c3f95e4b5862ec9d2fab83b /gdb/linux-thread.c
parent98007ce7b0dea06f0c04d833d39b5a9c9773a07a (diff)
downloadgdb-11cf87416416e13eff634a70b4954fe6a3912720.zip
gdb-11cf87416416e13eff634a70b4954fe6a3912720.tar.gz
gdb-11cf87416416e13eff634a70b4954fe6a3912720.tar.bz2
import gdb-1999-11-08 snapshot
Diffstat (limited to 'gdb/linux-thread.c')
-rw-r--r--gdb/linux-thread.c56
1 files changed, 38 insertions, 18 deletions
diff --git a/gdb/linux-thread.c b/gdb/linux-thread.c
index 26e45e0..de5cdd7 100644
--- a/gdb/linux-thread.c
+++ b/gdb/linux-thread.c
@@ -831,11 +831,19 @@ update_stop_threads (test_pid)
do_cleanups (old_chain);
}
-/* This routine is called whenever a new symbol table is read in, or when all
- symbol tables are removed. libpthread can only be initialized when it
- finds the right variables in libpthread.so. Since it's a shared library,
- those variables don't show up until the library gets mapped and the symbol
- table is read in. */
+/* This routine is called whenever a new symbol table is read in, or
+ when all symbol tables are removed. linux-thread event handling
+ can only be initialized when we find the right variables in
+ libpthread.so. Since it's a shared library, those variables don't
+ show up until the library gets mapped and the symbol table is read
+ in. */
+
+/* This new_objfile event is now managed by a chained function pointer.
+ * It is the callee's responsability to call the next client on the chain.
+ */
+
+/* Saved pointer to previous owner of the new_objfile event. */
+static void (*target_new_objfile_chain) PARAMS ((struct objfile *));
void
linuxthreads_new_objfile (objfile)
@@ -853,17 +861,17 @@ linuxthreads_new_objfile (objfile)
/* Indicate that we don't know anything's address any more. */
linuxthreads_max = 0;
- return;
+ goto quit;
}
/* If we've already found our variables in another objfile, don't
bother looking for them again. */
if (linuxthreads_max)
- return;
+ goto quit;
if (! lookup_minimal_symbol ("__pthread_initial_thread", NULL, objfile))
/* This object file isn't the pthreads library. */
- return;
+ goto quit;
if ((ms = lookup_minimal_symbol ("__pthread_threads_debug",
NULL, objfile)) == NULL)
@@ -874,7 +882,7 @@ This program seems to use POSIX threads, but the thread library used\n\
does not support debugging. This may make using GDB difficult. Don't\n\
set breakpoints or single-step through code that might be executed by\n\
any thread other than the main thread.");
- return;
+ goto quit;
}
linuxthreads_debug = SYMBOL_VALUE_ADDRESS (ms);
@@ -888,7 +896,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_sizeof_handle");
- return;
+ goto quit;
}
if ((ms = lookup_minimal_symbol ("__pthread_offsetof_descr",
@@ -900,7 +908,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_offsetof_descr");
- return;
+ goto quit;
}
if ((ms = lookup_minimal_symbol ("__pthread_offsetof_pid",
@@ -912,11 +920,11 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_offsetof_pid");
- return;
+ goto quit;
}
if (! find_all_signal_vars (objfile))
- return;
+ goto quit;
/* Read adresses of internal structures to access */
if ((ms = lookup_minimal_symbol ("__pthread_handles",
@@ -925,7 +933,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_handles");
- return;
+ goto quit;
}
linuxthreads_handles = SYMBOL_VALUE_ADDRESS (ms);
@@ -935,7 +943,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_handles_num");
- return;
+ goto quit;
}
linuxthreads_num = SYMBOL_VALUE_ADDRESS (ms);
@@ -945,7 +953,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_manager_thread");
- return;
+ goto quit;
}
linuxthreads_manager = SYMBOL_VALUE_ADDRESS (ms) + linuxthreads_offset_pid;
@@ -955,7 +963,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_initial_thread");
- return;
+ goto quit;
}
linuxthreads_initial = SYMBOL_VALUE_ADDRESS (ms) + linuxthreads_offset_pid;
@@ -970,7 +978,7 @@ any thread other than the main thread.");
fprintf_unfiltered (gdb_stderr,
"Unable to find linuxthreads symbol \"%s\"\n",
"__pthread_threads_max");
- return;
+ goto quit;
}
/* Allocate gdb internal structures */
@@ -989,6 +997,11 @@ any thread other than the main thread.");
update_stop_threads (inferior_pid);
linuxthreads_attach_pending = 0;
}
+
+quit:
+ /* Call predecessor on chain, if any. */
+ if (target_new_objfile_chain)
+ target_new_objfile_chain (objfile);
}
/* If we have switched threads from a one that stopped at breakpoint,
@@ -1635,6 +1648,13 @@ _initialize_linuxthreads ()
add_target (&linuxthreads_ops);
child_suppress_run = 1;
+ /* Hook onto the "new_objfile" event.
+ * If someone else is already hooked onto the event,
+ * then make sure he will be called after we are.
+ */
+ target_new_objfile_chain = target_new_objfile_hook;
+ target_new_objfile_hook = linuxthreads_new_objfile;
+
/* Attach SIGCHLD handler */
sact.sa_handler = sigchld_handler;
sigemptyset (&sact.sa_mask);