|
|
@@ -41,11 +41,11 @@ __arch int interp_dump(int);
|
|
|
__arch int interp_set_var(char *name, long value, int attr);
|
|
|
__arch int interp_import_shared(char *name);
|
|
|
|
|
|
+extern struct klist_node *find_name(char *name);
|
|
|
|
|
|
extern char *psave;
|
|
|
|
|
|
-struct klist_node stack = KLIST_NODE_INIT(&stack),
|
|
|
- libs = KLIST_NODE_INIT(&libs);
|
|
|
+struct klist_node libs = KLIST_NODE_INIT(&libs);
|
|
|
extern struct klist_node names_list;
|
|
|
|
|
|
|
|
|
@@ -66,19 +66,8 @@ __arch int interp_init(void) {
|
|
|
|
|
|
|
|
|
|
|
|
-static struct klist_node *find_name(char *name) {
|
|
|
- struct klist_node *n;
|
|
|
-
|
|
|
- for (n = stack.next; n != &stack; n = n->next)
|
|
|
- if (!strcmp(n->payload, name))
|
|
|
- return n;
|
|
|
-
|
|
|
- return NULL;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
__arch int interp_new_var(char *name, long value, int attr) {
|
|
|
- push_nr(value, name, attr);
|
|
|
+ __push_nr(&names_list, value, name, attr);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -100,24 +89,6 @@ __arch int interp_set_var(char *name, long value, int attr) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-__arch static int interp_stack_dump(void) {
|
|
|
- struct klist_node *n;
|
|
|
- int i;
|
|
|
-
|
|
|
- ansi_csi_st(stdout, MODE_HIGHLIGHT, FG_LIGHTBLUE, BG_BLACK);
|
|
|
-
|
|
|
- printf("stack dump: \n");
|
|
|
-
|
|
|
- ansi_csi_ed(stdout);
|
|
|
-
|
|
|
- for (i = 0, n = stack.next; n != &stack; n = n->next, i++)
|
|
|
- printf("\t%3d: %s \t%ld @ %08x\n", i, (char *) n->payload, n->value, n->xmask);
|
|
|
-
|
|
|
- printf("\n");
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
#define NAMES_VARS 1
|
|
|
#define NAMES_FNS 2
|
|
|
#define NAMES_ANY 3
|
|
|
@@ -149,9 +120,14 @@ __arch static int interp_names_dump(int names) {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (!(n->value & DECLARE_FN) && (names & NAMES_VARS))
|
|
|
+ if (!(n->value & DECLARE_FN) && (names & NAMES_VARS)) {
|
|
|
/* variables */
|
|
|
- printf("\t var %s\n", (char *)n->payload);
|
|
|
+ if (n->xmask & XMASK_WEAK)
|
|
|
+ printf("\t var %s\n", (char *) n->payload);
|
|
|
+
|
|
|
+ else
|
|
|
+ printf("\t var %s: %ld\n", (char *) n->payload, n->value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
printf("\n");
|
|
|
@@ -179,9 +155,9 @@ __arch static int interp_libs_dump(void) {
|
|
|
|
|
|
|
|
|
__arch int interp_dump(int attr) {
|
|
|
- if (!attr || attr == 32) {
|
|
|
+ if (!attr || attr == 16) {
|
|
|
/* dump all */
|
|
|
- interp_stack_dump();
|
|
|
+
|
|
|
interp_names_dump(NAMES_ANY);
|
|
|
interp_libs_dump();
|
|
|
|
|
|
@@ -189,18 +165,15 @@ __arch int interp_dump(int attr) {
|
|
|
}
|
|
|
|
|
|
if (attr & 1)
|
|
|
- interp_stack_dump();
|
|
|
-
|
|
|
- if (attr & 2)
|
|
|
interp_names_dump(NAMES_VARS);
|
|
|
|
|
|
- if (attr & 4)
|
|
|
+ if (attr & 2)
|
|
|
interp_names_dump(NAMES_FNS);
|
|
|
|
|
|
- if (attr & 8)
|
|
|
+ if (attr & 4)
|
|
|
interp_names_dump(NAMES_ANY);
|
|
|
|
|
|
- if (attr & 16)
|
|
|
+ if (attr & 8)
|
|
|
interp_libs_dump();
|
|
|
|
|
|
return 0;
|