mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 02:36:18 +08:00 
			
		
		
		
	dwarf/frame: handle unknown opcodes more gracefully (#4037)
Instead of panic'ing on unknown opcodes (there are a few around which gdb handles) report an error and continue as if the FDE did not exist. Fixes #4035
This commit is contained in:
		 Alessandro Arzilli
					Alessandro Arzilli
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							50a45f1b07
						
					
				
				
					commit
					26806dcaf3
				
			| @ -508,16 +508,20 @@ func (it *stackIterator) appendInlineCalls(callback func(Stackframe) bool, frame | ||||
| // it.regs.CFA; the caller has to eventually switch it.regs when the iterator | ||||
| // advances to the next frame. | ||||
| func (it *stackIterator) advanceRegs() (callFrameRegs op.DwarfRegisters, ret uint64, retaddr uint64) { | ||||
| 	logger := logflags.StackLogger() | ||||
|  | ||||
| 	fde, err := it.bi.frameEntries.FDEForPC(it.pc) | ||||
| 	var framectx *frame.FrameContext | ||||
| 	if _, nofde := err.(*frame.ErrNoFDEForPC); nofde { | ||||
| 		framectx = it.bi.Arch.fixFrameUnwindContext(nil, it.pc, it.bi) | ||||
| 	} else { | ||||
| 		framectx = it.bi.Arch.fixFrameUnwindContext(fde.EstablishFrame(it.pc), it.pc, it.bi) | ||||
| 		fctxt, err := fde.EstablishFrame(it.pc) | ||||
| 		if err != nil { | ||||
| 			logger.Errorf("Error executing Frame Debug Entry for PC %x: %v", it.pc, err) | ||||
| 		} | ||||
| 		framectx = it.bi.Arch.fixFrameUnwindContext(fctxt, it.pc, it.bi) | ||||
| 	} | ||||
|  | ||||
| 	logger := logflags.StackLogger() | ||||
|  | ||||
| 	logger.Debugf("advanceRegs at %#x", it.pc) | ||||
|  | ||||
| 	cfareg, err := it.executeFrameRegRule(0, framectx.CFA, 0) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user