mirror of
				https://github.com/go-delve/delve.git
				synced 2025-11-04 06:32:16 +08:00 
			
		
		
		
	debugger: Allow disassembly even if the scope can not be converted
It is sometimes impossible to convert an EvalScope immediately after starting the program but disassembly can still proceed.
This commit is contained in:
		@ -762,20 +762,20 @@ func (d *Debugger) Disassemble(scope api.EvalScope, startPC, endPC uint64, flavo
 | 
				
			|||||||
		endPC = fn.End
 | 
							endPC = fn.End
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	s, err := d.process.ConvertEvalScope(scope.GoroutineID, scope.Frame)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return nil, err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	currentGoroutine := true
 | 
						currentGoroutine := true
 | 
				
			||||||
	if scope.GoroutineID != -1 {
 | 
						thread := d.process.CurrentThread
 | 
				
			||||||
		g, _ := s.Thread.GetG()
 | 
					
 | 
				
			||||||
		if g == nil || g.ID != scope.GoroutineID {
 | 
						if s, err := d.process.ConvertEvalScope(scope.GoroutineID, scope.Frame); err == nil {
 | 
				
			||||||
			currentGoroutine = false
 | 
							thread = s.Thread
 | 
				
			||||||
 | 
							if scope.GoroutineID != -1 {
 | 
				
			||||||
 | 
								g, _ := s.Thread.GetG()
 | 
				
			||||||
 | 
								if g == nil || g.ID != scope.GoroutineID {
 | 
				
			||||||
 | 
									currentGoroutine = false
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	insts, err := s.Thread.Disassemble(startPC, endPC, currentGoroutine)
 | 
						insts, err := thread.Disassemble(startPC, endPC, currentGoroutine)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user