OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 | 35 |
36 function listener(event, exec_state, event_data, data) { | 36 function listener(event, exec_state, event_data, data) { |
37 try { | 37 try { |
38 if (event == Debug.DebugEvent.Break) | 38 if (event == Debug.DebugEvent.Break) |
39 { | 39 { |
40 assertEquals(6, exec_state.frameCount()); | 40 assertEquals(6, exec_state.frameCount()); |
41 | 41 |
42 for (var i = 0; i < exec_state.frameCount(); i++) { | 42 for (var i = 0; i < exec_state.frameCount(); i++) { |
43 var frame = exec_state.frame(i); | 43 var frame = exec_state.frame(i); |
| 44 if (i < exec_state.frameCount() - 1) { |
44 // All frames except the bottom one has normal variables a and b. | 45 // All frames except the bottom one has normal variables a and b. |
45 if (i < exec_state.frameCount() - 1) { | |
46 assertEquals('a', frame.localName(0)); | 46 assertEquals('a', frame.localName(0)); |
47 assertEquals('b', frame.localName(1)); | 47 assertEquals('b', frame.localName(1)); |
48 assertEquals(i * 2 + 1 + (i * 2 + 1) / 100, | 48 assertEquals(i * 2 + 1 + (i * 2 + 1) / 100, |
49 frame.localValue(0).value()); | 49 frame.localValue(0).value()); |
50 assertEquals(i * 2 + 2 + (i * 2 + 2) / 100, | 50 assertEquals(i * 2 + 2 + (i * 2 + 2) / 100, |
51 frame.localValue(1).value()); | 51 frame.localValue(1).value()); |
| 52 |
| 53 // All frames except the bottom one has arguments variables x and y. |
| 54 assertEquals('x', frame.argumentName(0)); |
| 55 assertEquals('y', frame.argumentName(1)); |
| 56 assertEquals((i + 1) * 2 + 1 + ((i + 1) * 2 + 1) / 100, |
| 57 frame.argumentValue(0).value()); |
| 58 assertEquals((i + 1) * 2 + 2 + ((i + 1) * 2 + 2) / 100, |
| 59 frame.argumentValue(1).value()); |
52 } | 60 } |
53 | 61 |
54 // Check the frame function. | 62 // Check the frame function. |
55 switch (i) { | 63 switch (i) { |
56 case 0: assertEquals(h, frame.func().value()); break; | 64 case 0: assertEquals(h, frame.func().value()); break; |
57 case 1: assertEquals(g3, frame.func().value()); break; | 65 case 1: assertEquals(g3, frame.func().value()); break; |
58 case 2: assertEquals(g2, frame.func().value()); break; | 66 case 2: assertEquals(g2, frame.func().value()); break; |
59 case 3: assertEquals(g1, frame.func().value()); break; | 67 case 3: assertEquals(g1, frame.func().value()); break; |
60 case 4: assertEquals(f, frame.func().value()); break; | 68 case 4: assertEquals(f, frame.func().value()); break; |
61 case 5: break; | 69 case 5: break; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 g1(a, b); | 142 g1(a, b); |
135 }; | 143 }; |
136 | 144 |
137 f(11.11, 12.12); | 145 f(11.11, 12.12); |
138 | 146 |
139 // Make sure that the debug event listener vas invoked. | 147 // Make sure that the debug event listener vas invoked. |
140 assertFalse(exception, "exception in listener " + exception) | 148 assertFalse(exception, "exception in listener " + exception) |
141 assertTrue(listenerComplete); | 149 assertTrue(listenerComplete); |
142 | 150 |
143 Debug.setListener(null); | 151 Debug.setListener(null); |
OLD | NEW |