Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( Due: Jan. 3 1 ) This warm - up homework helps you understand what is really inside of a running program and what the
Due: Jan.
This warmup 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 cisspubhwtar.gz
to uncompress and extract the files ie lbcount.c map.c to your working directory. Next, use the following commands to compile and build the needed executable files:
lbcount. lbcount
map. map
Load up your Ibcount executable in gdb set a breakpoint at the second if statement, and start running your program with the single input file lbcount. 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 hw report.pdf Think about the following questions and put your answers in your report.
What is the value of argv? hint: print argv
What is pointed to by argv? hint: print argv
What is the value of bCnt ICnt?
What is the address of the function main?
Try info frame. Explain what you see.
Next, type objdump 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 these 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 hwreport.pdf
What segmentsection 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
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 hw report.pdf
What direction is the heap growing in
Is there any extra space between the two malloced memory addresses? Show your calculations i detail.
What direction is the stack growing in
How large is the stack frame for each recursive call? Show your calculations in detail.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started