Lab 12
11/20 @ 11:59 PM
Not accepted late
Note: this is lab 12, even though we're in week 13. The difference is because of the week(s) where no lab was held.

The video is a little long, if you want to jump right to the X64 stuff, go to timecode 25:30.

Part I:

Write a GDB configuration file that adds a breakpoint at the no-arg constructor of a class MyClass. The GDB configuration file should also print a stack track when that breakpoint is encountered.

Part II:

Write a text file with answers to the following questions:

  • What is the gdb command to inspect the value of the register %rax?
  • What is the gdb command to inspect the value at (i.e. pointed to by) the register %rax?
  • What is the gdb command to set the value of the register %rax?
  • What is the gdb command to show the value of all registers?

Part III:

The following executable file was compiled from assembly code on the cycle servers: prog. It has a label called LABEL. Answer the following questions about this program, at the point LABEL:
  • How big is the activation record of the current function? Hint: Consider the values of %rbp and %rsp
  • What is the location to which the current function will return? Hint: Consider the values of the saved instruction pointer (%rip)
  • What is the value of the first local variable (it is of 8 bytes)?
  • What is the value at the 8-byte global at label GBL?Hint: use the objdump -Dwrt command to find the address of GBL