本文整理汇总了Golang中github.com/derekparker/delve/service/api.ConvertBreakpoint函数的典型用法代码示例。如果您正苦于以下问题:Golang ConvertBreakpoint函数的具体用法?Golang ConvertBreakpoint怎么用?Golang ConvertBreakpoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ConvertBreakpoint函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: CreateBreakpoint
func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) {
var (
createdBp *api.Breakpoint
addr uint64
err error
)
switch {
case len(requestedBp.File) > 0:
addr, err = d.process.FindFileLocation(requestedBp.File, requestedBp.Line)
case len(requestedBp.FunctionName) > 0:
if requestedBp.Line >= 0 {
addr, err = d.process.FindFunctionLocation(requestedBp.FunctionName, false, requestedBp.Line)
} else {
addr, err = d.process.FindFunctionLocation(requestedBp.FunctionName, true, 0)
}
default:
addr = requestedBp.Addr
}
if err != nil {
return nil, err
}
bp, err := d.process.SetBreakpoint(addr)
if err != nil {
return nil, err
}
bp.Tracepoint = requestedBp.Tracepoint
bp.Goroutine = requestedBp.Goroutine
bp.Stacktrace = requestedBp.Stacktrace
bp.Variables = requestedBp.Variables
createdBp = api.ConvertBreakpoint(bp)
log.Printf("created breakpoint: %#v", createdBp)
return createdBp, nil
}
开发者ID:rdterner,项目名称:delve,代码行数:35,代码来源:debugger.go
示例2: 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
示例3: FindBreakpoint
// FindBreakpoint returns the breakpoint specified by 'id'.
func (d *Debugger) FindBreakpoint(id int) *api.Breakpoint {
d.processMutex.Lock()
defer d.processMutex.Unlock()
bp := d.findBreakpoint(id)
if bp == nil {
return nil
}
return api.ConvertBreakpoint(bp)
}
开发者ID:DuoSoftware,项目名称:v6engine-deps,代码行数:11,代码来源:debugger.go
示例4: breakpoints
func (d *Debugger) breakpoints() []*api.Breakpoint {
bps := []*api.Breakpoint{}
for _, bp := range d.process.Breakpoints {
if bp.Temp {
continue
}
bps = append(bps, api.ConvertBreakpoint(bp))
}
return bps
}
开发者ID:DuoSoftware,项目名称:v6engine-deps,代码行数:10,代码来源:debugger.go
示例5: ClearBreakpoint
func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) {
var clearedBp *api.Breakpoint
bp, err := d.process.ClearBreakpoint(requestedBp.Addr)
if err != nil {
return nil, fmt.Errorf("Can't clear breakpoint @%x: %s", requestedBp.Addr, err)
}
clearedBp = api.ConvertBreakpoint(bp)
log.Printf("cleared breakpoint: %#v", clearedBp)
return clearedBp, err
}
开发者ID:alaska,项目名称:delve,代码行数:10,代码来源:debugger.go
示例6: CreateBreakpoint
// CreateBreakpoint creates a breakpoint.
func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) {
var (
createdBp *api.Breakpoint
addr uint64
err error
)
switch {
case len(requestedBp.File) > 0:
fileName := requestedBp.File
if runtime.GOOS == "windows" {
// Accept fileName which is case-insensitive and slash-insensitive match
fileNameNormalized := strings.ToLower(filepath.ToSlash(fileName))
for symFile := range d.process.Sources() {
if fileNameNormalized == strings.ToLower(filepath.ToSlash(symFile)) {
fileName = symFile
break
}
}
}
addr, err = d.process.FindFileLocation(fileName, requestedBp.Line)
case len(requestedBp.FunctionName) > 0:
if requestedBp.Line >= 0 {
addr, err = d.process.FindFunctionLocation(requestedBp.FunctionName, false, requestedBp.Line)
} else {
addr, err = d.process.FindFunctionLocation(requestedBp.FunctionName, true, 0)
}
default:
addr = requestedBp.Addr
}
if err != nil {
return nil, err
}
bp, err := d.process.SetBreakpoint(addr)
if err != nil {
return nil, err
}
bp.Tracepoint = requestedBp.Tracepoint
bp.Goroutine = requestedBp.Goroutine
bp.Stacktrace = requestedBp.Stacktrace
bp.Variables = requestedBp.Variables
bp.Cond = nil
createdBp = api.ConvertBreakpoint(bp)
log.Printf("created breakpoint: %#v", createdBp)
return createdBp, nil
}
开发者ID:oldenbur,项目名称:delve,代码行数:48,代码来源:debugger.go
示例7: CreateBreakpoint
func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) {
var createdBp *api.Breakpoint
var loc string
switch {
case len(requestedBp.File) > 0:
loc = fmt.Sprintf("%s:%d", requestedBp.File, requestedBp.Line)
case len(requestedBp.FunctionName) > 0:
loc = requestedBp.FunctionName
default:
return nil, fmt.Errorf("no file or function name specified")
}
bp, err := d.process.SetBreakpointByLocation(loc)
if err != nil {
return nil, err
}
createdBp = api.ConvertBreakpoint(bp)
log.Printf("created breakpoint: %#v", createdBp)
return createdBp, nil
}
开发者ID:no2key,项目名称:delve,代码行数:20,代码来源:debugger.go
示例8: 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
示例9: CreateBreakpoint
// CreateBreakpoint creates a breakpoint.
func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) {
d.processMutex.Lock()
defer d.processMutex.Unlock()
var (
createdBp *api.Breakpoint
addr uint64
err error
)
if requestedBp.Name != "" {
if err = api.ValidBreakpointName(requestedBp.Name); err != nil {
return nil, err
}
if d.findBreakpointByName(requestedBp.Name) != nil {
return nil, errors.New("breakpoint name already exists")
}
}
switch {
case len(requestedBp.File) > 0:
fileName := requestedBp.File
if runtime.GOOS == "windows" {
// Accept fileName which is case-insensitive and slash-insensitive match
fileNameNormalized := strings.ToLower(filepath.ToSlash(fileName))
for symFile := range d.process.Sources() {
if fileNameNormalized == strings.ToLower(filepath.ToSlash(symFile)) {
fileName = symFile
break
}
}
}
addr, err = d.process.FindFileLocation(fileName, requestedBp.Line)
case len(requestedBp.FunctionName) > 0:
if requestedBp.Line >= 0 {
addr, err = d.process.FindFunctionLocation(requestedBp.FunctionName, false, requestedBp.Line)
} else {
addr, err = d.process.FindFunctionLocation(requestedBp.FunctionName, true, 0)
}
default:
addr = requestedBp.Addr
}
if err != nil {
return nil, err
}
bp, err := d.process.SetBreakpoint(addr)
if err != nil {
return nil, err
}
if err := copyBreakpointInfo(bp, requestedBp); err != nil {
if _, err1 := d.process.ClearBreakpoint(bp.Addr); err1 != nil {
err = fmt.Errorf("error while creating breakpoint: %v, additionally the breakpoint could not be properly rolled back: %v", err, err1)
}
return nil, err
}
createdBp = api.ConvertBreakpoint(bp)
log.Printf("created breakpoint: %#v", createdBp)
return createdBp, nil
}
开发者ID:DuoSoftware,项目名称:v6engine-deps,代码行数:62,代码来源:debugger.go
注:本文中的github.com/derekparker/delve/service/api.ConvertBreakpoint函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论