gitlab.com/Raven-IO/raven-delve@v1.22.4/_fixtures/testvariablescgo/test.c (about) 1 #include <stdlib.h> 2 #include <string.h> 3 #include <stdio.h> 4 5 #ifdef __amd64__ 6 #define BREAKPOINT asm("int3;") 7 #elif __i386__ 8 #define BREAKPOINT asm("int3;") 9 #elif __aarch64__ 10 #ifdef WIN32 11 #define BREAKPOINT asm("brk 0xF000;") 12 #else 13 #define BREAKPOINT asm("brk 0;") 14 #endif 15 #endif 16 17 #define N 100 18 19 struct align_check { 20 int a; 21 char b; 22 }; 23 24 void testfn(void) { 25 const char *s0 = "a string"; 26 const char *longstring = "averylongstring0123456789a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789g0123456789h0123456789"; 27 int *v = malloc(sizeof(int) * N); 28 struct align_check *v_align_check = malloc(sizeof(struct align_check) * N); 29 30 for (int i = 0; i < N; i++) { 31 v[i] = i; 32 v_align_check[i].a = i; 33 v_align_check[i].b = i; 34 } 35 36 char *s = malloc(strlen(s0) + 1); 37 strcpy(s, s0); 38 39 BREAKPOINT; 40 41 printf("%s %s %p %p\n", s, longstring, v, v_align_check); 42 }