Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hypervisor/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type VmContext struct {

logPrefix string

GDBTCPPort int

lock sync.RWMutex //protect update of context
idLock sync.Mutex
pauseLock sync.Mutex
Expand Down Expand Up @@ -140,6 +142,7 @@ func InitContext(id string, hub chan VmEvent, client chan *types.VmResponse, dc
logPrefix: fmt.Sprintf("SB[%s] ", id),
sockConnected: make(chan bool),
cancelWatchHyperstart: make(chan struct{}),
GDBTCPPort: boot.GDBTCPPort,
}
ctx.networks.sandbox = ctx

Expand Down
1 change: 1 addition & 0 deletions hypervisor/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type BootConfig struct {
Initrd string
Bios string
Cbfs string
GDBTCPPort int

// For network QoS (kilobytes/s)
InboundAverage string
Expand Down
4 changes: 3 additions & 1 deletion hypervisor/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ func (ctx *VmContext) Launch() {
ctx.hyperstart, err = libhyperstart.NewHyperstart(ctx.Id, ctx.ctlSockAddr(), ctx.ttySockAddr(), 1, false, true)
} else {
ctx.hyperstart, err = libhyperstart.NewHyperstart(ctx.Id, ctx.ctlSockAddr(), ctx.ttySockAddr(), 1, true, false)
go ctx.watchHyperstart()
if ctx.GDBTCPPort == 0 {
go ctx.watchHyperstart()
}
}
if err != nil {
ctx.Log(ERROR, "failed to create hypervisor")
Expand Down
4 changes: 4 additions & 0 deletions hypervisor/qemu/qemu_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func launchQemu(qc *QemuContext, ctx *hypervisor.VmContext) {

args := qc.arguments(ctx)
args = append(args, "-daemonize", "-pidfile", qc.qemuPidFile, "-D", qc.qemuLogFile.Name)
if ctx.GDBTCPPort != 0 {
args = append(args, "-gdb", fmt.Sprintf("tcp::%d", ctx.GDBTCPPort))
glog.Infof("qemu GDB TCP port is %d", ctx.GDBTCPPort)
}
if ctx.Boot.EnableVsock && qc.driver.hasVsock && ctx.GuestCid > 0 {
addr := ctx.NextPciAddr()
vsockDev := fmt.Sprintf("vhost-vsock-pci,id=vsock0,bus=pci.0,addr=%x,guest-cid=%d", addr, ctx.GuestCid)
Expand Down