Browse Source

Adds an example of loop

Yann Weber 1 year ago
parent
commit
647afe71e7
2 changed files with 19 additions and 1 deletions
  1. 18
    0
      asmsh.h
  2. 1
    1
      shell_cmds.c

+ 18
- 0
asmsh.h View File

109
 asmsh@0x7f6e312e5022 > 
109
 asmsh@0x7f6e312e5022 > 
110
 </pre>
110
 </pre>
111
 
111
 
112
+@subsection example_loop Make a loop and use commands
113
+
114
+<pre>
115
+asmsh@0x7f3020bec000 > .regs \%rbx
116
+rbx: 0000000000000000
117
+asmsh@0x7f3020bec000 > mov $6, \%rcx
118
+asmsh@0x7f3020bec005 > add $0xb, \%rbx
119
+asmsh@0x7f3020bec009 > loop . -4
120
+asmsh@0x7f3020bec005 > .bytecode loop . -4
121
+loop . -4 = ( 2 Bytes) e2fa.... ........  ........ ......
122
+asmsh@0x7f3020bec005 > .breakpoint . + 6
123
+INFO: Set breakpoint @ 00007F3020BEC00B
124
+asmsh@0x7f3020bec005 > .run
125
+INFO: Breakpoint 00007f3020bec00b reached
126
+asmsh@0x7f3020bec00b > .regs \%rbx
127
+rbx: 0000000000000042
128
+</pre>
129
+
112
 @section TODO TODOLIST
130
 @section TODO TODOLIST
113
 
131
 
114
 @todo Implement command for memory read/dump
132
 @todo Implement command for memory read/dump

+ 1
- 1
shell_cmds.c View File

183
 		instr = code;
183
 		instr = code;
184
 	}
184
 	}
185
 
185
 
186
-	ret = snprintf(buf, bufsz, "%s = (%02db) ",
186
+	ret = snprintf(buf, bufsz, "%s = (%2d Bytes) ",
187
 			instr, bcode.size);
187
 			instr, bcode.size);
188
 	for(int i=0; i<sizeof(bcode.bytes); i++)
188
 	for(int i=0; i<sizeof(bcode.bytes); i++)
189
 	{
189
 	{

Loading…
Cancel
Save