Question
Below is an annotated session with the Gnu debugger running an executable called problem1. As you can see, the executable contains a function called p1.
Below is an annotated session with the Gnu debugger running an executable called problem1. As you can see, the executable contains a function called p1.
linux> gdb problem1
(gdb) break *p1
Breakpoint 1 at 0x400660
(gdb) run
Breakpoint 1, 0x00400660 in p1 ()
(gdb) disas
=> 0x00400660 <+0>: movslq 0x1c(%rdi),%rax
0x00400664 <+4>: movslq %esi,%rsi # ignore this instruction
0x00400667 <+7>: movl $0x3c,0xc(%rdi)
0x0040066e <+14>: movl $0x5a,(%rdi,%rax,4)
0x00400675 <+21>: movl $0x50,-0x4(%rdi,%rsi,4)
0x0040067d <+29>: mov 0xc(%rdi),%eax
0x00400680 <+32>: retq
(gdb) print/x $rdi
$1 = 0x7fffffffe960
(gdb) x/8d $rdi # prints 32 bytes as 8 integers
0x7fffffffe960: 70 60 50 40
0x7fffffffe970: 30 20 10 0
(gdb) print/d $rsi
$1 = 8
A. Write a prototype for p1. Remember that a prototype only specifies the return type of a function, the number of parameters that it is passed, and the types
of these parameters.
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