- Subject: Re: SLang debugger
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 12:27:20 -0400
SANGOI DINO <SANGOID@xxxxxxxxxxxxxxxxx> wrote:
>This is a tecnology preview version of SLang Debugger for Jed!
Very nice.
[...]
>I did this mostly as a "proof of concept", to see if it was possible to use
>bos_handler to create a debugger. More interpreter help is needed to build a
>real debugger, to be able to change variables in other scopes, for example
>(but I don't want to allow every script to do this, only the debugger, so is
>a complex thing to think about).
I added the bos/eos hooks with the hope that they would be eventually
be useful for a debugger. Inspired by your work, this weekend I made
several internal changes to the interpreter to allow access to local
variables of any function on the stack-frame.
[...]
>I John likes the idea, this new array, Num_Args_Stack, and maybe
>Local_Variable_Frame (index for local variables in Local_Variable_Stack) may
>be unified in a structure array...
That is more or less what I did.
I was hoping to releases slang 2 next weekend but I have decided that
having a debugger is worth delaying the release for another week.
Here is a preview of what will be possible in the next slang2 snapshot.
Consider the script "t.sl":
require ("glob");
static variable T = NULL;
define foo (pattern)
{
variable files = glob (pattern);
message (files);
}
define main ()
{
variable pattern = T;
foo (pattern);
}
main ();
Executing it with slsh yields an error:
Unable to typecast Null_Type to String_Type
/usr/local/share/slsh/glob.sl:16:needs_globbing:Type Mismatch
Now insert the lines:
require ("debugger");
run_debugger ();
at the top of the file and execute the script again. This time it
produces a prompt "(sdb)" where debugger commands may be entered;
<top-level> at ./t.sl:3
3 require ("glob");
(sdb) help
Commands:
delete
cont
quit
print
where
break
up
exit
down
step
help
watch
finish
list
next
(sdb) cont
Received Type Mismatch error. Entering the debugger
needs_globbing at /usr/local/share/slsh/glob.sl:16
16 return (path != str_delete_chars (path, "*?["));
(sdb) print path
NULL
(sdb) up
#1 /usr/local/share/slsh/glob.sl:51:glob
51 !if (needs_globbing (pat))
(sdb) print pat
NULL
(sdb) up
#2 ./t.sl:7:foo
7 variable files = glob (pattern);
(sdb) print pattern
NULL
(sdb) list
2 enable_debug ();
3 require ("glob");
4 static variable T = NULL;
5 define foo (pattern)
6 {
7 variable files = glob (pattern);
8 message (files);
9 }
10 define main ()
11 {
12 variable pattern = T;
(sdb) up
#3 ./t.sl:13:main
13 foo (pattern);
(sdb) print pattern
NULL
(sdb) print T
NULL
(sdb) up
#4 ./t.sl:15:<top-level frame>
15 main ();
(sdb) up
Can't go up
(sdb) quit
So, problem is that T is set to NULL. Set it to "*" and run the
script again:
<top-level> at ./t.sl:3
3 require ("glob");
(sdb) next
4 static variable T = "*";
(sdb)
15 main ();
(sdb) step
main at ./t.sl:12
12 variable pattern = T;
(sdb) next
13 foo (pattern);
(sdb) print pattern
*
(sdb) cont
Received Type Mismatch error. Entering the debugger
8 message (files);
(sdb) list
3 require ("glob");
4 static variable T = "*";
5 define foo (pattern)
6 {
7 variable files = glob (pattern);
8 message (files);
9 }
10 define main ()
11 {
12 variable pattern = T;
13 foo (pattern);
(sdb) print files
String_Type[39]
(sdb) print files[0]
./lib
(sdb) print files[1]
./scripts
(sdb) cont
Unable to typecast Array_Type to String_Type
./t.sl:8:foo:Type Mismatch
As you can see, the second error is that an array was being passed to
the "message" function in line 8.
Thanks,
--John
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2005 date index]
[2005 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]