mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 10:47:27 +08:00 
			
		
		
		
	Refactor: Move Cover method to FDE
This commit is contained in:
		| @ -23,16 +23,8 @@ type addrange struct { | |||||||
| 	begin, end uint64 | 	begin, end uint64 | ||||||
| } | } | ||||||
|  |  | ||||||
| func (r *addrange) Begin() uint64 { | func (fde *FrameDescriptionEntry) Cover(addr uint64) bool { | ||||||
| 	return r.begin | 	if (addr - fde.AddressRange.begin) < fde.AddressRange.end { | ||||||
| } |  | ||||||
|  |  | ||||||
| func (r *addrange) End() uint64 { |  | ||||||
| 	return r.end |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func (r *addrange) Cover(addr uint64) bool { |  | ||||||
| 	if (addr - r.begin) < r.end { |  | ||||||
| 		return true | 		return true | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | |||||||
| @ -249,7 +249,7 @@ func (dbp *DebuggedProcess) Next() error { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	loc := dbp.DebugLine.NextLocation(pc, f, l) | 	loc := dbp.DebugLine.NextLocation(pc, f, l) | ||||||
| 	if !fde.AddressRange.Cover(loc.Address) { | 	if !fde.Cover(loc.Address) { | ||||||
| 		// Step once to ensure we're not going to step | 		// Step once to ensure we're not going to step | ||||||
| 		// into another function before returning. | 		// into another function before returning. | ||||||
| 		pc, err = step() | 		pc, err = step() | ||||||
| @ -257,12 +257,12 @@ func (dbp *DebuggedProcess) Next() error { | |||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if fde.AddressRange.Cover(pc) { | 		if fde.Cover(pc) { | ||||||
| 			// Unconditionally step out of current function | 			// Unconditionally step out of current function | ||||||
| 			// Don't bother looking up ret addr, next line is | 			// Don't bother looking up ret addr, next line is | ||||||
| 			// outside of current fn, should only be a few | 			// outside of current fn, should only be a few | ||||||
| 			// instructions left to RET | 			// instructions left to RET | ||||||
| 			for fde.AddressRange.Cover(pc) { | 			for fde.Cover(pc) { | ||||||
| 				pc, err = step() | 				pc, err = step() | ||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					return err | 					return err | ||||||
| @ -279,7 +279,7 @@ func (dbp *DebuggedProcess) Next() error { | |||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if !fde.AddressRange.Cover(pc) { | 		if !fde.Cover(pc) { | ||||||
| 			// We've stepped into a function, keep going. | 			// We've stepped into a function, keep going. | ||||||
| 			// TODO: Use DWARF frame info to continue to return address. | 			// TODO: Use DWARF frame info to continue to return address. | ||||||
| 			continue | 			continue | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Derek Parker
					Derek Parker