本文整理汇总了Golang中github.com/derekparker/delve/proc.Thread.Location方法的典型用法代码示例。如果您正苦于以下问题:Golang Thread.Location方法的具体用法?Golang Thread.Location怎么用?Golang Thread.Location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/derekparker/delve/proc.Thread
的用法示例。
在下文中一共展示了Thread.Location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ConvertThread
// ConvertThread converts a proc.Thread into an
// api thread.
func ConvertThread(th *proc.Thread) *Thread {
var (
function *Function
file string
line int
pc uint64
gid int
)
loc, err := th.Location()
if err == nil {
pc = loc.PC
file = loc.File
line = loc.Line
function = ConvertFunction(loc.Fn)
}
var bp *Breakpoint
if th.CurrentBreakpoint != nil && th.BreakpointConditionMet {
bp = ConvertBreakpoint(th.CurrentBreakpoint)
}
if g, _ := th.GetG(); g != nil {
gid = g.ID
}
return &Thread{
ID: th.ID,
PC: pc,
File: file,
Line: line,
Function: function,
GoroutineID: gid,
Breakpoint: bp,
}
}
示例2: ConvertThread
// convertThread converts an internal thread to an API Thread.
func ConvertThread(th *proc.Thread) *Thread {
var (
function *Function
file string
line int
pc uint64
)
loc, err := th.Location()
if err == nil {
pc = loc.PC
file = loc.File
line = loc.Line
function = ConvertFunction(loc.Fn)
}
return &Thread{
ID: th.Id,
PC: pc,
File: shortenFilePath(file),
Line: line,
Function: function,
}
}