if (!delta)
return snprint(buf, n, "%s", s.name);
if (s.type != 't' && s.type != 'T')
- return snprint(buf, n, "%s+%lux", s.name, v-s.value);
+ return snprint(buf, n, "%s+%llux", s.name, v-s.value);
else
return snprint(buf, n, "#%lux", v);
}
if (memcmp(buf, machdata->bpinst, machdata->bpsize) == 0)
return "breakpoint";
}
- snprint(buf, sizeof(buf), "exception %ld", c);
+ snprint(buf, sizeof(buf), "exception %d", c);
return buf;
} else
return excname[c];
offset = ip->disp;
if (!findsym(ip->addr, CTEXT, &s) || !findlocal(&s, FRAMENAME, &s)) {
- bprint(ip, "%lux(SP)", offset);
+ bprint(ip, "%ux(SP)", offset);
return;
}
bprint(ip, "%s+", s.name);
else
offset = ip->disp;
- bprint(ip, "%lux%s", offset, reg);
+ bprint(ip, "%ux%s", offset, reg);
}
static int
w = -w;
if (issymref(ip, &s, w, val)) {
if (w)
- bprint(ip, "%s+%#lux(SB)", s.name, w);
+ bprint(ip, "%s+%#ux(SB)", s.name, w);
else
bprint(ip, "%s(SB)", s.name);
return;
if (ip->base < 0)
immediate(ip, ip->disp);
else {
- bprint(ip, "%lux", ip->disp);
+ bprint(ip, "%ux", ip->disp);
if(ip->rip)
bprint(ip, "(RIP)");
bprint(ip,"(%s%s)", ANAME(ip), reg[ip->rex&REXB? ip->base+8: ip->base]);
bprint(ip, "CBW");
break;
case 'd':
- bprint(ip,"%ux:%lux",ip->seg,ip->disp);
+ bprint(ip,"%ux:%ux", ip->seg, ip->disp);
break;
case 'm':
if (ip->mod == 3 && ip->osize != 'B') {
uint32 (*swal)(uint32);
ushort (*swab)(ushort);
Ehdr64 *ep;
- Phdr64 *ph;
+ Phdr64 *ph, *pph;
Shdr64 *sh;
int i, it, id, is, phsz, shsz;
}
settext(fp, ep->elfentry, ph[it].vaddr, ph[it].memsz, ph[it].offset);
- setdata(fp, ph[id].vaddr, ph[id].filesz, ph[id].offset, ph[id].memsz - ph[id].filesz);
+ pph = ph + id;
+ setdata(fp, pph->vaddr, pph->filesz, pph->offset, pph->memsz - pph->filesz);
if(is != -1)
setsym(fp, ph[is].offset, ph[is].filesz, 0, 0, 0, ph[is].memsz);
else if(sh != 0){
mp->sizeofcmds = swal(mp->sizeofcmds);
mp->flags = swal(mp->flags);
mp->reserved = swal(mp->reserved);
- hdrsize = 0;
switch(mp->magic) {
case 0xFEEDFACE: // 32-bit mach
datava = 0;
symtab = 0;
pclntab = 0;
- textsize = datasize = bsssize = 0;
+ textsize = 0;
+ datasize = 0;
+ bsssize = 0;
for (i = 0; i < mp->ncmds; i++) {
MachCmd *c;
}
seek(fd, start+sizeof(magic)+sizeof(fh)+leswab(fh.SizeOfOptionalHeader), 0);
- fp->txtaddr = fp->dataddr = 0;
+ fp->txtaddr = 0;
+ fp->dataddr = 0;
for (i=0; i<leswab(fh.NumberOfSections); i++) {
if (readn(fd, &sh, sizeof(sh)) != sizeof(sh)) {
werrstr("could not read Section Header %d", i+1);
seek(fd, leswal(fh.PointerToSymbolTable), 0);
symtab = esymtab = 0;
for (i=0; i<leswal(fh.NumberOfSymbols); i++) {
- if (readn(fd, &sym, sizeof(sym)) != sizeof(sym)) {
+ if (readn(fd, sym, sizeof(sym)) != sizeof(sym)) {
werrstr("crippled COFF symbol %d", i);
return 0;
}
fp->lnpcsz = lnpcsz;
}
-
static uvlong
_round(uvlong a, uint32 b)
{
if (s.type != 't' && s.type != 'T' && delta >= 4096)
return snprint(buf, n, "%llux", v);
else if (delta)
- return snprint(buf, n, "%s+%#lux", s.name, delta);
+ return snprint(buf, n, "%s+%#ux", s.name, delta);
else
return snprint(buf, n, "%s", s.name);
}
case 'X':
if (get4(map, rp->roffs, &r) < 0)
return -1;
- snprint(buf, n, "%lux", r);
+ snprint(buf, n, "%ux", r);
break;
case 'F': /* first reg of double reg pair */
if (modif == 'F')
return snprint(buf, n, "0.");
exp = (h>>20) & ((1L<<11)-1L);
if(exp == 0)
- return snprint(buf, n, "DeN(%.8lux%.8lux)", h, l);
+ return snprint(buf, n, "DeN(%.8ux%.8ux)", h, l);
if(exp == ((1L<<11)-1L)){
if(l==0 && (h&((1L<<20)-1L)) == 0)
return snprint(buf, n, "Inf");
else
- return snprint(buf, n, "NaN(%.8lux%.8lux)", h&((1L<<20)-1L), l);
+ return snprint(buf, n, "NaN(%.8ux%.8ux)", h&((1<<20)-1), l);
}
exp -= (1L<<10) - 2L;
fr = l & ((1L<<16)-1L);
return snprint(buf, n, "0.");
exp = (h>>23) & ((1L<<8)-1L);
if(exp == 0)
- return snprint(buf, n, "DeN(%.8lux)", h);
+ return snprint(buf, n, "DeN(%.8ux)", h);
if(exp == ((1L<<8)-1L)){
if((h&((1L<<23)-1L)) == 0)
return snprint(buf, n, "Inf");
/* minimum symbol record size = 4+1+2 bytes */
symbols = malloc((fp->symsz/(4+1+2)+1)*sizeof(Sym));
if(symbols == 0) {
- werrstr("can't malloc %ld bytes", fp->symsz);
+ werrstr("can't malloc %d bytes", fp->symsz);
return -1;
}
Binit(&b, fd, OREAD);
}
}
if (debug)
- print("NG: %ld NT: %d NF: %d\n", nglob, ntxt, fmaxi);
+ print("NG: %d NT: %d NF: %d\n", nglob, ntxt, fmaxi);
if (fp->sppcsz) { /* pc-sp offset table */
spoff = (uchar *)malloc(fp->sppcsz);
if(spoff == 0) {
- werrstr("can't malloc %ld bytes", fp->sppcsz);
+ werrstr("can't malloc %d bytes", fp->sppcsz);
return -1;
}
Bseek(&b, fp->sppcoff, 0);
if (fp->lnpcsz) { /* pc-line number table */
pcline = (uchar *)malloc(fp->lnpcsz);
if(pcline == 0) {
- werrstr("can't malloc %ld bytes", fp->lnpcsz);
+ werrstr("can't malloc %d bytes", fp->lnpcsz);
return -1;
}
Bseek(&b, fp->lnpcoff, 0);
n = Bseek(bp, 0, 1)-o;
p->name = malloc(n);
if(p->name == 0) {
- werrstr("can't malloc %ld bytes", n);
+ werrstr("can't malloc %d bytes", n);
return -1;
}
Bseek(bp, -n, 1);
if(Bread(bp, p->name, n) != n) {
- werrstr("can't read %ld bytes of symbol name", n);
+ werrstr("can't read %d bytes of symbol name", n);
return -1;
}
} else {
n = Blinelen(bp);
p->name = malloc(n);
if(p->name == 0) {
- werrstr("can't malloc %ld bytes", n);
+ werrstr("can't malloc %d bytes", n);
return -1;
}
strcpy(p->name, cp);
break;
free(name);
if(i >= nfiles) {
- werrstr("line %ld in file %s not found", line, file);
+ werrstr("line %d in file %s not found", line, file);
return ~0;
}
start = fp->addr; /* first text addr this file */
* run the state machine to locate the pc closest to that value.
*/
if(debug)
- print("find pc for %ld - between: %llux and %llux\n", line, start, end);
+ print("find pc for %d - between: %llux and %llux\n", line, start, end);
pc = line2addr(line, start, end);
if(pc == ~0) {
- werrstr("line %ld not in file %s", line, file);
+ werrstr("line %d not in file %s", line, file);
return ~0;
}
return pc;
else {
k = fileelem(fnames, (uchar*)start->name, str, n);
if(k+8 < n)
- sprint(str+k, ":%ld", line);
+ sprint(str+k, ":%d", line);
}
/**********Remove comments for complete back-trace of include sequence
* if(start != base) {
while(hp->name) {
if(count && ++i > count)
break;
- print("%s Line: %lx (%ld) Offset: %lx (%ld) Name: ", msg,
+ print("%s Line: %x (%d) Offset: %x (%d) Name: ", msg,
hp->line, hp->line, hp->offset, hp->offset);
for(cp = (uchar *)hp->name+1; (*cp<<8)|cp[1]; cp += 2) {
if (cp != (uchar *)hp->name+1)