mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 10:47:27 +08:00 
			
		
		
		
	proc: Use correct type for mach task
This commit is contained in:
		| @ -12,7 +12,7 @@ close_exec_pipe(int fd[2]) { | ||||
|  | ||||
| int | ||||
| fork_exec(char *argv0, char **argv, int size, | ||||
| 		mach_port_name_t *task, | ||||
| 		task_t *task, | ||||
| 		mach_port_t *port_set, | ||||
| 		mach_port_t *exception_port, | ||||
| 		mach_port_t *notification_port) | ||||
|  | ||||
| @ -7,4 +7,4 @@ | ||||
| #include <fcntl.h> | ||||
|  | ||||
| int | ||||
| fork_exec(char *, char **, int, mach_port_name_t*, mach_port_t*, mach_port_t*, mach_port_t*); | ||||
| fork_exec(char *, char **, int, task_t*, mach_port_t*, mach_port_t*, mach_port_t*); | ||||
|  | ||||
| @ -23,7 +23,7 @@ __attribute__ ((section ("__TEXT,__info_plist"),used)) = | ||||
|  | ||||
| kern_return_t | ||||
| acquire_mach_task(int tid, | ||||
| 		mach_port_name_t *task, | ||||
| 		task_t *task, | ||||
| 		mach_port_t *port_set, | ||||
| 		mach_port_t *exception_port, | ||||
| 		mach_port_t *notification_port) | ||||
|  | ||||
| @ -9,13 +9,14 @@ import ( | ||||
| 	"debug/gosym" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"golang.org/x/debug/macho" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"path/filepath" | ||||
| 	"sync" | ||||
| 	"unsafe" | ||||
|  | ||||
| 	"golang.org/x/debug/macho" | ||||
|  | ||||
| 	"github.com/derekparker/delve/dwarf/frame" | ||||
| 	"github.com/derekparker/delve/dwarf/line" | ||||
| 	sys "golang.org/x/sys/unix" | ||||
| @ -23,9 +24,9 @@ import ( | ||||
|  | ||||
| // OSProcessDetails holds Darwin specific information. | ||||
| type OSProcessDetails struct { | ||||
| 	task             C.mach_port_name_t // mach task for the debugged process. | ||||
| 	exceptionPort    C.mach_port_t      // mach port for receiving mach exceptions. | ||||
| 	notificationPort C.mach_port_t      // mach port for dead name notification (process exit). | ||||
| 	task             C.task_t      // mach task for the debugged process. | ||||
| 	exceptionPort    C.mach_port_t // mach port for receiving mach exceptions. | ||||
| 	notificationPort C.mach_port_t // mach port for dead name notification (process exit). | ||||
|  | ||||
| 	// the main port we use, will return messages from both the | ||||
| 	// exception and notification ports. | ||||
| @ -144,7 +145,7 @@ func (dbp *Process) updateThreadList() error { | ||||
| 	) | ||||
|  | ||||
| 	for { | ||||
| 		count = C.thread_count(C.task_t(dbp.os.task)) | ||||
| 		count = C.thread_count(dbp.os.task) | ||||
| 		if count == -1 { | ||||
| 			return fmt.Errorf("could not get thread count") | ||||
| 		} | ||||
| @ -152,7 +153,7 @@ func (dbp *Process) updateThreadList() error { | ||||
|  | ||||
| 		// TODO(dp) might be better to malloc mem in C and then free it here | ||||
| 		// instead of getting count above and passing in a slice | ||||
| 		kret = C.get_threads(C.task_t(dbp.os.task), unsafe.Pointer(&list[0]), count) | ||||
| 		kret = C.get_threads(dbp.os.task, unsafe.Pointer(&list[0]), count) | ||||
| 		if kret != -2 { | ||||
| 			break | ||||
| 		} | ||||
| @ -337,7 +338,7 @@ func (dbp *Process) waitForStop() ([]int, error) { | ||||
| 			count = 0 | ||||
| 			ports = append(ports, int(port)) | ||||
| 		} else { | ||||
| 			n := C.num_running_threads(C.task_t(dbp.os.task)) | ||||
| 			n := C.num_running_threads(dbp.os.task) | ||||
| 			if n == 0 { | ||||
| 				return ports, nil | ||||
| 			} else if n < 0 { | ||||
|  | ||||
| @ -24,7 +24,7 @@ boolean_t mach_exc_server( | ||||
| 		mach_msg_header_t *OutHeadP); | ||||
|  | ||||
| kern_return_t | ||||
| acquire_mach_task(int, mach_port_name_t*, mach_port_t*, mach_port_t*, mach_port_t*); | ||||
| acquire_mach_task(int, task_t*, mach_port_t*, mach_port_t*, mach_port_t*); | ||||
|  | ||||
| char * | ||||
| find_executable(int pid); | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| #include "threads_darwin.h" | ||||
|  | ||||
| int | ||||
| write_memory(mach_port_name_t task, mach_vm_address_t addr, void *d, mach_msg_type_number_t len) { | ||||
| write_memory(task_t task, mach_vm_address_t addr, void *d, mach_msg_type_number_t len) { | ||||
| 	kern_return_t kret; | ||||
| 	vm_region_submap_short_info_data_64_t info; | ||||
| 	mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64; | ||||
| @ -27,7 +27,7 @@ write_memory(mach_port_name_t task, mach_vm_address_t addr, void *d, mach_msg_ty | ||||
| } | ||||
|  | ||||
| int | ||||
| read_memory(mach_port_name_t task, mach_vm_address_t addr, void *d, mach_msg_type_number_t len) { | ||||
| read_memory(task_t task, mach_vm_address_t addr, void *d, mach_msg_type_number_t len) { | ||||
| 	kern_return_t kret; | ||||
| 	pointer_t data; | ||||
| 	mach_msg_type_number_t count; | ||||
|  | ||||
| @ -5,10 +5,10 @@ | ||||
| #include <mach/thread_info.h> | ||||
|  | ||||
| int | ||||
| write_memory(mach_port_name_t, mach_vm_address_t, void *, mach_msg_type_number_t); | ||||
| write_memory(task_t, mach_vm_address_t, void *, mach_msg_type_number_t); | ||||
|  | ||||
| int | ||||
| read_memory(mach_port_name_t, mach_vm_address_t, void *, mach_msg_type_number_t); | ||||
| read_memory(task_t, mach_vm_address_t, void *, mach_msg_type_number_t); | ||||
|  | ||||
| kern_return_t | ||||
| get_registers(mach_port_name_t, x86_thread_state64_t*); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Derek Parker
					Derek Parker