/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#ifndef DEBUG_LVL
#define DEBUG_LVL 0
#endif
struct bitab {
char *bi_name;
int bi_type;
};
void
{
debug_level = lvl;
}
long
{
return (debug_level);
}
void
{
int i;
} else
}
void
{
int i;
int anyout = 0;
if (show_wa) {
anyout++;
}
if (IP) {
anyout++;
}
anyout++;
}
if (!anyout)
}
void
{
xforth_t d;
d = peek_xforth(env);
else
d = TOS;
}
static int ndebug_names;
static int ndebug_acfs;
void
{
int i;
for (i = 0; i < ndebug_acfs; i++)
if (acf == debug_acfs[i])
return;
else if (ndebug_acfs >= MAXDEBUG_ACFS)
else {
}
}
static void
{
return;
}
return;
}
return;
}
}
static void
{
fstack_t d;
char *word;
if (d) {
} else if (ndebug_names >= MAXDEBUG_NAMES) {
} else {
}
}
/*
* Eliminate dups and add vocabulary forth to end if not already on list.
*/
static void
{
int i, j, norder = 0;
for (i = env->order_depth; i >= 0; i--) {
;
if (j == norder)
}
j++)
;
if (j == norder)
}
static acf_t
void *arg)
{
int i;
return (acf);
}
return (NULL);
}
char *
{
return (msg);
}
char *
{
char *name;
return (name);
}
static void
{
char *name;
static int acf_count = 0;
if (acf_count)
acf_count = 0;
return;
}
name = "<noname>";
if (++acf_count >= 2) {
acf_count = 0;
} else
}
static void
{
int i;
if (ndebug_names == 0)
else {
for (i = 0; i < ndebug_names; i++)
}
if (ndebug_acfs == 0)
else {
for (i = 0; i < ndebug_acfs; i++)
}
}
static void
{
int i;
for (i = 0; i < ndebug_names; i++) {
name);
FREE(debug_names[i]);
for (i++; i < ndebug_names; i++)
ndebug_names--;
break;
}
}
}
static void
{
fstack_t d;
char *name;
int i, j;
if (d) {
if ((*flagp & FLAG_DEBUG) == 0)
else {
*flagp &= ~FLAG_DEBUG;
for (i = 0; i < ndebug_acfs; i++) {
if (debug_acfs[i] == acf) {
for (j = i + 1; j < ndebug_acfs; j++)
ndebug_acfs--;
break;
}
}
}
} else
}
int
{
int i;
if (ndebug_names <= 0)
return (0);
for (i = 0; i < ndebug_names; i++)
return (1);
return (0);
}
/*
* This is complicated by being given ACF's to temporary compile words which
* don't have a header.
*/
int
{
int i;
/* check to see if any words are being debugged */
if (ndebug_acfs == 0)
return (0);
/* only words in dictionary can be debugged */
return (0);
/* check that word has "FLAG_DEBUG" on */
if ((*flagp & FLAG_DEBUG) == 0)
return (0);
/* look in table of debug acf's */
for (i = 0; i < ndebug_acfs; i++)
if (debug_acfs[i] == acf)
return (1);
return (0);
}
int ndebug_stack = 0;
void
{
}
{
return (0);
}
void
{
int top;
top = ndebug_stack++;
debug_high[top] =
} else {
}
}
}
void
{
if (ndebug_stack) {
if (debug_high[top] == 0) {
ndebug_stack--;
} else {
}
}
}
void
{
if (ndebug_stack) {
ndebug_stack--;
}
}
}
/*
* Really entering do_run, since this may be a recursive entry to do_run,
* we need to set the debug level to what it was previously.
*/
int
{
if (ndebug_stack) {
}
return (ndebug_stack);
}
void
{
}
}
void
{
int i;
for (i = ndebug_stack - 1; i >= 0; i--) {
*flag &= ~FLAG_DEBUG;
}
clear_debug_state(env, 0);
}
void
{
}
int
{
DEBUG_STEPPING)) == 0)
return (0);
if (dl & DEBUG_STEPPING) {
dl |= DEBUG_EXEC_DUMP_DS;
}
show_wa = 0;
}
if (dl & DEBUG_EXEC_DUMP_DS)
if (dl & DEBUG_EXEC_DUMP_RS)
if (dl & DEBUG_EXEC_SHOW_VITALS)
if (dl & DEBUG_TRACING)
if (dl & DEBUG_STEPPING)
return (do_fclib_step(env));
return (0);
}
static void
{
int len;
char *str, *p;
else {
}
}
void
{
int i;
*dptr);
for (i = env->order_depth; i >= 0; i--) {
if (!dptr)
continue;
" dictionary\n", i, *dptr);
}
}
}
}
}
static void
{
int i;
for (i = 0; i < MAX_FCODE; i++) {
}
}
}
void
{
int i, untested = 0;
for (i = 0; i < MAX_FCODE; i++) {
int verify;
if ((verify) &&
#ifdef DEBUG
#endif
"Untested: %4x %32s acf = %8p, %8p\n", i,
untested++;
}
}
if (untested)
}
static void
{
}
static void
{
}
struct bittab {
int b_bitval;
char *b_bitname;
} bittab[] = {
DEBUG_CONTEXT, "context",
DEBUG_BYTELOAD_DS, "byteload-ds",
DEBUG_BYTELOAD_RS, "byteload-rs",
DEBUG_BYTELOAD_TOKENS, "byteload-tokens",
DEBUG_NEW_TOKEN, "new-token",
DEBUG_EXEC_TRACE, "exec-trace",
DEBUG_EXEC_SHOW_VITALS, "exec-show-vitals",
DEBUG_EXEC_DUMP_DS, "exec-dump-ds",
DEBUG_EXEC_DUMP_RS, "exec-dump-rs",
DEBUG_COMMA, "comma",
DEBUG_HEADER, "header",
DEBUG_EXIT_WORDS, "exit-words",
DEBUG_EXIT_DUMP, "exit-dump",
DEBUG_DUMP_TOKENS, "dump-tokens",
DEBUG_COLON, "colon",
DEBUG_NEXT_VITALS, "next-vitals",
DEBUG_VOC_FIND, "voc-find",
DEBUG_DUMP_DICT_TOKENS, "dump-dict-tokens",
DEBUG_TOKEN_USAGE, "token-usage",
DEBUG_DUMP_TOKEN_TABLE, "dump-token-table",
DEBUG_SHOW_STACK, "show-stack",
DEBUG_SHOW_RS, "show-rs",
DEBUG_TRACING, "tracing",
DEBUG_TRACE_STACK, "trace-stack",
DEBUG_CALL_METHOD, "call-method",
DEBUG_ACTIONS, "actions",
DEBUG_STEPPING, "stepping",
DEBUG_REG_ACCESS, "reg-access",
DEBUG_ADDR_ABUSE, "addr-abuse",
DEBUG_FIND_FCODE, "find-fcode",
DEBUG_UPLOAD, "upload",
0
};
void
{
if (!first)
first = 0;
}
if (first)
}
static void
{
}
static void
{
}
int
{
int flags = 0;
char *p;
int i;
if (*str == '0') {
str++;
} else
} else
return (flags);
}
return (0);
return (0xffffffff & ~DEBUG_STEPPING);
if (*str) {
do {
*p++ = '\0';
break;
}
"Unknown debug flag: '%s'\n", str);
str = p;
} while (p);
}
return (flags);
}
static void
{
char *str;
}
static acf_t
{
static int nshow_words = 0;
if (nshow_words > 0) {
nshow_words = 0;
}
return (NULL);
}
nshow_words++;
if (nshow_words >= 4) {
nshow_words = 0;
}
return (NULL);
}
void
{
}
static acf_t
{
return (NULL);
}
void
{
}
static void
{
int i;
if (i == 8)
}
}
}
void
{
ptr += 16)
}
static char *
{
int i;
for (i = 0; i < MAX_FCODE; i++)
return (NULL);
}
static acf_t
{
return (sacf);
return (NULL);
}
/*
* Given an ACF, return ptr to name or "unknown" string.
*/
char *
{
int i, n;
return (NULL);
}
}
int
{
}
static int
{
return (1);
do {
return (1);
}
return (0);
}
/*
* Given an ACF in the middle of a colon definition, search dictionary towards
* beginning for "colon" acf. If we find a "semi" acf first, we're not in
* the middle of a colon-def (temporary execute?).
*/
char *
{
char *name;
break;
return (name);
}
return (acf_to_str(acf));
}
/*
*/
void
{
else {
}
}
/*
* Dump data, return stacks, try to unthread forth calling stack.
*/
void
{
}
int in_forth_abort;
/*
* Handle fatal error, if interactive mode, return to ok prompt.
*/
void
{
if (in_forth_abort) {
abort();
}
if (env) {
}
/*
* If not in interactive mode, return_to_interact just returns.
*/
exit(1);
}
/*
* Handle fatal system call error
*/
void
{
}
static void
{
#ifdef DEBUG
#else
/*EMPTY*/
#endif
}
static void
{
int i;
for (i = 0; i < width; i++)
for (i = 0; i < 16; i++) {
if (i == 8)
if (i == offset)
else
}
for (i = 0; i < 16; i++) {
if (i == offset)
else
}
}
static void
{
}
static acf_t
{
char *name;
return (NULL);
}
static void
{
char *pat;
}
}
void
{
int i;
if (*doprint) {
for (i = 0; i < level; i++)
*doprint = 0;
}
}
0
};
struct bitab *
{
int i;
return (&bitab[i]);
return (NULL);
}
static void
{
int i, n, pass;
uchar_t *p;
else
return;
}
if (pass) {
nthentab--)
nthen++;
if (nthen) {
doprintlevel = 1;
for (i = 0; i < nthen; i++)
}
for (i = 0; i < nbrtab; i += 2)
level++;
doprintlevel = 1;
}
doprintlevel = 1;
}
doprintlevel = 1;
}
doprintlevel = 1;
}
}
if (pass)
continue;
}
if (pass) {
}
break;
}
case BI_NOOP:
case BI_NOTYET:
if (pass)
break;
case BI_QUOTE:
if (pass)
acf++;
n = *p++;
if (pass)
p += n + 1;
p++)
;
acf--;
break;
case BI_BLIT:
acf++;
if (pass)
break;
case BI_BDO:
case BI_QDO:
if (pass) {
doprintlevel = 1;
level++;
}
acf++;
break;
case BI_BR:
acf++;
if (pass) {
if (nbrstk) {
doprintlevel = 1;
level--;
&doprintlevel);
"repeat ");
nbrstk--;
} else
"[br back?]");
} else if (nthentab) {
doprintlevel = 1;
&doprintlevel);
doprintlevel = 1;
}
} else {
}
if (endcase_loc == 0 &&
case_lit) {
endcase_loc = *acf;
}
}
break;
case BI_QBR:
acf++;
if (pass) {
if (nbrstk) {
doprintlevel = 1;
level--;
&doprintlevel);
"until ");
nbrstk--;
} else
"[br back?]");
} else if (nbrstk > 0 &&
doprintlevel = 1;
&doprintlevel);
"while ");
doprintlevel = 1;
} else {
doprintlevel = 1;
level++;
}
}
break;
case BI_BOF:
acf++;
if (pass) {
} else if (case_lit == 0) {
}
break;
case BI_LOOP:
case BI_PLOOP:
if (pass) {
level--;
doprintlevel = 1;
}
acf++;
break;
default:
}
}
}
}
static void
{
fstack_t d;
if (d)
else {
}
}
static acf_t
{
do {
return (NULL);
}
static void
{
}
static void
{
switch ((d >> 24) & 0x3) {
}
if (d & 0x80000000)
if (d & 0x400000000)
if (d & 0x200000000)
}
void
{
}
static void
{
}
static int mw_valid;
static int mw_size;
static void *mw_addr;
static fstack_t
mw_fetch(void)
{
switch (mw_size) {
}
return (0);
}
void
{
if (!mw_valid)
return;
if (value != mw_lastvalue) {
"memory-watch: %p/%d: %llx -> %llx\n",
}
}
}
static void
{
switch (size) {
case 1: case 2: case 4: case 8:
break;
default:
size);
return;
}
mw_lastvalue = mw_fetch();
}
static void
{
}
static void
{
}
static void
{
mw_valid = 0;
}
static void
{
switch (size) {
default:
return;
}
if (value == match_value)
}
}
static void
_init(void)
{
}