CIS 345/545: Understand What is Really Inside of a Running Program - IT Assignment Help

Download Solution Order New Solution
Assignment Task:

Task:

This warm-up homework helps you understand what is really inside of a running program and what the operating system needs to deal with. Login to one of the workstations in our Linux lab. Type tar xvfz ~cis345s/pub/hw1.tar.gz
to uncompress and extract the files (i.e. lbcount.c, map.c ) to your working directory. Next, use the following commands to compile and build the needed executable files:
gcc lbcount.c -g -o lbcount
gcc map.c -g -o map
Load up your lbcount executable in gdb, set a breakpoint at the second if statement, and start running your program with the single input file lbcount.c. When the execution stops at the breakpoint, type continue three times. Take a screenshot of the terminal window and put it in your report file hw1 report.pdf. Think about the following questions and put your answers in your report.
1. What is the value of argv? (hint: print argv)
2. What is pointed to by argv? ? (hint: print argv[0])
3. What is the value of byteCount? lineCount?
4. What is the address of the function main?
5. Try info stack. Explain what you see.
6. Try info frame. Explain what you see.
Next, type objdump -x -d lbcount to look the executable file lbcount. You will see that your program has several segments, names of functions and variables in your program correspond to labels with addresses or values. And the guts of everything is chunks of stuff within segments. In the objdump output thesem segments are under the section heading. There is actually a slight nuance between these two terms which you can read more about online. While you are looking through the objdump, try and think about the following questions and put the answers in the file hw1 report.pdf.
7. What file format is used for this binary? And what architecture is it compiled for?
8. What segment/section contains main (the function) and what is the address of main? (The last few hex digits should be the same as what you saw in gdb)
9. Do you see the stack segment anywhere? What about the heap? Explain. Now, you are ready to run the executable map. Think about the following questions and put the answers in hw1 report.pdf.
10. Use objdump with the -D flag on the map executable. Which of the addresses from the output of running ./map are defined in the executable, and which segment/section is each defined in?
11. Where is the heap? What direction is it growing in?

 

This CIS 345/545:  IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.