|
|
1.1 ! root 1: /* ! 2: * setbp.c - set/clear kernel breakpoints ! 3: * ! 4: * Usage: setbp bp# [addr type len] ! 5: */ ! 6: #include <stdio.h> ! 7: #include <sys/param.h> ! 8: ! 9: char * cmd; ! 10: ! 11: main(argc, argv) ! 12: int argc; ! 13: char ** argv; ! 14: { ! 15: int a2, a3, a4, a5, res; ! 16: ! 17: cmd = argv[0]; ! 18: if (argc != 2 && argc != 5) ! 19: usage(); ! 20: if (sscanf(argv[1], "%d", &a2) != 1) ! 21: usage(); ! 22: ! 23: if (argc == 2) { /* argc == 2: set breakpoint */ ! 24: res = cohcall(COH_CLRBP, a2); ! 25: if (res == -1) ! 26: perror("clrbp"); ! 27: } else { /* argc == 5: clear breakpoint */ ! 28: if (sscanf(argv[2], "%x", &a3) != 1) ! 29: usage(); ! 30: if (sscanf(argv[3], "%d", &a4) != 1) ! 31: usage(); ! 32: if (sscanf(argv[4], "%x", &a5) != 1) ! 33: usage(); ! 34: res = cohcall(COH_SETBP, a2, a3, a4, a5); ! 35: if (res == -1) ! 36: perror("setbp"); ! 37: } ! 38: } ! 39: ! 40: usage() ! 41: { ! 42: fprintf(stderr, "Usage: %s bp# [hex-addr type len]\n", cmd); ! 43: exit(1); ! 44: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.