PERFORCE change 52494 for review
Marcel Moolenaar
marcel at FreeBSD.org
Fri May 7 22:19:13 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=52494
Change 52494 by marcel at marcel_nfs on 2004/05/07 22:18:41
Rewrite the handling of threads to use the new thread support
functions.
Affected files ...
.. //depot/projects/gdb/sys/gdb/gdb_main.c#14 edit
Differences ...
==== //depot/projects/gdb/sys/gdb/gdb_main.c#14 (text+ko) ====
@@ -92,7 +92,7 @@
static int
gdb_trap(int type, int code)
{
- struct proc *thr_iter;
+ struct thread *thr_iter;
/*
* Send a T packet. We currently do not support watchpoints (the
@@ -138,10 +138,17 @@
break;
case 'H': { /* Set thread. */
intmax_t tid;
+ struct thread *thr;
gdb_rx_char();
gdb_rx_varhex(&tid);
- if (tid > 0)
- kdb_set_thread(tid);
+ if (tid > 0) {
+ thr = kdb_thr_lookup(tid);
+ if (thr == NULL) {
+ gdb_tx_err(ENOENT);
+ break;
+ }
+ kdb_thr_select(thr);
+ }
gdb_tx_ok();
break;
}
@@ -176,19 +183,19 @@
}
case 'q': /* General query. */
if (gdb_rx_equal("fThreadInfo")) {
- thr_iter = LIST_FIRST(&allproc);
+ thr_iter = kdb_thr_first();
gdb_tx_begin('m');
- gdb_tx_hex(thr_iter->p_pid, 8);
+ gdb_tx_hex(thr_iter->td_tid, 8);
gdb_tx_end();
} else if (gdb_rx_equal("sThreadInfo")) {
if (thr_iter == NULL) {
gdb_tx_err(ENXIO);
break;
}
- thr_iter = LIST_NEXT(thr_iter, p_list);
+ thr_iter = kdb_thr_next(thr_iter);
if (thr_iter != NULL) {
gdb_tx_begin('m');
- gdb_tx_hex(thr_iter->p_pid, 8);
+ gdb_tx_hex(thr_iter->td_tid, 8);
gdb_tx_end();
} else {
gdb_tx_begin('l');
@@ -206,14 +213,11 @@
}
case 'T': { /* Thread alive. */
intmax_t tid;
- pid_t curtid;
gdb_rx_varhex(&tid);
- curtid = kdb_thread->td_tid;
- if (kdb_set_thread(tid))
+ if (kdb_thr_lookup(tid) != NULL)
gdb_tx_ok();
else
gdb_tx_err(ENOENT);
- kdb_set_thread(curtid);
break;
}
case -1:
More information about the p4-projects
mailing list