proc: Use correct type for mach task

This commit is contained in:
Derek Parker
2016-04-12 22:53:13 -07:00
parent 4fd02c829a
commit f37a26d525
7 changed files with 16 additions and 15 deletions

View File

@ -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)

View File

@ -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*);

View File

@ -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)

View File

@ -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 {

View File

@ -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);

View File

@ -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;

View File

@ -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*);