Question: This is gdb debugging. There is an input.txt file. And follow the code make input.txt file. x 5 0 0 = viswa 1 0 6

This is gdb debugging. There is an input.txt file.
And follow the code make input.txt file.
x500= viswa106, Need help with all the phases.
/** puzzlebox.c: Inputs are read from a file on the command line. The * inputs are modified in various ways to check against specific * patterns associated with "phases". Each set of correct inputs * "passes" a phase and scores points. ** USING THE DEBUGGER is almost essential to understand what is * happening in the source code. Compile with debug flags and run in * the gdb debugger as in **> gcc -g -o puzzlebox puzzlebox.c *> gdb -tui ./puzzlebox ** Original DebugMe.java version and rhymes by Mark Snyder * C Port/Adaptation by Chris Kauffman */// DO NOT MODIFY THIS FILE #include #include #include #include #include #define BUFSIZE 128 #define NSTAGES 10 int points[NSTAGES+1]={0,8,8,8,8,5,5,4,4,5,5,}; int score =0; int max_score =60; char *userID = NULL; int hash =0; void setup(); void end_now(); void phase01(); void phase02(); void phase03(); void phase04(); void phase05(); void phase06(); void phase07(); void phase08(); void phase09(); void phase10(); int main(int argc, char *argv[]){ printf("========================================
"); if (sizeof(int)!=4|| sizeof(long)!=8){ printf("Unexpected byte sizes of int or long
"); printf("%5s %5s
", "EXPECT","ACTUAL"); printf(" int: %5d %5lu
",4, sizeof(int)); printf("long: %5d %5lu
",8, sizeof(long)); printf("
"); printf("puzzlebox must be run on a 64-bit architecture. Bailing out
"); return 1; } if (argc <2){ printf("usage: %s
",argv[0]); printf(" Provide a text file to read from on the command line
"); printf(" The first token in the input file is your Internet ID like kolb0128
"); printf(" Bailing out.
"); return 1; } setup(argv[1]); printf("PHASE 1: A puzzle you say? Challenge accepted!
"); phase01(); score += points[1]; printf("PHASE 2: That was cake by the ocean! Wait: the cake is a lie!
"); phase02(); score+=points[2]; printf("PHASE 3: Warm-up is over. This $#!^ just got real.
"); phase03(); score+=points[3]; printf("PHASE 4: Tired yet? Nope? There's more in phase four.
"); phase04(); score+=points[4]; printf("PHASE 5: You're doing well. But can you break through this secret technique of darkness?
"); phase05(); score+=points[5]; printf("PHASE 6: Watch out, here comes a wall of bricks! It's time for you to solve phase six.
"); phase06(); score+=points[6]; printf("PHASE 7: Next it's phase eleven! oops, seven. (off-by-4 errors don't lose credit, right?)
"); phase07(); score+=points[7]; printf("PHASE 8: You're doing great, now try phase 1000!
"); phase08(); score+=points[8]; printf("PHASE 9: Finally, the finish line; Can you solve phase nine?
"); phase09(); score+=points[9]; printf("PHASE 10: Rule #1: The doctor lies. Next time a message mentions 'finish line,' check the source code.
"); phase10(); score+=points[10]; printf("***Achievement Unlocked***
"); printf("gdb? Yeah you know me!
"); end_now(); return 0; } void setup_signal_handlers(); void failure(char *msg); void end_now(); void setup_input(char *fname); void close_input(); char *next_input(); void setup(char *infile_name){ setup_signal_handlers(); setup_input(infile_name); userID = next_input(); int len = strlen(userID); if (len !=8){ printf("'%s' is a userID and must be 8 characters
", userID); exit(1); } hash =0; int *hash1=(int *)(userID); int *hash2=(int *)(userID +4); hash =(*hash1)^(*hash2); if (hash <0){ hash =-hash; } printf("UserID '%s' accepted: hash value =%d
", userID, hash); } #define NSIGNALS 35 char *signal_names[NSIGNALS]={"", "SIGHUP", ///1 Hangup "SIGINT", ///2 Interrupt "SIGQUIT", ///3 Quit "SIGILL", ///4 Illegal Instruction "SIGTRAP", ///5 Trace/Breakpoint Trap "SIGABRT", ///6 Abort "SIGEMT", ///7 Emulation Trap "SIGFPE (usually divide by 0)",///8 Arithmetic Exception "SIGKILL", ///9 Killed "SIGBUS", ///10 Bus Error "SIGSEGV (out of bounds memory)",///11 Segmentation Fault "SIGSYS", ///12 Bad System Call "SIGPIPE", ///13 Broken Pipe "SIGALRM",

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!