5 #* ***** BEGIN LICENSE BLOCK *****
6 #* Version: MPL 1.1/GPL 2.0/LGPL 2.1
8 #* The contents of this file are subject to the Mozilla Public License Version
9 #* 1.1 (the "License"); you may not use this file except in compliance with
10 #* the License. You may obtain a copy of the License at
11 #* http://www.mozilla.org/MPL/
13 #* Software distributed under the License is distributed on an "AS IS" basis,
14 #* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15 #* for the specific language governing rights and limitations under the
18 #* The Original Code is [Open Source Virtual Machine.].
20 #* The Initial Developer of the Original Code is
21 #* Adobe System Incorporated.
22 #* Portions created by the Initial Developer are Copyright (C) 2009
23 #* the Initial Developer. All Rights Reserved.
28 #* Alternatively, the contents of this file may be used under the terms of
29 #* either the GNU General Public License Version 2 or later (the "GPL"), or
30 #* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 #* in which case the provisions of the GPL or the LGPL are applicable instead
32 #* of those above. If you wish to allow use of your version of this file only
33 #* under the terms of either the GPL or the LGPL, and not to allow others to
34 #* use your version of this file under the terms of the MPL, indicate your
35 #* decision by deleting the provisions above and replace them with the notice
36 #* and other provisions required by the GPL or the LGPL. If you do not delete
37 #* the provisions above, a recipient may use your version of this file under
38 #* the terms of any one of the MPL, the GPL or the LGPL.
40 #* ***** END LICENSE BLOCK ***** */
44 from cmdutils
import *
50 print "environment variable 'AVMRD' is not set"
51 print "SKIPPED all tests"
56 '%s -d testdata/debug.abc'%r.avmrd
,
58 expectedout
=['40: public class debug','(asdb)']
63 '%s -d testdata/debug.abc'%r.avmrd
,
64 input='list\nlist 40\nquit\n',
65 expectedout
=['44: public function pubfunc','46:[ ]+privfunc\(\);']
70 '%s -d testdata/debug.abc'%r.avmrd
,
71 input='break 45\ninfo break\nquit\n',
72 expectedout
=['Breakpoint 1: file testdata.debug.as, 45.']
76 'debugger stacktrace',
77 '%s -d testdata/debug.abc'%r.avmrd
,
79 expectedout
=['#0 global.*global\$init']
84 '%s -d testdata/debug.abc'%r.avmrd
,
85 input='break 45\ndelete 1\nbreak 1\nbreak 49\ninfo break\ncontinue\nquit\n',
86 expectedout
=['Breakpoint 1 deleted.','2 at testdata.debug.as:49','Could not locate specified line.']
91 '%s -d testdata/debug.abc'%r.avmrd
,
92 input='break 42\ncontinue\nnext\nstep\nquit\n',
93 expectedout
=['42:.*print\("in constructor\(\)"\);','43:.*}']
98 '%s -d testdata/debug.abc'%r.avmrd
,
99 input='break 53\ncontinue\nnext\ninfo locals\nnext\ninfo locals\nquit\n',
100 expectedout
=['local1 = undefined','local2 = 10','local2 = 15']
104 'debugger arguments',
105 '%s -d testdata/debug.abc'%r.avmrd
,
106 input='break 53\ncontinue\nnext\ninfo arguments\nquit\n',
107 expectedout
=['arg1 = 110','arg2 = 115']
111 'debugger exception',
112 '%s -d testdata/debug.abc'%r.avmrd
,
113 input='continue\nquit\n',
114 expectedout
=['Exception has been thrown:']
119 '%s -d testdata/debug.abc'%r.avmrd
,
120 input='break 53\ncontinue\nwhere\nquit\n',
121 expectedout
=['locals\(arg1=110,arg2=115\) at testdata.debug.as:53','init\(\) at testdata.debug.as:73']
125 '%s -d testdata/debug.abc'%r.avmrd
,
126 input='break 53\ncontinue\nbt\nquit\n',
127 expectedout
=['locals\(arg1=110,arg2=115\) at testdata.debug.as:53','init\(\) at testdata.debug.as:73']
132 '%s -d testdata/debug.abc'%r.avmrd
,
133 input='break 53\ncontinue\nfinish\nwhere\nquit\n',
134 expectedout
=['#0 global@[0-9a-z]+.global\$init\(\) at testdata.debug.as:73']
139 '%s -d testdata/debug.abc'%r.avmrd
,
140 input='break 53\ncontinue\nnext\nset local2 = 5\ninfo locals\nquit\n',
141 expectedout
=['local2 = 5']
144 if __name__
== '__main__':
146 r
.compile("testdata/debug.as",None,"-d")