The Witchcraft Compiler Collection
WCC
 All Data Structures Files Functions Variables Typedefs Macros
wsh.h
Go to the documentation of this file.
1 #define _GNU_SOURCE
2 #include <sys/prctl.h>
3 #include <setjmp.h>
4 #include <link.h>
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <fcntl.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <sys/stat.h>
11 #include <sys/types.h>
12 #include <fcntl.h>
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <sys/stat.h>
16 #include <sys/types.h>
17 #include <getopt.h>
18 #include <dlfcn.h>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <unistd.h>
23 #include <limits.h>
24 #include <errno.h>
25 #include <dlfcn.h>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <link.h>
29 #include <stdbool.h>
30 #include <errno.h>
31 #include <string.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <sys/types.h>
35 #include <sys/wait.h>
36 #include <unistd.h>
37 #include <poll.h>
38 #include <stropts.h>
39 #include <signal.h>
40 #include <stdio.h>
41 #include <malloc.h>
42 #include <stdlib.h>
43 #include <errno.h>
44 #include <sys/mman.h>
45 #include <ucontext.h>
46 #include <ctype.h>
47 #include <execinfo.h>
48 #include <stdio.h>
49 #include <stdlib.h>
50 #include <unistd.h>
51 #include <stdio.h>
52 #include <stdlib.h>
53 #include <sys/types.h>
54 #include <sys/wait.h>
55 #include <unistd.h>
56 #include <errno.h>
57 #include <malloc.h>
58 #include <signal.h>
59 #include <stdio.h>
60 #include <stdlib.h>
61 #include <sys/mman.h>
62 #include <unistd.h>
63 #include <pthread.h>
64 #include <sys/resource.h>
65 
66 #include <sys/ptrace.h>
67 #include <signal.h>
68 
69 #include <longjmp.h>
70 
71 #define USE_LUA 1
72 // Use either lua or luajit
73 #ifdef USE_LUA
74 #include <lua.h>
75 #include <lauxlib.h>
76 #include <lualib.h>
77 #else
78 #include "mylaux.h"
79 #include "luajit.h"
80 #endif
81 
82 #include <stdio.h>
83 #include <stdlib.h>
84 #include <string.h>
85 #include <unistd.h>
86 #include <limits.h>
87 #include <errno.h>
88 #include <stdio.h>
89 #include <stdlib.h>
90 #include <string.h>
91 #include <errno.h>
92 #include <sys/stat.h>
93 #include <sys/types.h>
94 #include <linenoise.h>
95 //#include <functions_list.h>
96 #include "helper.h"
97 #include <colors.h>
98 //#include <sigs.h>
99 #include <ucontext.h>
100 #include <config.h>
101 #include <utlist.h>
102 
103 #define DEFAULT_SCRIPT "/usr/share/wcc/scripts/debug"
104 #define DEFAULT_SCRIPT_INDEX "/usr/share/wcc/scripts/INDEX"
105 #define PROC_ASLR_PATH "/proc/sys/kernel/randomize_va_space"
106 
107 #define DEFAULT_LEARN_FILE "./learnwitch.log"
108 
109 #define MAX_SIGNALS 2000000
110 
111 #define MY_CPU 1 // Which CPU to set affinity to
112 
113 #define BIND_FLAGS RTLD_NOW
114 
115 /*
116 #define save_context(c){ \
117  memset(c, 0x00, sizeof(ucontext_t)); \
118  kill(getpid(),42); \
119 } \
120 */
121 
122 #define DMGL_PARAMS (1 << 0)
123 #define DMGL_ANSI (1 << 1)
124 #define DMGL_ARM (1 << 11)
125 
126 #ifdef __x86_64__
127 #define Elf_Dyn Elf64_Dyn
128 #define Elf_Ehdr Elf64_Ehdr
129 #define Elf_Phdr Elf64_Phdr
130 #define Elf_Shdr Elf64_Shdr
131 #define Elf_Sym Elf64_Sym
132 #else
133 #define Elf_Dyn Elf32_Dyn
134 #define Elf_Ehdr Elf32_Ehdr
135 #define Elf_Phdr Elf32_Phdr
136 #define Elf_Shdr Elf32_Shdr
137 #define Elf_Sym Elf32_Sym
138 #endif
139 
140 #define HPERMSMAX 5
141 
142 #define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
143 #define ELF32_ST_TYPE(val) ((val) & 0xf)
144 #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
145 
146 #define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
147 #define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
148 #define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
149 
150 #define STB_LOCAL 0
151 #define STB_GLOBAL 1
152 #define STB_WEAK 2
153 #define STB_GNU_UNIQUE 10
154 #define STB_GNU_SECONDARY 11
155 
156 #define STT_NOTYPE 0
157 #define STT_OBJECT 1
158 #define STT_FUNC 2
159 #define STT_SECTION 3
160 #define STT_FILE 4
161 #define STT_COMMON 5
162 #define STT_TLS 6
163 
164 
165 #define LINES_MAX 50
166 
167 
171 #define read_arg1(arg1){ \
172  if (lua_isnil(L, 1)) { \
173  arg1 = 0; \
174  } else if (lua_isnumber(L, 1)) { \
175  arg1 = (unsigned long) lua_tonumber(L, 1); \
176  } else if (lua_isstring(L, 1)) { \
177  arg1 = luaL_checkstring(L, 1); \
178  } else if (lua_istable(L, 1)) { \
179  } else if (lua_isfunction(L, 1)) { \
180  arg1 = lua_tocfunction(L, 1); \
181  } else if (lua_iscfunction(L, 1)) { \
182  arg1 = lua_touserdata(L, 1); \
183  } else if (lua_isuserdata(L, 1)) { \
184  arg1 = lua_touserdata(L, 1); \
185  } else { \
186  arg1 = 0; \
187  } \
188 }
189 
193 #define read_arg2(arg2){ \
194  if (lua_isnil(L, 2)) { \
195  arg2 = 0; \
196  } else if (lua_isnumber(L, 2)) { \
197  arg2 = (unsigned long) lua_tonumber(L, 2); \
198  } else if (lua_isstring(L, 2)) { \
199  arg2 = luaL_checkstring(L, 2); \
200  } else if (lua_istable(L, 2)) { \
201  } else if (lua_isfunction(L, 2)) { \
202  arg2 = lua_tocfunction(L, 2); \
203  } else if (lua_iscfunction(L, 2)) { \
204  arg2 = lua_touserdata(L, 2); \
205  } else if (lua_isuserdata(L, 2)) { \
206  arg2 = lua_touserdata(L, 2); \
207  } else { \
208  arg2 = 0; \
209  } \
210 }
211 
215 #define read_arg3(arg3){ \
216  if (lua_isnil(L, 3)) { \
217  arg3 = 0; \
218  } else if (lua_isnumber(L, 3)) { \
219  arg3 = (unsigned long) lua_tonumber(L, 3); \
220  } else if (lua_isstring(L, 3)) { \
221  arg3 = luaL_checkstring(L, 3); \
222  } else if (lua_istable(L, 3)) { \
223  } else if (lua_isfunction(L, 3)) { \
224  arg3 = lua_tocfunction(L, 3); \
225  } else if (lua_iscfunction(L, 3)) { \
226  arg3 = lua_touserdata(L, 3); \
227  } else if (lua_isuserdata(L, 3)) { \
228  arg3 = lua_touserdata(L, 3); \
229  } else { \
230  arg3 = 0; \
231  } \
232 }
233 
237 #define read_arg4(arg4){ \
238  if (lua_isnil(L, 4)) { \
239  arg4 = 0; \
240  } else if (lua_isnumber(L, 4)) { \
241  arg4 = (unsigned long) lua_tonumber(L, 4); \
242  } else if (lua_isstring(L, 4)) { \
243  arg4 = luaL_checkstring(L, 4); \
244  } else if (lua_istable(L, 4)) { \
245  } else if (lua_isfunction(L, 4)) { \
246  arg4 = lua_tocfunction(L, 4); \
247  } else if (lua_iscfunction(L, 4)) { \
248  arg4 = lua_touserdata(L, 4); \
249  } else if (lua_isuserdata(L, 4)) { \
250  arg4 = lua_touserdata(L, 4); \
251  } else { \
252  arg4 = 0; \
253  } \
254 }
255 
259 #define read_arg(arg, j){ \
260  if (lua_isnil(L, j)) { \
261  arg = 0; \
262  } else if (lua_isnumber(L, j)) { \
263  arg = (unsigned long) lua_tonumber(L, j); \
264  } else if (lua_isstring(L, j)) { \
265  arg = luaL_checkstring(L, j); \
266  } else if (lua_istable(L, j)) { \
267  } else if (lua_isfunction(L, j)) { \
268  arg = lua_tocfunction(L, j); \
269  } else if (lua_iscfunction(L, j)) { \
270  arg = lua_touserdata(L, j); \
271  } else if (lua_isuserdata(L, j)) { \
272  arg = lua_touserdata(L, j); \
273  } else { \
274  arg = 0; \
275  } \
276 }
277 
278 #define SHELL_HISTORY_NAME ".wsh_history"
279 #define luaL_reg luaL_Reg
280 
281 #define MIN_BIN_SIZE 10
282 
283 #define FAULT_READ 1
284 #define FAULT_WRITE 2
285 #define FAULT_EXEC 4
286 
287 #define default_poison 0x61
288 
292 #ifdef DEBUG
293 #define SKIP_INIT 0 // for developpment
294 #define SKIP_BOTTOM 0
295 #else
296 #define SKIP_INIT 3
297 #define SKIP_BOTTOM 13
298 #endif
299 
303 char *cplus_demangle(const char *mangled, int options);
304 
308 extern char *__progname_full;
309 
313 int do_loadlib(char *libname);
314 int empty_phdrs(void);
315 int empty_shdrs(void);
316 //int getarray(lua_State * L);
317 int getsize(lua_State * L);
318 int newarray(lua_State * L);
319 int print_functions(lua_State * L);
320 int print_libs(lua_State * L);
321 int print_objects(lua_State * L);
322 int print_phdrs(void);
323 int print_shdrs(void);
324 int entrypoints(lua_State * L);
325 int print_symbols(lua_State * L);
326 int print_version(void);
327 int setarray(lua_State * L);
328 int usage(char *name);
329 void set_align_flag(void);
330 void set_branch_flag(void);
331 void set_trace_flag(void);
332 void singlebranch(lua_State * L);
333 void singlestep(lua_State * L);
334 void traceunaligned(lua_State * L);
335 void unset_align_flag(void);
336 void unset_branch_flag(void);
337 void unset_trace_flag(void);
338 void unsinglebranch(lua_State * L);
339 void unsinglestep(lua_State * L);
340 void untraceunaligned(lua_State * L);
341 void unverbosetrace(lua_State * L);
342 void verbosetrace(lua_State * L);
343 void xfree(lua_State * L);
344 
345 void systrace(lua_State * L);
346 void rtrace(lua_State * L);
347 void unsystrace(lua_State * L);
348 void unrtrace(lua_State * L);
349 
350 
351 int add_symbol(char *symbol, char *libname, char *htype, char *hbind, unsigned long value, unsigned int size, unsigned long int addr);
352 void segment_add(unsigned long int addr, unsigned long int size, char *perms, char *fname, char *ptype, int flags);
353 
354 int alloccharbuf(lua_State * L);
355 int bfmap(lua_State * L);
356 int breakpoint(lua_State * L);
357 int execlib(lua_State * L);
358 int getcharbuf(lua_State * L);
359 int grep(lua_State * L);
360 int grepptr(lua_State * L);
361 int help(lua_State * L);
362 int hollywood(lua_State * L);
363 int info(lua_State * L);
364 int libcall(lua_State * L);
365 int loadbin(lua_State * L);
366 int man(lua_State * L);
367 int map(lua_State * L);
368 int phdrs(lua_State * L);
369 int priv_memcpy(lua_State * L);
370 int priv_strcat(lua_State * L);
371 int priv_strcpy(lua_State * L);
372 int rdnum(lua_State * L);
373 int rdstr(lua_State * L);
374 int setcharbuf(lua_State * L);
375 int shdrs(lua_State * L);
376 int verbose(lua_State * L);
377 int xalloc(lua_State * L);
378 int ralloc(lua_State * L);
379 
380 int headers(lua_State * L);
381 int prototypes(lua_State * L);
382 int bsspolute(lua_State * L);
383 
384 unsigned int ltrace(void);
385 int procmap_lua(void);
386 void rescan(void);
387 void hexdump(uint8_t * data, size_t size, size_t colorstart, size_t color_len);
388 int disable_aslr(void);
389 int enable_aslr(void);
390 void script(char *path);
391 
392 int enable_core(lua_State * L);
393 int disable_core(lua_State * L);
394 int gencore(lua_State * L);
395 
396 char *signaltoname(int signal);
397 char *sicode_strerror(int signal, siginfo_t * s);
398 
399 /*
400 int memmap (lua_State *L);
401 int newmemmap(lua_State * L);
402 int getmemmap(lua_State * L);
403 int setmemmap(lua_State * L);
404 int memmapsize(lua_State * L);
405 */
406 
407 int rawmemread (lua_State *L);
408 int rawmemwrite (lua_State *L);
409 int rawmemstr (lua_State *L);
410 int rawmemusage (lua_State *L);
411 int rawmemaddr (lua_State *L);
412 int rawmemstrlen(lua_State *L);
413 
417 typedef struct {
418  bool et_dyn;
422  uint32_t dyn_index;
423  uintptr_t base, limit;
424  uintptr_t *p_pltgot;
425  struct r_debug *r_debug;
426  struct link_map *link_map;
427 
428 } elfdata_t;
429 
433 typedef struct range_t {
434  unsigned long long int min;
435  unsigned long long int max;
436 } range_t;
437 
438 
442 typedef struct breakpoint_t {
443  char *ptr; // Pointer to location in memory
444  char backup; // Backup bytes
445  unsigned int weight; // Weight (optional)
446 } breakpoint_t;
447 
448 
453 typedef struct preload_t {
454  char *name;
455 
456  struct preload_t *prev; // utlist.h
457  struct preload_t *next; // utlist.h
458 
459 } preload_t;
460 
464 typedef struct script_t {
465  char *name;
466 
467  struct preload_t *prev; // utlist.h
468  struct preload_t *next; // utlist.h
469 } script_t;
470 
474 typedef struct sections_t {
475  unsigned long int addr;
476  unsigned long int size;
477  char *libname;
478  char *name;
479  char *perms;
480  int flags;
481 
482  struct sections_t *prev; // utlist.h
483  struct sections_t *next; // utlist.h
484 
485 } sections_t;
486 
490 typedef struct segments_t {
491  unsigned long int addr;
492  unsigned long int size;
493  char *libname;
494  char *type;
495  char *perms;
496  int flags;
497 
498  struct segments_t *prev; // utlist.h
499  struct segments_t *next; // utlist.h
500 
501 } segments_t;
502 
506 typedef struct symbols_t {
507  unsigned long int addr;
508  unsigned long int size;
509  char *symbol;
510  char *libname;
511  char *htype;
512  char *hbind;
513  unsigned long int value;
514 
515  struct symbols_t *prev; // utlist.h
516  struct symbols_t *next; // utlist.h
517 
518 } symbols_t;
519 
520 typedef struct eps_t {
521  unsigned long int addr;
522  char *name;
523 
524  struct eps_t *prev; // utlist.h
525  struct eps_t *next; // utlist.h
526 
527 } eps_t;
528 
532 typedef struct wsh_t {
533 
534  // State
536  FILE *scriptfile;
537  char *scriptname;
538 
539  char *learnlog;
540  FILE *learnfile;
541 
542  unsigned int opt_verbose;
543  unsigned int opt_hollywood; // Default = 1;
544  unsigned int mainhandle;
545  unsigned int opt_rescan;
546 
547  unsigned int opt_verbosetrace; // Display verbose trace
548 
549  unsigned int firsterrno;
550  unsigned int firstsicode;
551  unsigned int firstsignal;
552  unsigned int totsignals; // Per libcall
553  unsigned int globalsignals; // Never reset
554  unsigned long int faultaddr;
555 
557  unsigned int reason;
558  //unsigned int lastret;
559  unsigned int is_stdinscript;
560  unsigned int bp_points;
561 
562  void *pltgot;
563  unsigned int pltsz;
564 
565  ucontext_t *errcontext;
566 // ucontext_t *initcontext;
567 
568  unsigned long int btcaller;
569 
571  unsigned int bp_num;
572 
573  unsigned int opt_argc;
574  char *opt_argv;
575 
576  char **script_args;
577  unsigned int script_argnum;
578 
579  unsigned int trace_unaligned;
580  unsigned int trace_singlestep;
581  unsigned int trace_singlebranch;
582 
583  unsigned int trace_rtrace;
584  unsigned int trace_strace;
585 
586  unsigned int singlestep_count;
587  unsigned int singlebranch_count;
588  unsigned int sigbus_count;
589 
590  unsigned long long int singlestep_hash;
591  unsigned long long int singlebranch_hash;
592  unsigned long long int sigbus_hash;
593 
595  jmp_buf longjmp_ptr;
596 
597  unsigned int interrupted;
598  unsigned int longjmp_ptr_high_cnt;
599 
600  struct sections_t *shdrs;
601  struct segments_t *phdrs;
603  struct eps_t *eps;
604 
605  struct preload_t *preload; // Libraries/binaries to preload
606  struct script_t *scripts; // Queue of scripts to execute
607 
608 } wsh_t;
609 
610 typedef struct tuple_t{
611  void *addr;
612  char *name;
613 } tuple_t;
614 
615 
616 int wsh_init(void);
617 int wsh_getopt(wsh_t * wsh1, int argc, char **argv);
618 int wsh_loadlibs(void);
619 int reload_elfs(void);
620 int wsh_run(void);
621 
622 /*
623 int newarray(lua_State * L);
624 int setarray(lua_State * L);
625 int getarray(lua_State * L);
626 int getsize(lua_State * L);
627 */
628 
unsigned int trace_singlebranch
Definition: wsh.h:581
unsigned int weight
Definition: wsh.h:445
int print_libs(lua_State *L)
Definition: wsh.c:1308
unsigned int firstsicode
Definition: wsh.h:550
struct script_t * scripts
Definition: wsh.h:606
unsigned int opt_verbose
Definition: wsh.h:542
int rawmemstr(lua_State *L)
Definition: wsh.c:4797
unsigned int trace_strace
Definition: wsh.h:584
void verbosetrace(lua_State *L)
Definition: wsh.c:3937
int gencore(lua_State *L)
Definition: wsh.c:4340
unsigned int globalsignals
Definition: wsh.h:553
int do_loadlib(char *libname)
Definition: wsh.c:4581
unsigned long long int singlebranch_hash
Definition: wsh.h:591
Elf_Ehdr * ehdr
Definition: wsh.h:420
Elf_Dyn * dyns
Definition: wsh.h:419
int shdrs(lua_State *L)
Definition: wsh.c:1459
void set_trace_flag(void)
Definition: wsh.c:2931
void traceunaligned(lua_State *L)
Definition: wsh.c:3891
Definition: wsh.h:464
int empty_shdrs(void)
Definition: wsh.c:1018
int ralloc(lua_State *L)
Definition: wsh.c:3755
unsigned long int addr
Definition: wsh.h:491
struct symbols_t * symbols
Definition: wsh.h:602
Elf_Phdr * phdrs
Definition: wsh.h:421
int breakpoint(lua_State *L)
Definition: wsh.c:4218
int headers(lua_State *L)
Definition: wsh.c:931
unsigned int longjmp_ptr_high_cnt
Definition: wsh.h:598
unsigned long int addr
Definition: wsh.h:475
int rawmemaddr(lua_State *L)
Definition: wsh.c:4833
int newarray(lua_State *L)
unsigned long int value
Definition: wsh.h:513
int add_symbol(char *symbol, char *libname, char *htype, char *hbind, unsigned long value, unsigned int size, unsigned long int addr)
Definition: wsh.c:719
void * addr
Definition: wsh.h:611
struct sections_t * shdrs
Definition: wsh.h:600
int print_version(void)
Definition: wcc.c:3821
char * learnlog
Definition: wsh.h:539
struct preload_t * prev
Definition: wsh.h:456
struct eps_t * next
Definition: wsh.h:525
char * perms
Definition: wsh.h:495
jmp_buf longjmp_ptr
Definition: wsh.h:595
struct preload_t * prev
Definition: wsh.h:467
int flags
Definition: wsh.h:496
int map(lua_State *L)
Definition: wsh.c:3658
unsigned int trace_rtrace
Definition: wsh.h:583
int libcall(lua_State *L)
Definition: wsh.c:2087
struct segments_t * prev
Definition: wsh.h:498
void systrace(lua_State *L)
Definition: wsh.c:3916
Definition: wsh.h:417
int print_functions(lua_State *L)
Definition: wsh.c:1176
struct eps_t * eps
Definition: wsh.h:603
char * __progname_full
int getcharbuf(lua_State *L)
Definition: wsh.c:1657
unsigned int ltrace(void)
Definition: wsh.c:328
struct symbols_t symbols_t
char * ptr
Definition: wsh.h:443
char backup
Definition: wsh.h:444
unsigned int opt_rescan
Definition: wsh.h:545
struct range_t range_t
int usage(char *name)
Definition: wcc.c:3795
void unset_branch_flag(void)
Definition: wsh.c:3022
void singlestep(lua_State *L)
Definition: wsh.c:3903
uintptr_t * p_pltgot
Definition: wsh.h:424
struct r_debug * r_debug
Definition: wsh.h:425
void set_align_flag(void)
Definition: wsh.c:2904
unsigned long int size
Definition: wsh.h:508
void script(char *path)
Definition: wsh.c:166
void segment_add(unsigned long int addr, unsigned long int size, char *perms, char *fname, char *ptype, int flags)
Definition: wsh.c:769
FILE * learnfile
Definition: wsh.h:540
struct eps_t eps_t
int print_phdrs(void)
Definition: wsh.c:1052
jmp_buf longjmp_ptr_high
Definition: wsh.h:594
char * signaltoname(int signal)
Definition: wsh.c:2878
struct script_t script_t
int wsh_init(void)
Definition: wsh.c:4364
void unsystrace(lua_State *L)
Definition: wsh.c:3926
int bfmap(lua_State *L)
Definition: wsh.c:100
int man(lua_State *L)
Definition: wsh.c:1478
char * opt_argv
Definition: wsh.h:574
unsigned int trace_singlestep
Definition: wsh.h:580
Definition: wsh.h:453
unsigned int reason
Definition: wsh.h:557
int info(lua_State *L)
Definition: wsh.c:1495
char * name
Definition: wsh.h:478
int setcharbuf(lua_State *L)
Definition: wsh.c:1603
void hexdump(uint8_t *data, size_t size, size_t colorstart, size_t color_len)
Definition: wsh.c:184
struct lua_State lua_State
Definition: lua.h:56
ucontext_t * errcontext
Definition: wsh.h:565
struct preload_t * next
Definition: wsh.h:468
lua_State * L
Definition: wsh.h:535
int phdrs(lua_State *L)
Definition: wsh.c:859
struct symbols_t * next
Definition: wsh.h:516
Definition: wsh.h:532
int disable_core(lua_State *L)
Definition: wsh.c:4351
int rawmemstrlen(lua_State *L)
Definition: wsh.c:4845
void untraceunaligned(lua_State *L)
Definition: wsh.c:3897
Definition: wsh.h:433
void xfree(lua_State *L)
Definition: wsh.c:3868
int hollywood(lua_State *L)
Definition: wsh.c:3632
unsigned long long int min
Definition: wsh.h:434
int rawmemwrite(lua_State *L)
Definition: wsh.c:4778
char * sicode_strerror(int signal, siginfo_t *s)
Definition: wsh.c:3340
struct link_map * link_map
Definition: wsh.h:426
unsigned int singlestep_count
Definition: wsh.h:586
char * hbind
Definition: wsh.h:512
int enable_aslr(void)
Definition: wsh.c:473
void rescan(void)
Definition: wsh.c:2752
int grepptr(lua_State *L)
Definition: wsh.c:3979
int bsspolute(lua_State *L)
Definition: wsh.c:3712
unsigned int firstsignal
Definition: wsh.h:551
int priv_strcat(lua_State *L)
Definition: wsh.c:4197
unsigned int interrupted
Definition: wsh.h:597
unsigned int opt_hollywood
Definition: wsh.h:543
struct sections_t sections_t
int wsh_run(void)
Definition: wsh.c:4475
int grep(lua_State *L)
Definition: wsh.c:4069
struct tuple_t tuple_t
int priv_memcpy(lua_State *L)
Definition: wsh.c:4154
unsigned int pltsz
Definition: wsh.h:563
struct preload_t * next
Definition: wsh.h:457
int print_symbols(lua_State *L)
Definition: wsh.c:1108
int rdnum(lua_State *L)
Definition: wsh.c:1642
void unrtrace(lua_State *L)
Definition: wsh.c:3931
unsigned long long int sigbus_hash
Definition: wsh.h:592
unsigned int is_stdinscript
Definition: wsh.h:559
char * name
Definition: wsh.h:454
struct segments_t * phdrs
Definition: wsh.h:601
char * scriptname
Definition: wsh.h:537
struct breakpoint_t breakpoint_t
void unset_align_flag(void)
Definition: wsh.c:2890
unsigned long int addr
Definition: wsh.h:521
Definition: wsh.h:506
void set_branch_flag(void)
Definition: wsh.c:2999
unsigned long long int max
Definition: wsh.h:435
int wsh_getopt(wsh_t *wsh1, int argc, char **argv)
Definition: wsh.c:4629
Definition: wsh.h:520
unsigned long int faultaddr
Definition: wsh.h:554
char * type
Definition: wsh.h:494
struct preload_t preload_t
void unverbosetrace(lua_State *L)
Definition: wsh.c:3941
int help(lua_State *L)
Definition: wsh.c:574
unsigned long int addr
Definition: wsh.h:507
int wsh_loadlibs(void)
Definition: wsh.c:4608
int getsize(lua_State *L)
unsigned int mainhandle
Definition: wsh.h:544
char * htype
Definition: wsh.h:511
char * cplus_demangle(const char *mangled, int options)
unsigned int opt_argc
Definition: wsh.h:573
unsigned int totsignals
Definition: wsh.h:552
unsigned int trace_unaligned
Definition: wsh.h:579
int flags
Definition: wsh.h:480
int print_shdrs(void)
Definition: wsh.c:1344
int verbose(lua_State *L)
Definition: wsh.c:3618
#define Elf_Ehdr
Definition: wsh.h:134
int loadbin(lua_State *L)
Definition: wsh.c:4054
char * perms
Definition: wsh.h:479
unsigned int bp_num
Definition: wsh.h:571
struct segments_t * next
Definition: wsh.h:499
int disable_aslr(void)
Definition: wsh.c:455
struct eps_t * prev
Definition: wsh.h:524
void unsinglebranch(lua_State *L)
Definition: wsh.c:3967
int rawmemread(lua_State *L)
Definition: wsh.c:4759
int procmap_lua(void)
Definition: wsh.c:2787
unsigned int bp_points
Definition: wsh.h:560
#define Elf_Dyn
Definition: wsh.h:133
unsigned int opt_verbosetrace
Definition: wsh.h:547
int xalloc(lua_State *L)
Definition: wsh.c:3807
void * pltgot
Definition: wsh.h:562
int rawmemusage(lua_State *L)
Definition: wsh.c:4811
unsigned long int btcaller
Definition: wsh.h:568
char * name
Definition: wsh.h:612
unsigned int firsterrno
Definition: wsh.h:549
int prototypes(lua_State *L)
Definition: wsh.c:1885
int reload_elfs(void)
Definition: wsh.c:1441
char * libname
Definition: wsh.h:510
void unset_trace_flag(void)
Definition: wsh.c:2917
void rtrace(lua_State *L)
Definition: wsh.c:3921
bool et_dyn
Definition: wsh.h:418
char * name
Definition: wsh.h:522
struct sections_t * prev
Definition: wsh.h:482
int enable_core(lua_State *L)
Definition: wsh.c:4359
void singlebranch(lua_State *L)
Definition: wsh.c:3945
#define Elf_Phdr
Definition: wsh.h:135
unsigned int singlebranch_count
Definition: wsh.h:587
unsigned long int size
Definition: wsh.h:476
char * name
Definition: wsh.h:465
char ** script_args
Definition: wsh.h:576
char * libname
Definition: wsh.h:493
char * symbol
Definition: wsh.h:509
int entrypoints(lua_State *L)
Definition: wsh.c:1469
unsigned int script_argnum
Definition: wsh.h:577
void unsinglestep(lua_State *L)
Definition: wsh.c:3909
unsigned long long int singlestep_hash
Definition: wsh.h:590
int alloccharbuf(lua_State *L)
Definition: wsh.c:1590
struct sections_t * next
Definition: wsh.h:483
struct preload_t * preload
Definition: wsh.h:605
int priv_strcpy(lua_State *L)
Definition: wsh.c:4176
Definition: wsh.h:610
char * libname
Definition: wsh.h:477
struct segments_t segments_t
unsigned int sigbus_count
Definition: wsh.h:588
int setarray(lua_State *L)
int rdstr(lua_State *L)
Definition: wsh.c:1621
unsigned long int size
Definition: wsh.h:492
breakpoint_t * bp_array
Definition: wsh.h:570
void * firstcontext
Definition: wsh.h:556
uintptr_t limit
Definition: wsh.h:423
uint32_t dyn_index
Definition: wsh.h:422
struct symbols_t * prev
Definition: wsh.h:515
int execlib(lua_State *L)
Definition: wsh.c:2792
struct wsh_t wsh_t
int print_objects(lua_State *L)
Definition: wsh.c:1255
FILE * scriptfile
Definition: wsh.h:536
int empty_phdrs(void)
Definition: wsh.c:999