aboutsummaryrefslogtreecommitdiff
path: root/src/libmach
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmach')
-rw-r--r--src/libmach/DragonFly.c2
-rw-r--r--src/libmach/FreeBSD.c2
-rw-r--r--src/libmach/Linux.c9
-rw-r--r--src/libmach/cmdline.c3
-rw-r--r--src/libmach/crack.c5
-rw-r--r--src/libmach/crackelf.c11
-rw-r--r--src/libmach/crackmacho.c4
-rw-r--r--src/libmach/demangler.c4
-rw-r--r--src/libmach/dwarf.h1
-rw-r--r--src/libmach/dwarf386.c4
-rw-r--r--src/libmach/dwarfabbrev.c3
-rw-r--r--src/libmach/dwarfaranges.c1
-rw-r--r--src/libmach/dwarfcfa.c21
-rw-r--r--src/libmach/dwarfeval.c1
-rw-r--r--src/libmach/dwarfget.c1
-rw-r--r--src/libmach/dwarfinfo.c8
-rw-r--r--src/libmach/dwarfopen.c2
-rw-r--r--src/libmach/dwarfpc.c2
-rw-r--r--src/libmach/elf.c11
-rw-r--r--src/libmach/elfcorefreebsd386.c1
-rw-r--r--src/libmach/elfcorefreebsdamd64.c7
-rw-r--r--src/libmach/elfcorelinux386.c7
-rw-r--r--src/libmach/elfdl386.c1
-rw-r--r--src/libmach/elfdynsym.c2
-rw-r--r--src/libmach/fpformat.c2
-rw-r--r--src/libmach/frame.c4
-rw-r--r--src/libmach/hexify.c1
-rw-r--r--src/libmach/loc.c1
-rw-r--r--src/libmach/mach386.c14
-rw-r--r--src/libmach/machamd64.c4
-rw-r--r--src/libmach/macho.c10
-rw-r--r--src/libmach/macho.h4
-rw-r--r--src/libmach/machocorepower.c1
-rw-r--r--src/libmach/machpower.c9
-rw-r--r--src/libmach/mangle.c6
-rw-r--r--src/libmach/manglegcc2.c47
-rw-r--r--src/libmach/manglegcc3.c23
-rw-r--r--src/libmach/map.c2
-rw-r--r--src/libmach/regs.c1
-rw-r--r--src/libmach/stabs.c1
-rw-r--r--src/libmach/stabs.h1
-rw-r--r--src/libmach/sym.c5
-rw-r--r--src/libmach/symdwarf.c7
-rw-r--r--src/libmach/symelf.c1
-rw-r--r--src/libmach/symmacho.c1
-rw-r--r--src/libmach/symstabs.c10
-rw-r--r--src/libmach/t.c8
-rw-r--r--src/libmach/ureg386.c1
48 files changed, 123 insertions, 154 deletions
diff --git a/src/libmach/DragonFly.c b/src/libmach/DragonFly.c
index 92ffdb92..33bd8e9c 100644
--- a/src/libmach/DragonFly.c
+++ b/src/libmach/DragonFly.c
@@ -43,7 +43,7 @@ unmapproc(Map *map)
for(i=0; i<map->nseg; i++)
while(i<map->nseg && map->seg[i].pid){
map->nseg--;
- memmove(&map->seg[i], &map->seg[i+1],
+ memmove(&map->seg[i], &map->seg[i+1],
(map->nseg-i)*sizeof(map->seg[0]));
}
}
diff --git a/src/libmach/FreeBSD.c b/src/libmach/FreeBSD.c
index 7cf5c1f4..80c8935a 100644
--- a/src/libmach/FreeBSD.c
+++ b/src/libmach/FreeBSD.c
@@ -43,7 +43,7 @@ unmapproc(Map *map)
for(i=0; i<map->nseg; i++)
while(i<map->nseg && map->seg[i].pid){
map->nseg--;
- memmove(&map->seg[i], &map->seg[i+1],
+ memmove(&map->seg[i], &map->seg[i+1],
(map->nseg-i)*sizeof(map->seg[0]));
}
}
diff --git a/src/libmach/Linux.c b/src/libmach/Linux.c
index 005d6b38..30b40bbf 100644
--- a/src/libmach/Linux.c
+++ b/src/libmach/Linux.c
@@ -1,6 +1,6 @@
/*
* process interface for Linux.
- *
+ *
* Uses ptrace for registers and data,
* /proc for some process status.
* There's not much point to worrying about
@@ -59,7 +59,7 @@ ptraceattach(int pid)
werrstr("ptrace attach %d: %r", pid);
return -1;
}
-
+
if(ctlproc(pid, "waitstop") < 0){
fprint(2, "waitstop: %r");
ptrace(PTRACE_DETACH, pid, 0, 0);
@@ -79,7 +79,7 @@ unmapproc(Map *map)
for(i=0; i<map->nseg; i++)
while(i<map->nseg && map->seg[i].pid){
map->nseg--;
- memmove(&map->seg[i], &map->seg[i+1],
+ memmove(&map->seg[i], &map->seg[i+1],
(map->nseg-i)*sizeof(map->seg[0]));
}
}
@@ -272,7 +272,7 @@ isstopped(int pid)
return *p == 'T';
}
-/* /proc/pid/stat contains
+/* /proc/pid/stat contains
pid
command in parens
0. state
@@ -456,4 +456,3 @@ proctextfile(int pid)
return pbuf;
return nil;
}
-
diff --git a/src/libmach/cmdline.c b/src/libmach/cmdline.c
index 36d0fb93..18643e10 100644
--- a/src/libmach/cmdline.c
+++ b/src/libmach/cmdline.c
@@ -134,7 +134,7 @@ attachargs(int argc, char **argv, int omode, int verbose)
mapfile(symhdr, 0, cormap, nil);
}
- if(corpid)
+ if(corpid)
attachproc(corpid);
if(corhdr)
attachcore(corhdr);
@@ -200,4 +200,3 @@ attachdynamic(int verbose)
elfdl386mapdl(verbose);
return 0;
}
-
diff --git a/src/libmach/crack.c b/src/libmach/crack.c
index 5695b7eb..a2106f05 100644
--- a/src/libmach/crack.c
+++ b/src/libmach/crack.c
@@ -10,7 +10,7 @@ Mach *mach;
extern Mach mach386;
extern Mach machpower;
-static Mach *machs[] =
+static Mach *machs[] =
{
&mach386,
&machpower,
@@ -125,7 +125,7 @@ unmapfile(Fhdr *fp, Map *map)
for(i=0; i<map->nseg; i++){
while(i<map->nseg && map->seg[i].fd == fp->fd){
map->nseg--;
- memmove(&map->seg[i], &map->seg[i+1],
+ memmove(&map->seg[i], &map->seg[i+1],
(map->nseg-i)*sizeof(map->seg[0]));
}
}
@@ -149,4 +149,3 @@ coreregs(Fhdr *fp, uint id)
werrstr("thread not found");
return nil;
}
-
diff --git a/src/libmach/crackelf.c b/src/libmach/crackelf.c
index 22f4307e..1b051eec 100644
--- a/src/libmach/crackelf.c
+++ b/src/libmach/crackelf.c
@@ -13,7 +13,7 @@ static struct
uint mtype;
Mach *mach;
char *name;
-} mtab[] =
+} mtab[] =
{ /* Font Tab 4 */
ElfMachSparc, MSPARC, nil, "sparc",
ElfMach386, M386, &mach386, "386",
@@ -29,7 +29,7 @@ static struct
uint etype;
uint atype;
char *aname;
-} atab[] =
+} atab[] =
{ /* Font Tab 4 */
ElfAbiSystemV, ALINUX, "linux", /* [sic] */
ElfAbiLinux, ALINUX, "linux",
@@ -41,7 +41,7 @@ static struct
uint mtype;
uint atype;
void (*elfcore)(Fhdr*, Elf*, ElfNote*);
-} ctab[] =
+} ctab[] =
{ /* Font Tab 4 */
M386, ALINUX, elfcorelinux386,
M386, ANONE, elfcorelinux386, /* [sic] */
@@ -273,13 +273,13 @@ mapelf(Fhdr *fp, u64int base, Map *map, Regs **regs)
if(addseg(map, s) < 0)
return -1;
}
- }
+ }
}
if(fp->nthread && regs)
*regs = coreregs(fp, fp->thread[0].id);
- return 0;
+ return 0;
}
static int
@@ -301,4 +301,3 @@ unpacknote(Elf *elf, uchar *a, uchar *ea, ElfNote *note, uchar **pa)
*pa = a;
return 0;
}
-
diff --git a/src/libmach/crackmacho.c b/src/libmach/crackmacho.c
index 77b0339b..25d1aa7a 100644
--- a/src/libmach/crackmacho.c
+++ b/src/libmach/crackmacho.c
@@ -12,7 +12,7 @@ static struct
Mach *mach;
char *name;
int (*coreregs)(Macho*, uchar**);
-} mtab[] =
+} mtab[] =
{
MachoCpuPower, MPOWER, &machpower, "powerpc", coreregsmachopower,
};
@@ -190,7 +190,7 @@ mapmacho(Fhdr *fp, u64int base, Map *map, Regs **rp)
if((r = mallocz(sizeof *r, 1)) == nil)
return -1;
r->r.rw = _uregrw;
- r->ureg = u;
+ r->ureg = u;
*rp = &r->r;
}
noregs:
diff --git a/src/libmach/demangler.c b/src/libmach/demangler.c
index a2a9b963..c6bb8756 100644
--- a/src/libmach/demangler.c
+++ b/src/libmach/demangler.c
@@ -9,10 +9,10 @@ main(void)
Biobuf b, bout;
char *p, *s;
char buf[100000];
-
+
Binit(&b, 0, OREAD);
Binit(&bout, 1, OWRITE);
-
+
while((p = Brdline(&b, '\n')) != nil){
p[Blinelen(&b)-1] = 0;
werrstr("no error");
diff --git a/src/libmach/dwarf.h b/src/libmach/dwarf.h
index bd0fe56d..31e13900 100644
--- a/src/libmach/dwarf.h
+++ b/src/libmach/dwarf.h
@@ -458,4 +458,3 @@ int dwarfgetinfounit(Dwarf*, ulong, DwarfBlock*);
extern int dwarf386nregs;
extern char *dwarf386regs[];
extern char *dwarf386fp;
-
diff --git a/src/libmach/dwarf386.c b/src/libmach/dwarf386.c
index 3cefeea2..cd13194c 100644
--- a/src/libmach/dwarf386.c
+++ b/src/libmach/dwarf386.c
@@ -5,7 +5,7 @@
#include "dwarf.h"
char*
-dwarf386regs[] =
+dwarf386regs[] =
{
"AX",
"CX",
@@ -18,5 +18,3 @@ dwarf386regs[] =
};
int dwarf386nregs = nelem(dwarf386regs);
-
-
diff --git a/src/libmach/dwarfabbrev.c b/src/libmach/dwarfabbrev.c
index 503d5149..24418ef3 100644
--- a/src/libmach/dwarfabbrev.c
+++ b/src/libmach/dwarfabbrev.c
@@ -2,7 +2,7 @@
* Dwarf abbreviation parsing code.
*
* The convention here is that calling dwarfgetabbrevs relinquishes
- * access to any abbrevs returned previously. Will have to add
+ * access to any abbrevs returned previously. Will have to add
* explicit reference counting if this turns out not to be acceptable.
*/
@@ -129,4 +129,3 @@ dwarfgetabbrev(Dwarf *d, ulong off, ulong num)
}
return findabbrev(a, na, num);
}
-
diff --git a/src/libmach/dwarfaranges.c b/src/libmach/dwarfaranges.c
index 21299588..7e7152d3 100644
--- a/src/libmach/dwarfaranges.c
+++ b/src/libmach/dwarfaranges.c
@@ -60,4 +60,3 @@ dwarfaddrtounit(Dwarf *d, ulong addr, ulong *unit)
werrstr("address 0x%lux is not listed in dwarf debugging symbols", addr);
return -1;
}
-
diff --git a/src/libmach/dwarfcfa.c b/src/libmach/dwarfcfa.c
index 4980c2cf..ee303009 100644
--- a/src/libmach/dwarfcfa.c
+++ b/src/libmach/dwarfcfa.c
@@ -1,11 +1,11 @@
/*
* Dwarf call frame unwinding.
*
- * The call frame unwinding values are encoded using a state machine
- * like the pc<->line mapping, but it's a different machine.
- * The expressions to generate the old values are similar in function to the
+ * The call frame unwinding values are encoded using a state machine
+ * like the pc<->line mapping, but it's a different machine.
+ * The expressions to generate the old values are similar in function to the
* ``dwarf expressions'' used for locations in the code, but of course not
- * the same encoding.
+ * the same encoding.
*/
#include <u.h>
#include <libc.h>
@@ -97,7 +97,7 @@ out:
/*
* XXX This turns out to be much more expensive than the actual
* running of the machine in dexec. It probably makes sense to
- * cache the last 10 or so fde's we've found, since stack traces
+ * cache the last 10 or so fde's we've found, since stack traces
* will keep asking for the same info over and over.
*/
static int
@@ -167,7 +167,7 @@ findfde(Dwarf *d, ulong pc, State *s, DwarfBuf *fde)
}
werrstr("cannot find call frame information for pc 0x%lux", pc);
return -1;
-
+
}
static int
@@ -209,7 +209,7 @@ dexec(DwarfBuf *b, State *s, int locstop)
if(locstop)
return 0;
continue;
-
+
case 2: /* offset rule */
arg1 = c&0x3F;
arg2 = dwarfget128(b);
@@ -331,12 +331,12 @@ dexec(DwarfBuf *b, State *s, int locstop)
s->cfa->offset = arg2;
continue;
- case 0x0D: /* def cfa register */
+ case 0x0D: /* def cfa register */
arg1 = dwarfget128(b);
if(trace) fprint(2, "cfa reg r%ld\n", arg1);
if(s->cfa->type != RuleRegOff){
werrstr("change CFA register but CFA not in register+offset form");
- return -1;
+ return -1;
}
if(checkreg(s, arg1) < 0)
return -1;
@@ -390,6 +390,5 @@ dexec(DwarfBuf *b, State *s, int locstop)
return -1;
}
}
- /* not reached */
+ /* not reached */
}
-
diff --git a/src/libmach/dwarfeval.c b/src/libmach/dwarfeval.c
index 30c227b3..30e68c2d 100644
--- a/src/libmach/dwarfeval.c
+++ b/src/libmach/dwarfeval.c
@@ -59,4 +59,3 @@
OpCall4 = 0x99, /* 4-byte offset of DIE */
OpCallRef = 0x9A, /* 4- or 8- byte offset of DIE */
/* 0xE0-0xFF reserved for user-specific */
-
diff --git a/src/libmach/dwarfget.c b/src/libmach/dwarfget.c
index 3e9fe650..fd3ec817 100644
--- a/src/libmach/dwarfget.c
+++ b/src/libmach/dwarfget.c
@@ -215,4 +215,3 @@ dwarfget128s(DwarfBuf *b)
}
return v;
}
-
diff --git a/src/libmach/dwarfinfo.c b/src/libmach/dwarfinfo.c
index 4c0eacd8..d6c2b79e 100644
--- a/src/libmach/dwarfinfo.c
+++ b/src/libmach/dwarfinfo.c
@@ -128,7 +128,7 @@ dwarflookupnameinunit(Dwarf *d, ulong unit, char *name, DwarfSym *s)
werrstr("symbol '%s' not found", name);
return -1;
}
-
+
int
dwarflookupsubname(Dwarf *d, DwarfSym *parent, char *name, DwarfSym *s)
@@ -183,7 +183,7 @@ dwarflookupfn(Dwarf *d, ulong unit, ulong pc, DwarfSym *s)
continue;
if(s->attrs.lowpc <= pc && pc < s->attrs.highpc)
return 0;
- }
+ }
werrstr("fn containing pc 0x%lux not found", pc);
return -1;
}
@@ -291,11 +291,11 @@ dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
}
/*
- * The funny game with t and s make sure that
+ * The funny game with t and s make sure that
* if we get to the end of a run of a particular
* depth, we leave s so that a call to nextsymat with depth-1
* will actually produce the desired guy. We could change
- * the interface to dwarfnextsym instead, but I'm scared
+ * the interface to dwarfnextsym instead, but I'm scared
* to touch it.
*/
t = *s;
diff --git a/src/libmach/dwarfopen.c b/src/libmach/dwarfopen.c
index 728944f4..27e965a3 100644
--- a/src/libmach/dwarfopen.c
+++ b/src/libmach/dwarfopen.c
@@ -30,7 +30,7 @@ findsection(Elf *elf, char *name, ulong *off, ulong *len)
*len = s->size;
return s - elf->sect;
}
-
+
static int
loadsection(Elf *elf, char *name, DwarfBlock *b)
{
diff --git a/src/libmach/dwarfpc.c b/src/libmach/dwarfpc.c
index 31b6bb41..628b3eb8 100644
--- a/src/libmach/dwarfpc.c
+++ b/src/libmach/dwarfpc.c
@@ -1,6 +1,6 @@
/*
* Dwarf pc to source line conversion.
- *
+ *
* Maybe should do the reverse here, but what should the interface look like?
* One possibility is to use the Plan 9 line2addr interface:
*
diff --git a/src/libmach/elf.c b/src/libmach/elf.c
index 5b7494d9..b3cb9e8c 100644
--- a/src/libmach/elf.c
+++ b/src/libmach/elf.c
@@ -343,7 +343,7 @@ unpackhdr(ElfHdr *h, void *v)
h->e2 = e2;
h->e4 = e4;
h->e8 = e8;
-
+
if(h->class == ElfClass64)
goto b64;
@@ -388,7 +388,7 @@ unpackprog(ElfHdr *h, ElfProg *p, void *v)
if(h->class == ElfClass32) {
ElfProgBytes *b;
-
+
b = v;
e4 = h->e4;
p->type = e4(b->type);
@@ -401,7 +401,7 @@ unpackprog(ElfHdr *h, ElfProg *p, void *v)
p->align = e4(b->align);
} else {
ElfProgBytes64 *b;
-
+
b = v;
e4 = h->e4;
e8 = h->e8;
@@ -424,7 +424,7 @@ unpacksect(ElfHdr *h, ElfSect *s, void *v)
if(h->class == ElfClass32) {
ElfSectBytes *b;
-
+
b = v;
e4 = h->e4;
s->name = (char*)(uintptr)e4(b->name);
@@ -439,7 +439,7 @@ unpacksect(ElfHdr *h, ElfSect *s, void *v)
s->entsize = e4(b->entsize);
} else {
ElfSectBytes64 *b;
-
+
b = v;
e4 = h->e4;
e8 = h->e8;
@@ -554,4 +554,3 @@ elfsym(Elf *elf, int i, ElfSym *sym)
werrstr("symbol index out of range");
return -1;
}
-
diff --git a/src/libmach/elfcorefreebsd386.c b/src/libmach/elfcorefreebsd386.c
index 0d01d969..bd146784 100644
--- a/src/libmach/elfcorefreebsd386.c
+++ b/src/libmach/elfcorefreebsd386.c
@@ -117,4 +117,3 @@ corecmdfreebsd386(Elf *elf, ElfNote *note, char **pp)
*pp = t;
return 0;
}
-
diff --git a/src/libmach/elfcorefreebsdamd64.c b/src/libmach/elfcorefreebsdamd64.c
index fde6514f..a5fc6ed7 100644
--- a/src/libmach/elfcorefreebsdamd64.c
+++ b/src/libmach/elfcorefreebsdamd64.c
@@ -83,7 +83,7 @@ elfcorefreebsdamd64(Fhdr *fp, Elf *elf, ElfNote *note)
}
l = &s->reg;
u = malloc(sizeof(Ureg));
-
+
/* no byte order problems - just copying and rearranging */
u->ax = l->rax;
u->bx = l->rbx;
@@ -100,12 +100,12 @@ elfcorefreebsdamd64(Fhdr *fp, Elf *elf, ElfNote *note)
u->r13 = l->r13;
u->r14 = l->r14;
u->r15 = l->r15;
-
+
u->ds = l->ds;
u->es = l->es;
u->fs = l->fs;
u->gs = l->gs;
-
+
u->type = l->trapno;
u->error = l->err;
u->ip = l->rip;
@@ -147,4 +147,3 @@ corecmdfreebsd386(Elf *elf, ElfNote *note, char **pp)
*pp = t;
return 0;
}
-
diff --git a/src/libmach/elfcorelinux386.c b/src/libmach/elfcorelinux386.c
index 6cd0a5f9..d3293288 100644
--- a/src/libmach/elfcorelinux386.c
+++ b/src/libmach/elfcorelinux386.c
@@ -12,8 +12,8 @@ typedef struct Status Status;
typedef struct Psinfo Psinfo;
/*
- * UregLinux386 is 64-bit aligned within status, so we shouldn't
- * have any packing problems.
+ * UregLinux386 is 64-bit aligned within status, so we shouldn't
+ * have any packing problems.
*/
struct Status
{
@@ -158,7 +158,7 @@ elfcorelinux386(Fhdr *fp, Elf *elf, ElfNote *note)
(uint)m->swap4(st->sighold));
dprint("pid=%ud ppid=%ud pgrp=%ud sid=%ud\n",
(uint)m->swap4(st->pid),
- (uint)m->swap4(st->ppid),
+ (uint)m->swap4(st->ppid),
(uint)m->swap4(st->pgrp),
(uint)m->swap4(st->sid));
dprint("utime=%ud.%06ud stime=%ud.%06ud cutime=%ud.%06ud cstime=%ud.%06ud\n",
@@ -199,4 +199,3 @@ elfcorelinux386(Fhdr *fp, Elf *elf, ElfNote *note)
dprint("note %d\n", note->type);
}
}
-
diff --git a/src/libmach/elfdl386.c b/src/libmach/elfdl386.c
index fc4e37fb..a67ed13c 100644
--- a/src/libmach/elfdl386.c
+++ b/src/libmach/elfdl386.c
@@ -131,4 +131,3 @@ elfdl386mapdl(int verbose)
fprint(2, "syminit %s: %r\n", buf);
}
}
-
diff --git a/src/libmach/elfdynsym.c b/src/libmach/elfdynsym.c
index 06bb41a6..0f3a974c 100644
--- a/src/libmach/elfdynsym.c
+++ b/src/libmach/elfdynsym.c
@@ -3,4 +3,4 @@
#include "elf.h"
int
-elfsym(Elf *elf, ElfSect *symtab, ElfSect *strtab, int ndx, ElfSym * \ No newline at end of file
+elfsym(Elf *elf, ElfSect *symtab, ElfSect *strtab, int ndx, ElfSym *
diff --git a/src/libmach/fpformat.c b/src/libmach/fpformat.c
index a94a096a..c76cca3e 100644
--- a/src/libmach/fpformat.c
+++ b/src/libmach/fpformat.c
@@ -35,7 +35,7 @@ fpformat(Map *map, Regdesc *rp, char *buf, uint n, uint modif)
if (rp->format == 'F')
return 1;
return 2;
- }
+ }
/* treat it like 'f' */
if (get1(map, rp->offset, (uchar *)reg, 4) < 0)
return -1;
diff --git a/src/libmach/frame.c b/src/libmach/frame.c
index 2b7f8b30..53450805 100644
--- a/src/libmach/frame.c
+++ b/src/libmach/frame.c
@@ -49,13 +49,13 @@ stacktrace(Map *map, Regs *regs, Tracer trace)
next = malloc(mach->nwindreg*sizeof(cur[0]));
if(cur==nil || next==nil)
goto out;
-
+
/*
* Initialize current registers using regs.
*/
if(rget(regs, mach->pc, &pc) < 0){
werrstr("cannot fetch initial pc: %r");
- goto out;
+ goto out;
}
for(i=0; i<mach->nwindreg; i++){
diff --git a/src/libmach/hexify.c b/src/libmach/hexify.c
index b095e8ff..cf8537ef 100644
--- a/src/libmach/hexify.c
+++ b/src/libmach/hexify.c
@@ -17,4 +17,3 @@ _hexify(char *buf, u64int p, int zeros)
*buf++ = "0123456789abcdef"[p&0x0f];
return buf;
}
-
diff --git a/src/libmach/loc.c b/src/libmach/loc.c
index 9d5dc857..00ce2e68 100644
--- a/src/libmach/loc.c
+++ b/src/libmach/loc.c
@@ -271,4 +271,3 @@ locsimplify(Map *map, Regs *regs, Loc loc, Loc *newloc)
*newloc = loc;
return 0;
}
-
diff --git a/src/libmach/mach386.c b/src/libmach/mach386.c
index 336cec35..10925630 100644
--- a/src/libmach/mach386.c
+++ b/src/libmach/mach386.c
@@ -128,10 +128,10 @@ Mach mach386 =
};
/*
- * The wrapper code around Linux system calls
+ * The wrapper code around Linux system calls
* saves AX on the stack before calling some calls
- * (at least, __libc_nanosleep), when running in
- * threaded programs.
+ * (at least, __libc_nanosleep), when running in
+ * threaded programs.
*/
static void
syscallhack(Map *map, Regs *regs, int *spoff)
@@ -146,7 +146,7 @@ syscallhack(Map *map, Regs *regs, int *spoff)
return;
if(i386das(map, pc+2, 0, buf, sizeof buf) != 3 || strcmp(buf, "XCHGL\tAX,0(SP)") != 0)
return;
- *spoff += 4;
+ *spoff += 4;
}
int
@@ -1968,14 +1968,14 @@ plocal(Instr *ip)
Symbol s;
char *name;
Loc l, li;
-
+
l.type = LOFFSET;
l.offset = ip->disp;
if(ip->base == SP)
l.reg = "SP";
else
l.reg = "BP";
-
+
li.type = LADDR;
li.addr = ip->addr;
if(findsym(li, CTEXT, &s) < 0)
@@ -1989,7 +1989,7 @@ plocal(Instr *ip)
if(name==nil && findlsym(&s, l, &s) >= 0)
name = s.name;
-
+
if(name)
bprint(ip, "%s+", name);
diff --git a/src/libmach/machamd64.c b/src/libmach/machamd64.c
index f220ebcf..d10257c8 100644
--- a/src/libmach/machamd64.c
+++ b/src/libmach/machamd64.c
@@ -171,10 +171,10 @@ Mach machamd64=
4, /* szreg */
4, /* szfloat */
8, /* szdouble */
-
+
amd64windregs, /* locations unwound in stack trace */
17,
-
+
{0xCC, 0, 0, 0}, /* break point: INT 3 */
1, /* break point size */
diff --git a/src/libmach/macho.c b/src/libmach/macho.c
index 38cb2374..ce74bcbb 100644
--- a/src/libmach/macho.c
+++ b/src/libmach/macho.c
@@ -4,7 +4,7 @@
#include "macho.h"
/*
-http://www.channelu.com/NeXT/NeXTStep/3.3/nd/DevTools/14_MachO/MachO.htmld/
+http://www.channelu.com/NeXT/NeXTStep/3.3/nd/DevTools/14_MachO/MachO.htmld/
*/
Macho*
@@ -144,7 +144,7 @@ macholoadrel(Macho *m, MachoSect *sect)
uchar *buf, *p;
int i, n;
uint32 v;
-
+
if(sect->rel != nil || sect->nreloc == 0)
return 0;
rel = mallocz(sect->nreloc * sizeof r[0], 1);
@@ -165,7 +165,7 @@ macholoadrel(Macho *m, MachoSect *sect)
r = &rel[i];
p = buf+i*8;
r->addr = m->e4(p);
-
+
// TODO(rsc): Wrong interpretation for big-endian bitfields?
v = m->e4(p+4);
r->symnum = v & 0xFFFFFF;
@@ -183,7 +183,7 @@ macholoadrel(Macho *m, MachoSect *sect)
return 0;
}
-int
+int
macholoadsym(Macho *m, MachoSymtab *symtab)
{
char *strbuf;
@@ -202,7 +202,7 @@ macholoadsym(Macho *m, MachoSymtab *symtab)
free(strbuf);
return -1;
}
-
+
symsize = 12;
if(m->is64)
symsize = 16;
diff --git a/src/libmach/macho.h b/src/libmach/macho.h
index 2b449f04..3537c0fc 100644
--- a/src/libmach/macho.h
+++ b/src/libmach/macho.h
@@ -62,7 +62,7 @@ struct MachoSect
uint32 reloff;
uint32 nreloc;
uint32 flags;
-
+
MachoRel *rel;
};
@@ -82,7 +82,7 @@ struct MachoSymtab
uint32 nsym;
uint32 stroff;
uint32 strsize;
-
+
char *str;
MachoSym *sym;
};
diff --git a/src/libmach/machocorepower.c b/src/libmach/machocorepower.c
index 9cd06afb..89fc564f 100644
--- a/src/libmach/machocorepower.c
+++ b/src/libmach/machocorepower.c
@@ -170,4 +170,3 @@ coreregsmachopower(Macho *m, uchar **up)
*up = (uchar*)u;
return sizeof(*u);
}
-
diff --git a/src/libmach/machpower.c b/src/libmach/machpower.c
index 2799f37a..dd26e45a 100644
--- a/src/libmach/machpower.c
+++ b/src/libmach/machpower.c
@@ -960,7 +960,7 @@ static Spr sprname[] = {
{26, "SRR0"},
{27, "SRR1"},
{284, "TBLW"},
- {285, "TBUW"},
+ {285, "TBUW"},
{22, "DEC"},
{282, "EAR"},
{1008, "HID0"},
@@ -1213,7 +1213,7 @@ powerfoll(Map *map, Regs *regs, u64int pc, u64int *foll)
if(!i.aa)
foll[0] += pc;
break;
-
+
case 16: /* conditional branch */
foll[0] = i.bd;
if(!i.aa)
@@ -1246,7 +1246,7 @@ powerfoll(Map *map, Regs *regs, u64int pc, u64int *foll)
#define FP_REG(x) (R31+4+8*(x))
#define REGSIZE sizeof(struct Ureg)
-#define FPREGSIZE (8*33)
+#define FPREGSIZE (8*33)
Regdesc powerreglist[] =
{
@@ -1328,7 +1328,7 @@ Regdesc powerreglist[] =
{ 0 }
};
-static char *powerwindregs[] =
+static char *powerwindregs[] =
{
"PC",
"SP",
@@ -1404,4 +1404,3 @@ Mach machpower =
powerhexinst, /* print instruction */
powerinstlen, /* instruction size calculation */
};
-
diff --git a/src/libmach/mangle.c b/src/libmach/mangle.c
index 852a29ea..5bf49c9d 100644
--- a/src/libmach/mangle.c
+++ b/src/libmach/mangle.c
@@ -3,19 +3,19 @@
#include <bio.h>
#include <mach.h>
-static char *(*demanglers[])(char*, char*) =
+static char *(*demanglers[])(char*, char*) =
{
demanglegcc2,
demanglegcc3,
};
-
+
char*
demangle(char *s, char *buf, int strip)
{
char *t;
char *r, *w;
int i, nangle, nparen;
-
+
t = nil;
for(i=0; i<nelem(demanglers); i++){
t = demanglers[i](s, buf);
diff --git a/src/libmach/manglegcc2.c b/src/libmach/manglegcc2.c
index 9dae425b..66231637 100644
--- a/src/libmach/manglegcc2.c
+++ b/src/libmach/manglegcc2.c
@@ -63,7 +63,7 @@ static Chartab modifiertab[] =
'S', "signed", /* means static for member functions */
'U', "unsigned",
'V', "volatile",
-
+
'G', "garbage", /* no idea what this is */
0, 0
};
@@ -86,7 +86,7 @@ demanglegcc2(char *s, char *buf)
{
char *name, *os, *p, *t;
int isfn, namelen;
-
+
/*
* Pick off some cases that seem not to fit the pattern.
@@ -119,22 +119,22 @@ demanglegcc2(char *s, char *buf)
isfn = 1;
name = gdestructor;
namelen = strlen(name);
- s += 13;
+ s += 13;
}else if(memcmp(s, "_GLOBAL_.D._", 12) == 0){
isfn = 0;
name = gdestructor;
namelen = strlen(name);
- s += 12;
+ s += 12;
}else if(memcmp(s, "_GLOBAL_.I.__", 13) == 0){
isfn = 1;
name = gconstructor;
namelen = strlen(name);
- s += 13;
+ s += 13;
}else if(memcmp(s, "_GLOBAL_.I._", 12) == 0){
isfn = 0;
name = gconstructor;
namelen = strlen(name);
- s += 12;
+ s += 12;
}else{
t = strstr(os, "__");
if(t == nil)
@@ -144,7 +144,7 @@ demanglegcc2(char *s, char *buf)
if(strchr(manglestarts, *(s+2)))
break;
}while((t = strstr(s+1, "__")) != nil);
-
+
name = os;
namelen = s - os;
if(namelen == 0){
@@ -154,14 +154,14 @@ demanglegcc2(char *s, char *buf)
}
s += 2;
}
-
+
/*
* Now s points at the mangled crap (maybe).
* and name is the final element of the name.
*/
if(strchr(manglestarts, *s) == nil)
return os;
-
+
p = buf;
if(*s == 'F'){
/* global function, no extra name pieces, just types */
@@ -173,7 +173,7 @@ demanglegcc2(char *s, char *buf)
fprint(2, "parsename %s: %r\n", s);
return os;
}
-
+
/* if we have a constructor or destructor, try to use the C++ name */
t = nil;
if(name == constructor || name == destructor){
@@ -197,7 +197,7 @@ demanglegcc2(char *s, char *buf)
p -= 2;
memmove(p, name, namelen);
p += namelen;
-
+
if(*s == 'F'){
/* might be from above, or might follow name pieces */
s++;
@@ -219,8 +219,8 @@ demanglegcc2(char *s, char *buf)
if(*s == '_'){
/* return type (left over from H) */
- }
-
+ }
+
*p = 0;
return buf;
}
@@ -234,7 +234,7 @@ static char*
demanglegcc2a(char *s, char *buf)
{
char *p;
-
+
if(*s != '_' || strchr(manglestarts, *(s+1)) == nil)
return nil;
p = buf;
@@ -259,7 +259,7 @@ demanglegcc2b(char *s, char *buf)
{
char *p;
char *t;
-
+
if(memcmp(s, "__ti", 4) == 0){
t = "$typeinfo";
s += 4;
@@ -325,7 +325,7 @@ gccnumber(char **ps, int *pn, int many)
{
char *s;
int n, eatunderscore;
-
+
s = *ps;
eatunderscore = 0;
if(!many && *s == '_'){
@@ -362,7 +362,7 @@ gccname(char **ps, char **pp)
{
int i, n, m, val;
char *os, *s, *t, *p, *p0, *p1;
-
+
s = *ps;
os = s;
p = *pp;
@@ -376,7 +376,7 @@ gccname(char **ps, char **pp)
p += strlen(t);
goto out;
}
-
+
/* modifiers */
if((t = chartabsearch(modifiertab, *s)) != nil){
s++;
@@ -394,7 +394,7 @@ gccname(char **ps, char **pp)
*/
goto out;
}
-
+
switch(*s){
default:
bad:
@@ -546,7 +546,7 @@ gccname(char **ps, char **pp)
if(!gccname(&s, &p))
return 0;
break;
-
+
case 'Q': /* qualified name */
s++;
if(!gccnumber(&s, &n, 0))
@@ -601,7 +601,7 @@ gccname(char **ps, char **pp)
}
*p++ = '>';
break;
-
+
case 'T': /* once-repeated type */
s++;
if(!gccnumber(&s, &n, 0))
@@ -609,7 +609,7 @@ gccname(char **ps, char **pp)
sprint(p, "T%d", n);
p += strlen(p);
break;
-
+
case 'X': /* type parameter in 'H' */
if(!isdigit((uchar)*(s+1)) || !isdigit((uchar)*(s+2)))
goto bad;
@@ -622,9 +622,8 @@ gccname(char **ps, char **pp)
USED(p1);
USED(p0);
-out:
+out:
*ps = s;
*pp = p;
return 1;
}
-
diff --git a/src/libmach/manglegcc3.c b/src/libmach/manglegcc3.c
index eca26eb1..c0e73758 100644
--- a/src/libmach/manglegcc3.c
+++ b/src/libmach/manglegcc3.c
@@ -34,14 +34,14 @@ demanglegcc3(char *s, char *buf)
{
char *p, *os;
Gccstate state;
-
+
state.nname = 0;
os = s;
/* mangled names always start with _Z */
if(s[0] != '_' || s[1] != 'Z')
return s;
s += 2;
-
+
p = buf;
if(!gccname(&s, &p, &state)){
if(strchr(os, '@') == nil)
@@ -138,7 +138,7 @@ static struct {
"rs", ">>", "rsh",
"st", "sizeof", "sizeoftype",
"sz", "sizeof", "sizeofexpr",
-
+
0,0,0
};
@@ -153,7 +153,7 @@ gccname(char **ps, char **pp, Gccstate *state)
int i, n;
char *os, *s, *t, *p;
Gccstate nstate;
-
+
s = *ps;
os = s;
p = *pp;
@@ -170,7 +170,7 @@ gccname(char **ps, char **pp, Gccstate *state)
goto suffix;
}
}
-
+
/* basic types */
if((t = chartabsearch(typetab, *s)) != nil){
s++;
@@ -178,7 +178,7 @@ gccname(char **ps, char **pp, Gccstate *state)
p += strlen(t);
goto suffix;
}
-
+
switch(*s){
default:
bad:
@@ -245,7 +245,7 @@ gccname(char **ps, char **pp, Gccstate *state)
p -= 2;
s++;
break;
-
+
case 'P': /* pointer to */
s++;
if(!gccname(&s, &p, state))
@@ -282,7 +282,7 @@ gccname(char **ps, char **pp, Gccstate *state)
s += 2;
break;
}
-
+
/* standard name */
if(*s == 't'){
strcpy(p, "std::");
@@ -300,7 +300,7 @@ gccname(char **ps, char **pp, Gccstate *state)
*p++ = *s++;
}
break;
-
+
case 'T': /* previously-seen type??? T0_ also T_*/
t = s;
for(; *s != '_'; s++){
@@ -312,9 +312,9 @@ gccname(char **ps, char **pp, Gccstate *state)
s++;
memmove(p, t, s-t);
p += s-t;
- break;
+ break;
}
-
+
suffix:
if(*s == 'I'){
/* template suffix */
@@ -336,4 +336,3 @@ suffix:
*pp = p;
return 1;
}
-
diff --git a/src/libmach/map.c b/src/libmach/map.c
index 392efbed..db8c15fc 100644
--- a/src/libmach/map.c
+++ b/src/libmach/map.c
@@ -281,7 +281,7 @@ fdrw(Map *map, Seg *seg, u64int addr, void *a, uint n, int r)
else
nn = pwrite(seg->fd, a, n-tot, off+tot);
if(nn < 0)
- return -1;
+ return -1;
if(nn == 0){
werrstr("partial %s at address 0x%lux in %s",
r ? "read" : "write", off+tot, seg->file);
diff --git a/src/libmach/regs.c b/src/libmach/regs.c
index 07616c1f..cdab6108 100644
--- a/src/libmach/regs.c
+++ b/src/libmach/regs.c
@@ -59,4 +59,3 @@ _uregrw(Regs *regs, char *name, u64int *u, int isr)
return 0;
}
}
-
diff --git a/src/libmach/stabs.c b/src/libmach/stabs.c
index 18805a51..91950657 100644
--- a/src/libmach/stabs.c
+++ b/src/libmach/stabs.c
@@ -51,4 +51,3 @@ stabsym(Stab *stabs, int i, StabSym *sym)
sym->value = stabs->e4(p+8);
return 0;
}
-
diff --git a/src/libmach/stabs.h b/src/libmach/stabs.h
index ad67cfe6..4743f780 100644
--- a/src/libmach/stabs.h
+++ b/src/libmach/stabs.h
@@ -114,4 +114,3 @@ X function return variable
*/
int stabsym(Stab*, int, StabSym*);
-
diff --git a/src/libmach/sym.c b/src/libmach/sym.c
index 6369cdd1..b165e125 100644
--- a/src/libmach/sym.c
+++ b/src/libmach/sym.c
@@ -296,7 +296,7 @@ ffindsym(Fhdr *fhdr, Loc loc, uint class)
* We want to find the largest index i such that
* a[i] <= loc. This cannot be done with a simple
* binary search. Instead we binary search to find
- * where the location should be.
+ * where the location should be.
*/
lo = 0;
hi = n;
@@ -529,7 +529,7 @@ symopen(Fhdr *hdr)
hdr->byname[i] = &hdr->sym[i];
qsort(hdr->byname, hdr->nsym, sizeof(hdr->byname[0]), bynamecmp);
}
-
+
hdr->byxname = malloc(hdr->nsym*sizeof(hdr->byxname[0]));
if(hdr->byxname == nil){
fprint(2, "could not allocate table to sort by xname\n");
@@ -581,4 +581,3 @@ _addsym(Fhdr *fp, Symbol *sym)
*s = *sym;
return s;
}
-
diff --git a/src/libmach/symdwarf.c b/src/libmach/symdwarf.c
index 4552b034..49a66dad 100644
--- a/src/libmach/symdwarf.c
+++ b/src/libmach/symdwarf.c
@@ -79,7 +79,7 @@ top:
name, unit, tref);
return 0;
}
-
+
if(ds.attrs.have.bytesize)
return ds.attrs.bytesize;
@@ -230,7 +230,7 @@ dwarftosym(Fhdr *fp, Dwarf *d, DwarfSym *ds, Symbol *s, int infn)
{
DwarfBuf buf;
DwarfBlock b;
-
+
memset(s, 0, sizeof *s);
s->u.dwarf.uoff = ds->uoff;
s->u.dwarf.unit = ds->unit;
@@ -356,7 +356,7 @@ dwarfeval(Dwarf *d, Map *map, Regs *regs, ulong cfa, int rno, DwarfExpr e, u64in
if(rget(regs, regname(d, e.reg), &uu) < 0)
return -1;
if(get4(map, uu+e.offset, &u4) < 0)
- return -1;
+ return -1;
*u = u4;
return 0;
case RuleLocation:
@@ -465,4 +465,3 @@ err:
free(e);
return -1;
}
-
diff --git a/src/libmach/symelf.c b/src/libmach/symelf.c
index 40dec113..dd1752eb 100644
--- a/src/libmach/symelf.c
+++ b/src/libmach/symelf.c
@@ -118,4 +118,3 @@ symelf(Fhdr *fhdr)
ret = 0;
return ret;
}
-
diff --git a/src/libmach/symmacho.c b/src/libmach/symmacho.c
index 674190ff..89e87fe7 100644
--- a/src/libmach/symmacho.c
+++ b/src/libmach/symmacho.c
@@ -47,4 +47,3 @@ symmacho(Fhdr *fp)
}
return ret;
}
-
diff --git a/src/libmach/symstabs.c b/src/libmach/symstabs.c
index e253f023..9afa4c16 100644
--- a/src/libmach/symstabs.c
+++ b/src/libmach/symstabs.c
@@ -112,7 +112,7 @@ stabcvtsym(StabSym *stab, Symbol *sym, char *dir, char *file, int i)
}
break;
}
- return 0;
+ return 0;
}
static int
@@ -209,15 +209,15 @@ stabssyminit(Fhdr *fp)
if(fun->u.stabs.frameptr == -1){
/*
* Try to distinguish functions with a real frame pointer
- * from functions with a virtual frame pointer, based on
+ * from functions with a virtual frame pointer, based on
* whether the first parameter is in the right location and
- * whether the autos have negative offsets.
- *
+ * whether the autos have negative offsets.
+ *
* This heuristic works most of the time. On the 386, we
* cannot distinguish between a v. function with no autos
* but a frame of size 4 and a f.p. function with no autos and
* no frame. Anything else we'll get right.
- *
+ *
* Another way to go about this would be to have
* mach-specific functions to inspect the function
* prologues when we're not sure. What we have
diff --git a/src/libmach/t.c b/src/libmach/t.c
index 37d4b505..0322dc35 100644
--- a/src/libmach/t.c
+++ b/src/libmach/t.c
@@ -97,7 +97,7 @@ printparams(Symbol *fn, Regs *regs)
int first = 0;
ulong pc, sp, bp;
- if(0) print("pc=%lux sp=%lux bp=%lux ",
+ if(0) print("pc=%lux sp=%lux bp=%lux ",
(rget(regs, "PC", &pc), pc),
(rget(regs, "SP", &sp), sp),
(rget(regs, "BP", &bp), bp));
@@ -180,7 +180,7 @@ main(int argc, char **argv)
if((e = td_thr_get_info(&ts[i], &info)) != TD_OK)
sysfatal("td_thr_get_info: %s", terr(e));
print("%d: startfunc=%lux stkbase=%lux pc=%lux sp=%lux lid=%d\n",
- i, info.ti_startfunc, info.ti_stkbase, info.ti_pc, info.ti_sp, info.ti_lid);
+ i, info.ti_startfunc, info.ti_stkbase, info.ti_pc, info.ti_sp, info.ti_lid);
if((e = td_thr_getgregs(&ts[i], regs)) != TD_OK)
sysfatal("td_thr_getregs: %s", terr(e));
print("%d: pc=%lux sp=%lux gs=%lux\n", i, regs[12], regs[15], regs[10]);
@@ -233,7 +233,7 @@ td_get_allthreads(td_thragent_t *ta, td_thrhandle_t **pall)
a.a = nil;
a.n = 0;
a.err = 0;
- if((e = td_ta_thr_iter(ta, thritercb, &a,
+ if((e = td_ta_thr_iter(ta, thritercb, &a,
TD_THR_ANY_STATE,
TD_THR_LOWEST_PRIORITY,
TD_SIGNO_MASK,
@@ -251,7 +251,7 @@ td_get_allthreads(td_thragent_t *ta, td_thrhandle_t **pall)
return a.n;
}
-/*
+/*
td_err_e td_ta_map_id2thr(const td_thragent_t *ta_p, thread_t tid,td_thrhandle_t *th_p);
*/
diff --git a/src/libmach/ureg386.c b/src/libmach/ureg386.c
index b2df1fe7..06770d2d 100644
--- a/src/libmach/ureg386.c
+++ b/src/libmach/ureg386.c
@@ -48,4 +48,3 @@ ureg2linux386(Ureg *u, UregLinux386 *l)
l->esp = u->sp;
l->xss = u->ss;
}
-