Blob


1 #include <u.h>
2 #include <thread_db.h>
3 #include <sys/ptrace.h>
4 #include <errno.h>
5 #include <sys/procfs.h> /* psaddr_t */
6 #include <libc.h>
7 #include <mach.h>
9 static char *tderrstr[] =
10 {
11 [TD_OK] "no error",
12 [TD_ERR] "some error",
13 [TD_NOTHR] "no matching thread found",
14 [TD_NOSV] "no matching synchronization handle found",
15 [TD_NOLWP] "no matching light-weight process found",
16 [TD_BADPH] "invalid process handle",
17 [TD_BADTH] "invalid thread handle",
18 [TD_BADSH] "invalid synchronization handle",
19 [TD_BADTA] "invalid thread agent",
20 [TD_BADKEY] "invalid key",
21 [TD_NOMSG] "no event available",
22 [TD_NOFPREGS] "no floating-point register content available",
23 [TD_NOLIBTHREAD] "application not linked with thread library",
24 [TD_NOEVENT] "requested event is not supported",
25 [TD_NOEVENT] "requested event is not supported",
26 [TD_NOCAPAB] "capability not available",
27 [TD_DBERR] "internal debug library error",
28 [TD_NOAPLIC] "operation is not applicable",
29 [TD_NOTSD] "no thread-specific data available",
30 [TD_MALLOC] "out of memory",
31 [TD_PARTIALREG] "not entire register set was read or written",
32 [TD_NOXREGS] "X register set not available for given threads",
33 [TD_TLSDEFER] "thread has not yet allocated TLS for given module",
34 [TD_VERSION] "version mismatch twixt libpthread and libthread_db",
35 [TD_NOTLS] "there is no TLS segment in the given module",
36 };
38 static char*
39 terr(int e)
40 {
41 static char buf[50];
43 if(e < 0 || e >= nelem(tderrstr) || tderrstr[e] == nil){
44 snprint(buf, sizeof buf, "thread err %d", e);
45 return buf;
46 }
47 return tderrstr[e];
48 }