Given the code shell below, do the following:
a) Write a code that will calculate the sum of the two 64-bit integers sum = num1 + num2 and their difference diff = num2 - num1. Note that the variables num1, num2, sum and diff are represented in the code by address spaces pointed at by labels of the same names. Copy-paste the well-commented source code here (use Courier New font and indentations as in the above segment.)
Note: Break the addition/subtraction into 32-bit operations and make sure that the carry/borrow from the lower words correctly propagate to the upper words. Both the 64-bit addition and subtraction are required to update the resulting C flag in CPSR. Since the addition will be immediately followed by subtraction, the C flag from addition will not be preserved (nevertheless, it is required to be calculated).
b) Assemble the code for the gdb debugger (detail the corresponding shell commands here).
c) In gdb, place a breakpoint at the label _exit. Run the code from _start to the breakpoint. Write a gdb command to display the contents of the registers R0-R15 and CPSR. Include the command here, as well as the screenshot of the register dump. Explain the contents of the registers relevant to your code.
d) Find the addresses pointed at by the labels num1, num2, sum, diff using the gdb command info line <label_name>. Provide a screenshot with the label names and the corresponding addresses here.
e) Write gdb commands to individually display the contents of the variables num1, num2, sum, diff (the actual variable contents, not addresses of the corresponding labels). For each variable, use formatting characters to display its contents as one 'giga' word (64 bits) in hex. Include the commands here, as well as the screenshot of the four memory dumps.
f) Write a gdb command to display all breakpoints currently set in your code. Include a screenshot of this action, including the breakpoint listing.
g) Write a gdb command to remove all breakpoints. Include a screenshot of this action.