本文整理汇总了Golang中github.com/derekparker/delve/proc.Launch函数的典型用法代码示例。如果您正苦于以下问题:Golang Launch函数的具体用法?Golang Launch怎么用?Golang Launch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Launch函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Restart
// Restart will restart the target process, first killing
// and then exec'ing it again.
func (d *Debugger) Restart() error {
d.processMutex.Lock()
defer d.processMutex.Unlock()
if !d.process.Exited() {
if d.process.Running() {
d.process.Halt()
}
// Ensure the process is in a PTRACE_STOP.
if err := stopProcess(d.ProcessPid()); err != nil {
return err
}
if err := d.detach(true); err != nil {
return err
}
}
p, err := proc.Launch(d.config.ProcessArgs)
if err != nil {
return fmt.Errorf("could not launch process: %s", err)
}
for _, oldBp := range d.breakpoints() {
if oldBp.ID < 0 {
continue
}
newBp, err := p.SetBreakpoint(oldBp.Addr)
if err != nil {
return err
}
if err := copyBreakpointInfo(newBp, oldBp); err != nil {
return err
}
}
d.process = p
return nil
}
开发者ID:DuoSoftware,项目名称:v6engine-deps,代码行数:37,代码来源:debugger.go
示例2: Restart
// Restart will restart the target process, first killing
// and then exec'ing it again.
func (d *Debugger) Restart() error {
if !d.process.Exited() {
if d.process.Running() {
d.process.Halt()
}
// Ensure the process is in a PTRACE_STOP.
if err := stopProcess(d.ProcessPid()); err != nil {
return err
}
if err := d.Detach(true); err != nil {
return err
}
}
p, err := proc.Launch(d.config.ProcessArgs)
if err != nil {
return fmt.Errorf("could not launch process: %s", err)
}
for addr, bp := range d.process.Breakpoints {
if bp.Temp {
continue
}
if _, err := p.SetBreakpoint(addr); err != nil {
return err
}
}
d.process = p
return nil
}
开发者ID:vornet,项目名称:delve,代码行数:30,代码来源:debugger.go
示例3: New
// New creates a new Debugger.
func New(config *Config) (*Debugger, error) {
d := &Debugger{
config: config,
}
// Create the process by either attaching or launching.
if d.config.AttachPid > 0 {
log.Printf("attaching to pid %d", d.config.AttachPid)
p, err := proc.Attach(d.config.AttachPid)
if err != nil {
return nil, attachErrorMessage(d.config.AttachPid, err)
}
d.process = p
} else {
log.Printf("launching process with args: %v", d.config.ProcessArgs)
p, err := proc.Launch(d.config.ProcessArgs)
if err != nil {
if err != proc.NotExecutableErr && err != proc.UnsupportedArchErr {
err = fmt.Errorf("could not launch process: %s", err)
}
return nil, err
}
d.process = p
}
return d, nil
}
开发者ID:RJAugust,项目名称:delve,代码行数:27,代码来源:debugger.go
示例4: withTestProcess
func withTestProcess(name string, t *testing.T, fn func(p *proc.Process, fixture protest.Fixture)) {
fixture := protest.BuildFixture(name)
p, err := proc.Launch([]string{fixture.Path})
if err != nil {
t.Fatal("Launch():", err)
}
defer func() {
p.Halt()
p.Kill()
}()
fn(p, fixture)
}
开发者ID:dustinevan,项目名称:delve,代码行数:14,代码来源:variables_test.go
示例5: Restart
func (d *Debugger) Restart() error {
if !d.process.Exited() {
if d.process.Running() {
d.process.Halt()
}
// Ensure the process is in a PTRACE_STOP.
if err := sys.Kill(d.ProcessPid(), sys.SIGSTOP); err != nil {
return err
}
if err := d.Detach(true); err != nil {
return err
}
}
p, err := proc.Launch(d.config.ProcessArgs)
if err != nil {
return fmt.Errorf("could not launch process: %s", err)
}
d.process = p
return nil
}
开发者ID:alaska,项目名称:delve,代码行数:20,代码来源:debugger.go
注:本文中的github.com/derekparker/delve/proc.Launch函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论