blob: 39c81050c77c79f146a72f9d04bdce28a265e399 [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001#include <stdio.h>
2#include <pthread.h>
3
4#include "mbtk_log.h"
5#include "mbtk_utils.h"
6
7
8void test3()
9{
10 printf("%s start\n", __FUNCTION__);
11 char *ptr = (char*)10;
12 *ptr = 'a';
13 printf("%s end\n", __FUNCTION__);
14}
15
16void test2()
17{
18 printf("%s start\n", __FUNCTION__);
19 mbtk_get_kernel_cmdline(NULL, 1024);
20 // test3();
21 printf("%s end\n", __FUNCTION__);
22}
23
24void test1()
25{
26 printf("%s start\n", __FUNCTION__);
27 test2();
28 printf("%s end\n", __FUNCTION__);
29}
30
31void* thread_function(void* arg) {
32 // 模拟一个导致SIGSEGV的操作
33 int* invalid_pointer = NULL;
34 *invalid_pointer = 0; // 尝试写入一个无效的指针,将触发SIGSEGV
35 return NULL;
36}
37
38int main(int argc, char *argv[])
39{
40
41#ifdef MBTK_DUMP_SUPPORT
42 mbtk_debug_open(NULL, TRUE);
43#endif
44
45 test1();
46
47 pthread_t thread;
48 pthread_create(&thread, NULL, &thread_function, NULL);
49 pthread_join(thread, NULL);
50
51 printf("Exit.\n");
52
53 return 0;
54}
55