libexplain
1.4.D001
|
00001 /* 00002 * libexplain - a library of system-call-specific strerror replacements 00003 * Copyright (C) 2010, 2011, 2013 Peter Miller 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as 00007 * published by the Free Software Foundation; either version 3 of the 00008 * License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 */ 00018 00019 #include <libexplain/ac/sys/ptrace.h> 00020 00021 #include <libexplain/buffer/ptrace_request.h> 00022 #include <libexplain/parse_bits.h> 00023 00024 00025 static const explain_parse_bits_table_t table[] = 00026 { 00027 #ifdef PT_TRACE_ME 00028 { "PT_TRACE_ME", PT_TRACE_ME }, 00029 #endif 00030 #if defined(PTRACE_TRACEME) 00031 { "PTRACE_TRACEME", PTRACE_TRACEME }, 00032 #endif 00033 00034 #ifdef PT_READ_I 00035 { "PT_READ_I", PT_READ_I }, 00036 #endif 00037 #if defined(PTRACE_PEEKTEXT) 00038 { "PTRACE_PEEKTEXT", PTRACE_PEEKTEXT }, 00039 #endif 00040 00041 #ifdef PT_READ_D 00042 { "PT_READ_D", PT_READ_D }, 00043 #endif 00044 #if defined(PTRACE_PEEKDATA) 00045 { "PTRACE_PEEKDATA", PTRACE_PEEKDATA }, 00046 #endif 00047 00048 #ifdef PT_READ_U 00049 { "PT_READ_U", PT_READ_U }, 00050 #endif 00051 #if defined(PTRACE_PEEKUSER) 00052 { "PTRACE_PEEKUSER", PTRACE_PEEKUSER }, 00053 #endif 00054 00055 #ifdef PT_WRITE_I 00056 { "PT_WRITE_I", PT_WRITE_I }, 00057 #endif 00058 #if defined(PTRACE_POKETEXT) 00059 { "PTRACE_POKETEXT", PTRACE_POKETEXT }, 00060 #endif 00061 00062 #ifdef PT_WRITE_D 00063 { "PT_WRITE_D", PT_WRITE_D }, 00064 #endif 00065 #if defined(PTRACE_POKEDATA) 00066 { "PTRACE_POKEDATA", PTRACE_POKEDATA }, 00067 #endif 00068 00069 #ifdef PT_WRITE_U 00070 { "PT_WRITE_U", PT_WRITE_U }, 00071 #endif 00072 #if defined(PTRACE_POKEUSER) 00073 { "PTRACE_POKEUSER", PTRACE_POKEUSER }, 00074 #endif 00075 00076 #ifdef PT_CONTINUE 00077 { "PT_CONTINUE", PT_CONTINUE }, 00078 #endif 00079 #if defined(PTRACE_CONT) 00080 { "PTRACE_CONT", PTRACE_CONT }, 00081 #endif 00082 00083 #ifdef PT_KILL 00084 { "PT_KILL", PT_KILL }, 00085 #endif 00086 #if defined(PTRACE_KILL) 00087 { "PTRACE_KILL", PTRACE_KILL }, 00088 #endif 00089 00090 #ifdef PT_STEP 00091 { "PT_STEP", PT_STEP }, 00092 #endif 00093 #if defined(PTRACE_SINGLESTEP) 00094 { "PTRACE_SINGLESTEP", PTRACE_SINGLESTEP }, 00095 #endif 00096 00097 #ifdef PT_GETREGS 00098 { "PT_GETREGS", PT_GETREGS }, 00099 #endif 00100 #if defined(PTRACE_GETREGS) 00101 { "PTRACE_GETREGS", PTRACE_GETREGS }, 00102 #endif 00103 00104 #ifdef PT_SETREGS 00105 { "PT_SETREGS", PT_SETREGS }, 00106 #endif 00107 #if defined(PTRACE_SETREGS) 00108 { "PTRACE_SETREGS", PTRACE_SETREGS }, 00109 #endif 00110 00111 #ifdef PT_GETFPREGS 00112 { "PT_GETFPREGS", PT_GETFPREGS }, 00113 #endif 00114 #if defined(PTRACE_GETFPREGS) 00115 { "PTRACE_GETFPREGS", PTRACE_GETFPREGS }, 00116 #endif 00117 00118 #ifdef PT_SETFPREGS 00119 { "PT_SETFPREGS", PT_SETFPREGS }, 00120 #endif 00121 #if defined(PTRACE_SETFPREGS) 00122 { "PTRACE_SETFPREGS", PTRACE_SETFPREGS }, 00123 #endif 00124 00125 #ifdef PT_ATTACH 00126 { "PT_ATTACH", PT_ATTACH }, 00127 #endif 00128 #if defined(PTRACE_ATTACH) 00129 { "PTRACE_ATTACH", PTRACE_ATTACH }, 00130 #endif 00131 00132 #ifdef PT_DETACH 00133 { "PT_DETACH", PT_DETACH }, 00134 #endif 00135 #if defined(PTRACE_DETACH) 00136 { "PTRACE_DETACH", PTRACE_DETACH }, 00137 #endif 00138 00139 #ifdef PT_IO 00140 { "PT_IO", PT_IO }, 00141 #endif 00142 #ifdef PT_LWPINFO 00143 { "PT_LWPINFO", PT_LWPINFO }, 00144 #endif 00145 #ifdef PT_GETNUMLWPS 00146 { "PT_GETNUMLWPS", PT_GETNUMLWPS }, 00147 #endif 00148 #ifdef PT_GETLWPLIST 00149 { "PT_GETLWPLIST", PT_GETLWPLIST }, 00150 #endif 00151 #ifdef PT_CLEARSTEP 00152 { "PT_CLEARSTEP", PT_CLEARSTEP }, 00153 #endif 00154 #ifdef PT_SETSTEP 00155 { "PT_SETSTEP", PT_SETSTEP }, 00156 #endif 00157 #ifdef PT_SUSPEND 00158 { "PT_SUSPEND", PT_SUSPEND }, 00159 #endif 00160 #ifdef PT_RESUME 00161 { "PT_RESUME", PT_RESUME }, 00162 #endif 00163 #ifdef PT_TO_SCE 00164 { "PT_TO_SCE", PT_TO_SCE }, 00165 #endif 00166 #ifdef PT_TO_SCX 00167 { "PT_TO_SCX ", PT_TO_SCX }, 00168 #endif 00169 #ifdef PT_GETDBREGS 00170 { "PT_GETDBREGS", PT_GETDBREGS }, 00171 #endif 00172 #ifdef PT_SETDBREGS 00173 { "PT_SETDBREGS", PT_SETDBREGS }, 00174 #endif 00175 #ifdef PT_VM_TIMESTAMP 00176 { "PT_VM_TIMESTAMP", PT_VM_TIMESTAMP }, 00177 #endif 00178 #ifdef PT_VM_ENTRY 00179 { "PT_VM_ENTRY", PT_VM_ENTRY }, 00180 #endif 00181 00182 #ifdef PT_GETFPXREGS 00183 { "PT_GETFPXREGS", PT_GETFPXREGS }, 00184 #endif 00185 #if defined(PTRACE_GETFPXREGS) 00186 { "PTRACE_GETFPXREGS", PTRACE_GETFPXREGS }, 00187 #endif 00188 00189 #ifdef TP_SETFPXREGS 00190 { "TP_SETFPXREGS", TP_SETFPXREGS }, 00191 #endif 00192 #if defined(PTRACE_SETFPXREGS) 00193 { "PTRACE_SETFPXREGS", PTRACE_SETFPXREGS }, 00194 #endif 00195 00196 #ifdef PT_SYSCALL 00197 { "PT_SYSCALL", PT_SYSCALL }, 00198 #endif 00199 #if defined(PTRACE_SYSCALL) 00200 { "PTRACE_SYSCALL", PTRACE_SYSCALL }, 00201 #endif 00202 00203 #ifdef PT_SETOPTIONS 00204 { "PT_SETOPTIONS", PT_SETOPTIONS }, 00205 #endif 00206 #if defined(PTRACE_SETOPTIONS) 00207 { "PTRACE_SETOPTIONS", PTRACE_SETOPTIONS }, 00208 #endif 00209 00210 #ifdef PT_OLDSETOPTIONS 00211 { "PT_OLDSETOPTIONS", PT_OLDSETOPTIONS }, 00212 #endif 00213 #if defined(PTRACE_OLDSETOPTIONS) 00214 { "PTRACE_OLDSETOPTIONS", PTRACE_OLDSETOPTIONS }, 00215 #endif 00216 00217 #ifdef PT_GETEVENTMSG 00218 { "PT_GETEVENTMSG", PT_GETEVENTMSG }, 00219 #endif 00220 #if defined(PTRACE_GETEVENTMSG) 00221 { "PTRACE_GETEVENTMSG", PTRACE_GETEVENTMSG }, 00222 #endif 00223 00224 #ifdef PT_GETSIGINFO 00225 { "PT_GETSIGINFO", PT_GETSIGINFO }, 00226 #endif 00227 #if defined(PTRACE_GETSIGINFO) 00228 { "PTRACE_GETSIGINFO", PTRACE_GETSIGINFO }, 00229 #endif 00230 00231 #ifdef PT_SETSIGINFO 00232 { "PT_SETSIGINFO", PT_SETSIGINFO }, 00233 #endif 00234 #if defined(PTRACE_SETSIGINFO) 00235 { "PTRACE_SETSIGINFO", PTRACE_SETSIGINFO }, 00236 #endif 00237 00238 #ifdef PT_SYSEMU 00239 { "PT_SYSEMU", PT_SYSEMU }, 00240 #endif 00241 #if defined(PTRACE_SYSEMU) 00242 { "PTRACE_SYSEMU", PTRACE_SYSEMU }, 00243 #endif 00244 00245 #ifdef PT_SYSEMU_SINGLESTEP 00246 { "PT_SYSEMU_SINGLESTEP", PT_SYSEMU_SINGLESTEP }, 00247 #endif 00248 #if defined(PTRACE_SYSEMU_SINGLESTEP) 00249 { "PTRACE_SYSEMU_SINGLESTEP", PTRACE_SYSEMU_SINGLESTEP }, 00250 #endif 00251 }; 00252 00253 00254 void 00255 explain_buffer_ptrace_request(explain_string_buffer_t *sb, int value) 00256 { 00257 explain_parse_bits_print_single(sb, value, table, SIZEOF(table)); 00258 } 00259 00260 00261 int 00262 explain_parse_ptrace_request_or_die(const char *text, const char *caption) 00263 { 00264 return explain_parse_bits_or_die(text, table, SIZEOF(table), caption); 00265 } 00266 00267 00268 /* vim: set ts=8 sw=4 et : */