5 struct uwx_self_info *cbinfo;
7 extern int uwx_get_frame_info(struct uwx_env *uenv);
9 extern void dump_context(uint64_t *context);
11 extern void prime_registers();
13 int main(int argc, char **argv)
18 printf("uwx_init returned %08x\n", uenv);
19 cbinfo = uwx_self_init_info(uenv);
20 status = uwx_register_callbacks(
25 printf("uwx_register_callbacks returned %d\n", status);
26 uwx_self_init_context(uenv);
27 printf("In main():\n");
28 dump_context((uint64_t *)uenv);
36 uwx_self_init_context(uenv);
37 printf("In func1():\n");
38 dump_context((uint64_t *)uenv);
44 uwx_self_init_context(uenv);
45 printf("In func2():\n");
46 dump_context((uint64_t *)uenv);
52 uwx_self_init_context(uenv);
53 printf("In func3():\n");
54 dump_context((uint64_t *)uenv);
67 uwx_self_init_context(uenv);
68 uwx_init_history(uenv);
69 printf("In func4():\n");
70 dump_context((uint64_t *)uenv);
72 status = uwx_step(uenv);
73 if (status != UWX_OK) {
74 printf("uwx_step returned %d\n", status);
77 status = uwx_get_reg(uenv, UWX_REG_PFS, &val);
78 if (status != UWX_OK) {
79 printf("uwx_get_reg returned %d\n", status);
82 printf("After step:\n");
83 dump_context((uint64_t *)uenv);
84 status = uwx_get_spill_loc(uenv, UWX_REG_IP, &disp);
85 if (status == UWX_OK) {
86 p = (uint64_t *)(disp & ~0x7LL);
87 if ((disp & 0x7) == UWX_DISP_RSTK(0))
88 printf("IP spilled to backing store %08x = %08x\n",
90 else if ((disp & 0x7) == UWX_DISP_MSTK(0))
91 printf("IP spilled to mem stack %08x = %08x\n",
93 else if ((disp & 0x7) == UWX_DISP_REG(0))
94 printf("IP found in register %08x\n", (int)disp >> 4);
96 printf("IP history not available\n");