Lab Manual: https://pdos.csail.mit.edu/6.824/labs/lab-mr.html
Github:
Used JetBrains GoLand as IDE and setting up labs with debugging capability’s been a mess
Used Delve which is better debugger than GDB for Golang
Since it’s not module but individual files, to be ran, I opted for remote debugging individually
These are the modified commands and arguments are sent after --
at the end
dlv debug --headless --listen=:2345 --api-version=2 --accept-multiclient mrcoordinator.go -- pg-*.txt
dlv debug --headless --listen=:2346 --api-version=2 --accept-multiclient mrworker.go -- wc.so
go build -gcflags='all=-N -l' -buildmode=plugin ../mrapps/wc.go
-gcflags
for delve compatibilitysend -race
arg with all commands including plugin, to test for race conditions
There’s also Debugging by Pretty Printing mentioned in manual
Using below DPrintf
snippet instead of log.Printf
can be useful
const Debug = true // or false
func DPrintf(format string, a ...interface{}) (n int, err error) {
if Debug {
log.Printf(format, a...)
}
return
}