Skip to content

Commit d5f1728

Browse files
committed
Simplify patch_test
1 parent 9d4223b commit d5f1728

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
#include <stdio.h>
21
#include <string.h>
32

43
#include "patch_test.so.h"
54

65
int main(int argc, const char **argv)
76
{
8-
int ret;
9-
const char *p;
7+
const char* p = patch_test_value;
108

11-
p = patch_test_value;
12-
13-
ret = strcmp(p, "qiling");
14-
if (ret) {
15-
/* crash */
16-
memcpy(NULL, p, 4);
9+
if (strcmp(p, "qiling"))
10+
{
11+
/* crash with an illegal instruction */
12+
__builtin_trap();
1713
}
1814

1915
return 0;
2016
}
17+
18+
// run:
19+
// LD_LIBRARY_PATH=. ./patch_test.bin

0 commit comments

Comments
 (0)