當前位置: 首頁>>代碼示例>>Golang>>正文


Golang api.ConvertThread函數代碼示例

本文整理匯總了Golang中github.com/derekparker/delve/service/api.ConvertThread函數的典型用法代碼示例。如果您正苦於以下問題:Golang ConvertThread函數的具體用法?Golang ConvertThread怎麽用?Golang ConvertThread使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ConvertThread函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Threads

func (d *Debugger) Threads() []*api.Thread {
	threads := []*api.Thread{}
	for _, th := range d.process.Threads {
		threads = append(threads, api.ConvertThread(th))
	}
	return threads
}
開發者ID:alaska,項目名稱:delve,代碼行數:7,代碼來源:debugger.go

示例2: State

// State returns the current state of the debugger.
func (d *Debugger) State() (*api.DebuggerState, error) {
	if d.process.Exited() {
		return nil, proc.ProcessExitedError{Pid: d.ProcessPid()}
	}

	var (
		state     *api.DebuggerState
		goroutine *api.Goroutine
	)

	if d.process.SelectedGoroutine != nil {
		goroutine = api.ConvertGoroutine(d.process.SelectedGoroutine)
	}

	state = &api.DebuggerState{
		SelectedGoroutine: goroutine,
		Exited:            d.process.Exited(),
	}

	for i := range d.process.Threads {
		th := api.ConvertThread(d.process.Threads[i])
		state.Threads = append(state.Threads, th)
		if i == d.process.CurrentThread.ID {
			state.CurrentThread = th
		}
	}

	return state, nil
}
開發者ID:vornet,項目名稱:delve,代碼行數:30,代碼來源:debugger.go

示例3: State

func (d *Debugger) State() (*api.DebuggerState, error) {
	if d.process.Exited() {
		return nil, proc.ProcessExitedError{Pid: d.ProcessPid()}
	}

	var (
		state     *api.DebuggerState
		thread    *api.Thread
		goroutine *api.Goroutine
	)

	if d.process.CurrentThread != nil {
		thread = api.ConvertThread(d.process.CurrentThread)
	}

	if d.process.SelectedGoroutine != nil {
		goroutine = api.ConvertGoroutine(d.process.SelectedGoroutine)
	}

	var breakpoint *api.Breakpoint
	bp := d.process.CurrentBreakpoint()
	if bp != nil {
		breakpoint = api.ConvertBreakpoint(bp)
	}

	state = &api.DebuggerState{
		Breakpoint:        breakpoint,
		CurrentThread:     thread,
		SelectedGoroutine: goroutine,
		Exited:            d.process.Exited(),
	}

	return state, nil
}
開發者ID:rdterner,項目名稱:delve,代碼行數:34,代碼來源:debugger.go

示例4: Threads

// Threads returns the threads of the target process.
func (d *Debugger) Threads() ([]*api.Thread, error) {
	if d.process.Exited() {
		return nil, &proc.ProcessExitedError{}
	}
	threads := []*api.Thread{}
	for _, th := range d.process.Threads {
		threads = append(threads, api.ConvertThread(th))
	}
	return threads, nil
}
開發者ID:oldenbur,項目名稱:delve,代碼行數:11,代碼來源:debugger.go

示例5: FindThread

// FindThread returns the thread for the given 'id'.
func (d *Debugger) FindThread(id int) (*api.Thread, error) {
	d.processMutex.Lock()
	defer d.processMutex.Unlock()

	if d.process.Exited() {
		return nil, &proc.ProcessExitedError{}
	}

	for _, th := range d.process.Threads {
		if th.ID == id {
			return api.ConvertThread(th), nil
		}
	}
	return nil, nil
}
開發者ID:DuoSoftware,項目名稱:v6engine-deps,代碼行數:16,代碼來源:debugger.go

示例6: State

func (d *Debugger) State() (*api.DebuggerState, error) {
	var (
		state  *api.DebuggerState
		thread *api.Thread
	)
	th := d.process.CurrentThread
	if th != nil {
		thread = api.ConvertThread(th)
	}

	var breakpoint *api.Breakpoint
	bp := d.process.CurrentBreakpoint()
	if bp != nil {
		breakpoint = api.ConvertBreakpoint(bp)
	}

	state = &api.DebuggerState{
		Breakpoint:    breakpoint,
		CurrentThread: thread,
		Exited:        d.process.Exited(),
	}

	return state, nil
}
開發者ID:alaska,項目名稱:delve,代碼行數:24,代碼來源:debugger.go


注:本文中的github.com/derekparker/delve/service/api.ConvertThread函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。