delve/_fixtures/cgostacktest/hello.c
chainhelen f3a191cd73
pkg/proc,service: support linux/386 (#1884)
Implement debugging function for 386 on linux with reference to AMD64.
There are a few remaining problems that need to be solved in another time.

1. The stacktrace of cgo are not exactly as expected.
2. Not implement `core` for now.
3. Not implement `call` for now. Can't not find `runtime·debugCallV1` or
   similar function in $GOROOT/src/runtime/asm_386.s.

Update #20
2020-03-10 09:34:40 -07:00

30 lines
431 B
C

#include <stdio.h>
#include "_cgo_export.h"
#ifdef __amd64__
#define BREAKPOINT asm("int3;")
#elif __i386__
#define BREAKPOINT asm("int3;")
#elif __aarch64__
#define BREAKPOINT asm("brk 0;")
#endif
void helloworld_pt2(int x) {
BREAKPOINT;
helloWorld(x+1);
}
void helloworld(int x) {
helloworld_pt2(x+1);
}
void helloworld_pt4(int x) {
BREAKPOINT;
helloWorld2(x+1);
}
void helloworld_pt3(int x) {
helloworld_pt4(x+1);
}