p->as, &p->from, &p->to);
break;
- defaul:
+ default:
sprint(str, " %A %D,%lD", p->as, &p->from, &p->to);
break;
}
duplicate(char *name)
{
Hashchain *p;
- char *cp;
int h;
h = hashstr(name) % NHASH;
int
parsemethod(char **pp, char *ep, char **methp)
{
- char *p, *prefix, *name, *def;
- int n;
+ char *p;
// skip white space
p = *pp;
void
getpkgdef(char **datap, int *lenp)
{
- Fmt f;
int i, j, len;
- char *data, *p, *ep;
+ char *data, *p;
Import **all, *x;
// make a list of all the exports and count string sizes
all = armalloc(nimport*sizeof all[0]);
j = 0;
len = 7 + 3 + strlen(pkgstmt) + 1; // import\n$$\npkgstmt\n
- for(i=0; i<NHASH; i++) {
+ for(i=0; i<NIHASH; i++) {
for(x=ihash[i]; x; x=x->hash) {
all[j++] = x;
len += strlen(x->prefix) + 1
void
resumecheckwidth(void)
{
- TypeList *l, *next;
+ TypeList *l;
if(!defercalc)
fatal("restartcheckwidth");
int
Wconv(Fmt *fp)
{
- char buf[500];
int w;
w = va_arg(fp->args, int);
/*
* get 8 bytes of the instruction
- */
+ *
static int
igetq(Map *map, Instr *ip, vlong *qp)
{
*qp = q;
return 1;
}
+ */
static int
getdisp(Map *map, Instr *ip, int mod, int rm, int code, int pcrel)
{
if (ip->mod == 3) {
if (ip->osize == 'B')
- bprint(ip, (ip->rex & REXB? breg64: breg)[ip->base]);
+ bprint(ip, (ip->rex & REXB? breg64: breg)[(uchar)ip->base]);
else if(ip->rex & REXB)
bprint(ip, "%s%s", ANAME(ip), reg[ip->base+8]);
else
- bprint(ip, "%s%s", ANAME(ip), reg[ip->base]);
+ bprint(ip, "%s%s", ANAME(ip), reg[(uchar)ip->base]);
return;
}
if (ip->segment)
#include <sys/ptrace.h>
#include <sys/signal.h>
#include <mach/mach.h>
+#include <mach/mach_traps.h>
#include <errno.h>
#include <libc.h>
#include <bio.h>
#include <ureg_amd64.h>
typedef struct Ureg Ureg;
+extern mach_port_t mach_reply_port(void); // should be in system headers, is not
+
// Mach-error wrapper.
// Takes a mach return code and converts it into 0 / -1,
// setting errstr when it returns -1.
static Thread*
addpid(int pid, int force)
{
- int i, j, r;
+ int i, j;
mach_port_t task;
mach_port_t *thread;
uint nthread;
return &thr[id];
}
+/*
static int
idtopid(int id)
{
return -1;
return t->pid;
}
+*/
static mach_port_t
idtotask(int id)
static int
machsegrw(Map *map, Seg *seg, uvlong addr, void *v, uint n, int isr)
{
- uintptr nn;
mach_port_t task;
int r;
return -1;
if(isr){
+ vm_size_t nn;
nn = n;
if(me(vm_read_overwrite(task, addr, n, (uintptr)v, &nn)) < 0)
return -1;
{
uint nn;
mach_port_t thread;
- int reg, r;
+ int reg;
union {
x86_thread_state64_t regs;
uchar p[1];
{
struct thread_basic_info info;
uint size;
- int r;
size = sizeof info;
if(me(thread_info(t->thread, THREAD_BASIC_INFO, (thread_info_t)&info, &size)) < 0){
x86_thread_state64_t regs;
if(!threadstopped(t))
- return;
+ return 0;
// Set or clear the processor single-step flag, as appropriate.
n = x86_THREAD_STATE64_COUNT;
ctlproc(int id, char *msg)
{
Thread *t;
- int status, r;
+ int status;
// Hang/attached dance is for debugging newly exec'ed programs.
// After fork, the child does ctlproc("hang") before exec,
#include <u.h>
#include <sys/ptrace.h>
#include <sys/signal.h>
+#include <sys/wait.h>
#include <errno.h>
#include <libc.h>
#include <bio.h>
Map*
attachproc(int pid, Fhdr *fp)
{
- char buf[64];
Map *map;
- vlong n;
if(ptraceattach(pid) < 0)
return nil;
int
ctlproc(int pid, char *msg)
{
- int i, p, status;
+ int i;
if(strcmp(msg, "attached") == 0){
for(i=0; i<nattached; i++)
return 1;
}
+/*
static uvlong
stacktop(int pid)
{
return 0;
return strtoull(cp, 0, 16);
}
+*/
int
findseg(Map *map, char *name)