diff options
| author | JRPan <[email protected]> | 2023-06-13 20:40:17 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-13 20:40:17 +0800 |
| commit | 4f1cdbe1ff00ab003cc9d33f1a6943eeb6b203a3 (patch) | |
| tree | 5ee800a6507b85bfbefae1c242f9d285731aa4a3 /src/debug.cc | |
| parent | 25cdd73b170b0c560d1e6bf5f5418b0a9be2325b (diff) | |
| parent | b471b3481b2399222ffd9ee0f007628834e68767 (diff) | |
Merge branch 'dev' into dev
Diffstat (limited to 'src/debug.cc')
| -rw-r--r-- | src/debug.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/debug.cc b/src/debug.cc index 29506bd..e23ffd4 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -124,7 +124,7 @@ void gpgpu_sim::gpgpu_debug() { fflush(stdout); char line[1024]; - fgets(line, 1024, stdin); + char * ptr = fgets(line, 1024, stdin); char *tok = strtok(line, " \t\n"); if (!strcmp(tok, "dp")) { @@ -136,7 +136,11 @@ void gpgpu_sim::gpgpu_debug() { fflush(stdout); } else if (!strcmp(tok, "q") || !strcmp(tok, "quit")) { printf("\nreally quit GPGPU-Sim (y/n)?\n"); - fgets(line, 1024, stdin); + ptr = fgets(line, 1024, stdin); + if(ptr == NULL ){ + printf("can't read input\n"); + exit(0); + } tok = strtok(line, " \t\n"); if (!strcmp(tok, "y")) { exit(0); |
