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 // All frames except the bottom one has normal variables a and b. | |
45 if (i < exec_state.frameCount() - 1) { | 44 if (i < exec_state.frameCount() - 1) { |
| 45 // All frames except the bottom one has normal variables a and b. |
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, frame.localValue(0).value()); | 48 assertEquals(i * 2 + 1, frame.localValue(0).value()); |
49 assertEquals(i * 2 + 2, frame.localValue(1).value()); | 49 assertEquals(i * 2 + 2, frame.localValue(1).value()); |
| 50 |
| 51 // All frames except the bottom one has arguments variables x and y. |
| 52 assertEquals('x', frame.argumentName(0)); |
| 53 assertEquals('y', frame.argumentName(1)); |
| 54 assertEquals((i + 1) * 2 + 1, frame.argumentValue(0).value()); |
| 55 assertEquals((i + 1) * 2 + 2, frame.argumentValue(1).value()); |
50 } | 56 } |
51 | 57 |
52 // Check the frame function. | 58 // Check the frame function. |
53 switch (i) { | 59 switch (i) { |
54 case 0: assertEquals(h, frame.func().value()); break; | 60 case 0: assertEquals(h, frame.func().value()); break; |
55 case 1: assertEquals(g3, frame.func().value()); break; | 61 case 1: assertEquals(g3, frame.func().value()); break; |
56 case 2: assertEquals(g2, frame.func().value()); break; | 62 case 2: assertEquals(g2, frame.func().value()); break; |
57 case 3: assertEquals(g1, frame.func().value()); break; | 63 case 3: assertEquals(g1, frame.func().value()); break; |
58 case 4: assertEquals(f, frame.func().value()); break; | 64 case 4: assertEquals(f, frame.func().value()); break; |
59 case 5: break; | 65 case 5: break; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 g1(a, b); | 127 g1(a, b); |
122 }; | 128 }; |
123 | 129 |
124 f(11, 12); | 130 f(11, 12); |
125 | 131 |
126 // Make sure that the debug event listener vas invoked. | 132 // Make sure that the debug event listener vas invoked. |
127 assertFalse(exception, "exception in listener " + exception) | 133 assertFalse(exception, "exception in listener " + exception) |
128 assertTrue(listenerComplete); | 134 assertTrue(listenerComplete); |
129 | 135 |
130 Debug.setListener(null); | 136 Debug.setListener(null); |
OLD | NEW |