mirror of
https://github.com/go-delve/delve.git
synced 2025-10-31 02:36:18 +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
|
int
|
||||||
fork_exec(char *argv0, char **argv, int size,
|
fork_exec(char *argv0, char **argv, int size,
|
||||||
mach_port_name_t *task,
|
task_t *task,
|
||||||
mach_port_t *port_set,
|
mach_port_t *port_set,
|
||||||
mach_port_t *exception_port,
|
mach_port_t *exception_port,
|
||||||
mach_port_t *notification_port)
|
mach_port_t *notification_port)
|
||||||
|
|||||||
@ -7,4 +7,4 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
int
|
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
|
kern_return_t
|
||||||
acquire_mach_task(int tid,
|
acquire_mach_task(int tid,
|
||||||
mach_port_name_t *task,
|
task_t *task,
|
||||||
mach_port_t *port_set,
|
mach_port_t *port_set,
|
||||||
mach_port_t *exception_port,
|
mach_port_t *exception_port,
|
||||||
mach_port_t *notification_port)
|
mach_port_t *notification_port)
|
||||||
|
|||||||
@ -9,13 +9,14 @@ import (
|
|||||||
"debug/gosym"
|
"debug/gosym"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/debug/macho"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/debug/macho"
|
||||||
|
|
||||||
"github.com/derekparker/delve/dwarf/frame"
|
"github.com/derekparker/delve/dwarf/frame"
|
||||||
"github.com/derekparker/delve/dwarf/line"
|
"github.com/derekparker/delve/dwarf/line"
|
||||||
sys "golang.org/x/sys/unix"
|
sys "golang.org/x/sys/unix"
|
||||||
@ -23,7 +24,7 @@ import (
|
|||||||
|
|
||||||
// OSProcessDetails holds Darwin specific information.
|
// OSProcessDetails holds Darwin specific information.
|
||||||
type OSProcessDetails struct {
|
type OSProcessDetails struct {
|
||||||
task C.mach_port_name_t // mach task for the debugged process.
|
task C.task_t // mach task for the debugged process.
|
||||||
exceptionPort C.mach_port_t // mach port for receiving mach exceptions.
|
exceptionPort C.mach_port_t // mach port for receiving mach exceptions.
|
||||||
notificationPort C.mach_port_t // mach port for dead name notification (process exit).
|
notificationPort C.mach_port_t // mach port for dead name notification (process exit).
|
||||||
|
|
||||||
@ -144,7 +145,7 @@ func (dbp *Process) updateThreadList() error {
|
|||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
count = C.thread_count(C.task_t(dbp.os.task))
|
count = C.thread_count(dbp.os.task)
|
||||||
if count == -1 {
|
if count == -1 {
|
||||||
return fmt.Errorf("could not get thread count")
|
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
|
// 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
|
// 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 {
|
if kret != -2 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -337,7 +338,7 @@ func (dbp *Process) waitForStop() ([]int, error) {
|
|||||||
count = 0
|
count = 0
|
||||||
ports = append(ports, int(port))
|
ports = append(ports, int(port))
|
||||||
} else {
|
} else {
|
||||||
n := C.num_running_threads(C.task_t(dbp.os.task))
|
n := C.num_running_threads(dbp.os.task)
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return ports, nil
|
return ports, nil
|
||||||
} else if n < 0 {
|
} else if n < 0 {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ boolean_t mach_exc_server(
|
|||||||
mach_msg_header_t *OutHeadP);
|
mach_msg_header_t *OutHeadP);
|
||||||
|
|
||||||
kern_return_t
|
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 *
|
char *
|
||||||
find_executable(int pid);
|
find_executable(int pid);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "threads_darwin.h"
|
#include "threads_darwin.h"
|
||||||
|
|
||||||
int
|
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;
|
kern_return_t kret;
|
||||||
vm_region_submap_short_info_data_64_t info;
|
vm_region_submap_short_info_data_64_t info;
|
||||||
mach_msg_type_number_t count = VM_REGION_SUBMAP_SHORT_INFO_COUNT_64;
|
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
|
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;
|
kern_return_t kret;
|
||||||
pointer_t data;
|
pointer_t data;
|
||||||
mach_msg_type_number_t count;
|
mach_msg_type_number_t count;
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
#include <mach/thread_info.h>
|
#include <mach/thread_info.h>
|
||||||
|
|
||||||
int
|
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
|
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
|
kern_return_t
|
||||||
get_registers(mach_port_name_t, x86_thread_state64_t*);
|
get_registers(mach_port_name_t, x86_thread_state64_t*);
|
||||||
|
|||||||
Reference in New Issue
Block a user