Yann Weber пре 1 година
родитељ
комит
77beccae4f
3 измењених фајлова са 22 додато и 3 уклоњено
  1. 0
    1
      asmsh.h
  2. 14
    0
      shell_cmds.c
  3. 8
    2
      shell_cmds.h

+ 0
- 1
asmsh.h Прегледај датотеку

@@ -108,7 +108,6 @@ asmsh@0x7f6e312e5022 >
108 108
 
109 109
 @section TODO TODOLIST
110 110
 
111
-@todo Implement a .step instruction allowing to step without compiling any instruction
112 111
 @todo Implement breakpoints
113 112
 @todo Implement symbols for jumps
114 113
 @todo Implement write without exec

+ 14
- 0
shell_cmds.c Прегледај датотеку

@@ -280,6 +280,20 @@ flags: %c%c%c%c|%c%c%c\n\
280 280
 	return 0;
281 281
 }
282 282
 
283
+
284
+int asmsh_cmd_step(asmsh_t *sh, asmsh_cmd_args_t *args)
285
+{
286
+	int ret, status;
287
+	ret = asmsh_env_step(sh->env, &status);
288
+
289
+	if(ret > 1)
290
+	{
291
+		return status;
292
+	}
293
+	return ret;
294
+}
295
+
296
+
283 297
 int asmsh_cmd_syscalls(asmsh_t *sh, asmsh_cmd_args_t *args)
284 298
 {
285 299
 	const int sz = sizeof(syscall_infos)/sizeof(*syscall_infos);

+ 8
- 2
shell_cmds.h Прегледај датотеку

@@ -31,6 +31,7 @@
31 31
 typedef struct asmsh_cmd_s asmsh_cmd_t;
32 32
 typedef struct asmsh_cmd_args_s asmsh_cmd_args_t;
33 33
 #include "shell.h"
34
+#include "asm_env.h"
34 35
 
35 36
 /** @return <0 on recoverable error 0 on ok, 1+status on exit */
36 37
 typedef int (asmsh_cmd_f)(asmsh_t*, asmsh_cmd_args_t*);
@@ -98,6 +99,8 @@ int asmsh_cmd_maps(asmsh_t *sh, asmsh_cmd_args_t *args);
98 99
 
99 100
 int asmsh_cmd_print_regs(asmsh_t *sh, asmsh_cmd_args_t *args);
100 101
 
102
+int asmsh_cmd_step(asmsh_t *sh, asmsh_cmd_args_t *args);
103
+
101 104
 int asmsh_cmd_syscalls(asmsh_t *sh, asmsh_cmd_args_t *args);
102 105
 
103 106
 // Reset the shell (restart the child etc)a
@@ -131,8 +134,11 @@ static const asmsh_cmd_t asmsh_CMDS[] = {
131 134
 	{".regs", asmsh_cmd_print_regs, 1,
132 135
 	".(regs)", "",
133 136
 	"display registers value"},
134
-	{".syscalls", asmsh_cmd_syscalls, 2,
135
-	 ".s(yscalls)", "",
137
+	{".step", asmsh_cmd_step, 2,
138
+	 ".s(tep)", "",
139
+	 "Run the instruction pointed by RIP"},
140
+	{".syscalls", asmsh_cmd_syscalls, 4,
141
+	 ".sys(calls)", "",
136 142
 	 "print syscalls name & numbers"},
137 143
 	{".reset", asmsh_cmd_reset, 0,
138 144
 	 ".reset", "",

Loading…
Откажи
Сачувај