本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}