Discussion on 10/28

Download Report

Transcript Discussion on 10/28

GDB &
Transport Protocols
CS176A
Ramya Raghavendra
What is Gdb?
• GDB is the GNU Project debugger
• Gdb provides some helpful functionality
– Allows you to stop your program at any given point.
– You can examine the state of your program when it’s stopped.
– Change things in your program, so you can experiment with
correcting the effects of a bug.
• Also a command-line program
• Is also available on spinlock/coredump
Using Gdb:
• To start gdb with your hello program type:
gdb HelloProg
• When gdb starts, your program is not actually running.
• You have to use the run command to start execution.
• Before you do that, you should place some break points.
• Once you hit a break point, you can examine any
variable.
Useful gdb commands
• run command-line-arguments
– Begin execution of your program with arguments
• break place
– place can be the name of a function or a line number
– For example: break main will stop execution at the first
instruction of your program
• delete N
– Removes breakpoints, where N is the number of the breakpoint
• step
– Executes current instruction and stops on the next one
Gdb commands cont.
• next
– Same as step except this doesn’t step into functions
• print E
– Prints the value of any variable in your program when you are at
a breakpoint, where E is the name of the variable you want to
print
• help command
– Gives you more information about any command or all if you
leave out command
• quit
– Exit gdb
GDB Basics
• How to setup the environment to dump core files:
– csil% ulimit –c unlimited
• How to open a core file
– csil% gdb –q ./executable corename (the parameter –q is optional. The
will prevent GDB from printing out extra garbage when it initially loads)
• What to do when a core file is loaded up
– (gdb) bt (backtrace)
• Will show you the stack when the program crashed
• More useful to run your program with GDB.
– csil% gdb –q ./executable
• Set breakpoints: (gdb) b <line number> OR b <function name>
• Run the program: (gdb) r <commandline params>
– The program will break when it reaches a breakpoint
– Print value of a variable: (gdb) print <variable name>
– Step through a function: (gdb) s
– Skip to the next instruction: (gdb) n
– Continue until the program exits or another breakpoint is reached:
(gdb) c
Transport Protocols
• NAK only
– x-1, x+1 => x was missed
– NAK is sent for x
• GBN (Go Back N)
– Sender is allowed to transmit multiple packets
– No more than N unACKed packets in pipeline
GBN(Cont)
• [0,base-1] – already transmitted and ACKd
• [base,nextseqnum-1] - sent, not ACKd
• [nextseqnum,base+N-1] – can be sent
next
• >base+N+1 – cant be used
• Problem 2: receiver has received k-1
– Sender got ACKS for all
– Sender did not get any ACK
Sample RTT
• SampleRTT – time between the segment
is sent and ACK is received
• Estimated for every transmitted and
unACKed segment
• NOT for retrasmitted packets. WHY?
– P1 – no ACK
– P2 - ACK
Fast Retrasmit
• Timeout triggered retransmissions : delay
• Duplicate ACK
– Packet already has been ACKed
– n,n+1,n+2 : sent
Sent
Recv
ACK
n
n
n
n+1
--n+2
n+2
n
O=100KB, S=536B, RTT=100ms
A) Minimum latency = 2RTT+O/R
B) W = min{w: w >= (RTT+S/R)
-------------------------
S/R