mirror of
				https://github.com/go-delve/delve.git
				synced 2025-11-01 03:42:59 +08:00 
			
		
		
		
	Handle missing line info in printcontext
This commit is contained in:
		 Michael Gehring
					Michael Gehring
				
			
				
					committed by
					
						 Derek Parker
						Derek Parker
					
				
			
			
				
	
			
			
			 Derek Parker
						Derek Parker
					
				
			
						parent
						
							03b5e30bfb
						
					
				
				
					commit
					2ce51ab92f
				
			| @ -239,8 +239,9 @@ func printcontext(p *proctl.DebuggedProcess) error { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	f, l, _ := p.GoSymTable.PCToLine(regs.PC()) | ||||
| 	f, l, fn := p.GoSymTable.PCToLine(regs.PC()) | ||||
|  | ||||
| 	if fn != nil { | ||||
| 		fmt.Printf("Stopped at: %s:%d\n", f, l) | ||||
| 		file, err := os.Open(f) | ||||
| 		if err != nil { | ||||
| @ -274,6 +275,10 @@ func printcontext(p *proctl.DebuggedProcess) error { | ||||
|  | ||||
| 			context = append(context, fmt.Sprintf("\033[34m%d\033[0m: %s", i, line)) | ||||
| 		} | ||||
| 	} else { | ||||
| 		fmt.Printf("Stopped at: 0x%x\n", regs.PC()) | ||||
| 		context = append(context, "\033[34m=>\033[0m    no source available") | ||||
| 	} | ||||
|  | ||||
| 	fmt.Println(strings.Join(context, "")) | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user