#ifndef DEBUGMENU #define DEBUGMENU #include #include #include #include "stack.c" #include "stack.c" void inspect(struct stack s, int fp){ //todo Does not work dont know why char input[20]; char ref[20]; char refStr[20]; printf("DEBUG [inspect]: stack, datam object?"); fgets(input,20,stdin); if (input[0] == 's') printStack(s, fp); if (input[0] == 'd'){/* todo */ } if (input[0] == 'o'){ scanf("%19s",ref); ObjRefContainer container; for (int i = 0; i<= container.size; i++) { sprintf(refStr, "%p", (void *)&container.refs[i]); if(strcmp(ref, refStr) == 0) printf("Adress exists\n"); else printf("Adress doeas not exist\n"); printf("%s",refStr); } } } void list(void){ //todo } void breakpoint(int *bp){ printf("BREAKPOINT: "); char input[20]; fgets(input,20,stdin); *bp = atoi(input); } void debugMenu(int fp, struct stack stack, int* debug, int point, int* bp){ char input[20]; while (true) { printf("DEBUG(%i): inspect, list, breakpoint, run, step, quit?",point); fgets(input, 20, stdin); printf("%s",input); if(input[0] == 'i') {inspect(stack,fp);} if(input[0] == 'l') list(); if(input[0] == 'b') breakpoint(bp); if(input[0] == 's') break; if(input[0] == 'r') {*debug = 0; break;}; if(input[0] == 'q') exit(0); strcpy(input, ""); } } #endif /* ifndef DEBUGMENU */