Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
44d6315d
Commit
44d6315d
authored
Jun 28, 1999
by
Niels Möller
Browse files
Better tracing support.
Rev: src/command.c:1.20 Rev: src/command.h:1.28 Rev: src/make_class:1.20
parent
5bebe1d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/command.c
View file @
44d6315d
...
...
@@ -94,6 +94,46 @@ struct command_simple command_unimplemented =
{
{
STATIC_HEADER
,
do_command_unimplemented
},
do_command_simple_unimplemented
};
/* Tracing
*
* For now, trace only function entry. */
/* GABA:
(class
(name trace_command)
(super command)
(vars
(name . "const char *")
(real object command)))
*/
static
int
do_trace_command
(
struct
command
*
s
,
struct
lsh_object
*
x
,
struct
command_continuation
*
c
)
{
CAST
(
trace_command
,
self
,
s
);
trace
(
"Entering %z
\n
"
,
self
->
name
);
return
COMMAND_CALL
(
self
->
real
,
x
,
c
);
}
struct
command
*
make_trace
(
const
char
*
name
,
struct
command
*
real
)
{
NEW
(
trace_command
,
self
);
self
->
super
.
call
=
do_trace_command
;
self
->
name
=
name
;
self
->
real
=
real
;
return
&
self
->
super
;
}
struct
lsh_object
*
collect_trace
(
const
char
*
name
,
struct
lsh_object
*
c
)
{
CAST_SUBTYPE
(
command
,
real
,
c
);
return
&
make_trace
(
name
,
real
)
->
super
;
}
/* Fail if NULL. This commands returns its argument unchanged. Unless
* it is NULL, in which case it doesn't return at all, but instead
* returns an LSH_FAIL status to the mainloop. */
...
...
src/command.h
View file @
44d6315d
...
...
@@ -45,6 +45,13 @@
(c method int "struct lsh_object *result")))
*/
/* GABA:
(class
(name command_exception)
(vars
(e method int UINT32)))
*/
/* GABA:
(class
(name command)
...
...
@@ -182,6 +189,16 @@ extern struct command_simple command_unimplemented;
struct
command
command_die_on_null
;
struct
command
*
make_trace
(
const
char
*
name
,
struct
command
*
real
);
struct
lsh_object
*
collect_trace
(
const
char
*
name
,
struct
lsh_object
*
real
);
#if 1
#define MAKE_TRACE(name, real) (collect_trace((name), (real)))
#else
#define MAKE_TRACE(name, real) (real)
#endif
/* The GABA_* macros are used by automatically generated evaluation code */
struct
command_continuation
*
...
...
src/make_class
View file @
44d6315d
...
...
@@ -523,8 +523,8 @@
"#define Cp1 GABA_APPLY_Cp_1\n"
"#define Cp2 GABA_APPLY_Cp_2\n"
"#define Cp3 GABA_APPLY_Cp_3\n"
" trace(\"Entering " name "\\n\");\n"
" return\n "
;;
" trace(\"Entering " name "\\n\");\n"
" return
MAKE_TRACE(\"" name "\",
\n "
((make-output (append '( (I I)
(K K K1)
(S S S1 S2)
...
...
@@ -538,7 +538,7 @@
(params->alist params)
'())))
translated)
";\n"
"
\n )
;\n"
"#undef A\n"
"#undef I\n"
"#undef K\n"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment