62 addlist(List *l, List *r)
69 for(f = l; f->next; f = f->next)
77 append(Node *r, Node *list, Node *val)
82 l->Store = val->Store;
93 for(f = list->l; f->next; f = f->next)
100 listcmp(List *l, List *r)
108 if(l->type != r->type)
112 if(l->ival != r->ival)
116 if(l->fval != r->fval)
120 if(scmp(l->string, r->string) == 0)
124 if(listcmp(l->l, r->l) == 0)
137 nthelem(List *l, int n, Node *res)
140 error("negative index in []");
152 res->Store = l->Store;
156 delete(List *l, int n, Node *res)
161 error("negative index in delete");
167 for(tl = &res->l; l && n--; l = l->next)
171 error("element beyond end of list");
176 listvar(char *s, vlong v)
185 l->string = strnode(s);
195 listlocals(Map *map, Symbol *fn, uvlong fp)
206 for(i = 0; localsym(&s, i); i++) {
212 if(geta(map, fp-s.value, &val) > 0) {
213 *tail = listvar(s.name, val);
214 tail = &(*tail)->next;
221 listparams(Map *map, Symbol *fn, uvlong fp)
230 fp += mach->szaddr; /* skip saved pc */
232 for(i = 0; localsym(&s, i); i++) {
233 if (s.class != CPARAM)
236 if(geta(map, fp+s.value, &v) > 0) {
237 *tail = listvar(s.name, v);
238 tail = &(*tail)->next;
245 trlist(Map *map, uvlong pc, uvlong sp, Symbol *sym)
251 if (tracelist == 0) { /* first time */
252 tracelist = al(TLIST);
260 l = al(TINT); /* Function address */
262 l->ival = sym->value;
265 l->next = al(TINT); /* called from address */
270 l->next = al(TLIST); /* make list of params */
272 l->l = listparams(map, sym, sp);
274 l->next = al(TLIST); /* make list of locals */
276 l->l = listlocals(map, sym, sp);