19258b6bc66e09368ada54001f619d53b4fc976d5ager@chromium.org// Copyright 2008 the V8 project authors. All rights reserved. 29a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Redistribution and use in source and binary forms, with or without 39a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// modification, are permitted provided that the following conditions are 49a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// met: 59a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// 69a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Redistributions of source code must retain the above copyright 79a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// notice, this list of conditions and the following disclaimer. 89a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Redistributions in binary form must reproduce the above 99a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// copyright notice, this list of conditions and the following 109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// disclaimer in the documentation and/or other materials provided 119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// with the distribution. 129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Neither the name of Google Inc. nor the names of its 139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// contributors may be used to endorse or promote products derived 149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// from this software without specific prior written permission. 159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// 169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 289a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Flags: --expose-debug-as debug 299a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Make sure that the retreival of local variables are performed correctly even 309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// when an adapter frame is present. 319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 329a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Get the Debug object exposed from the debug context global object. 339a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comDebug = debug.Debug 349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comlistenerCalled = false; 369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comexception = false; 379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 387c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org 397c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.orgfunction checkName(name) { 407c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org assertTrue(name == 'a' || name == 'b' || name == 'c'); 417c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org} 427c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org 437c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org 447c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.orgfunction checkValue(value) { 457c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org assertEquals(void 0, value); 467c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org} 477c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org 487c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org 499a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction listener(event, exec_state, event_data, data) { 509a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com try { 519a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (event == Debug.DebugEvent.Break) { 527c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org var local0Name = exec_state.frame(0).localName(0); 537c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org var local1Name = exec_state.frame(0).localName(1); 547c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org var local2Name = exec_state.frame(0).localName(2); 557c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org checkName(local0Name); 567c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org checkName(local1Name); 577c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org checkName(local2Name); 587c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org var local0Value = exec_state.frame(0).localValue(0).value(); 597c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org var local1Value = exec_state.frame(0).localValue(1).value(); 607c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org var local2Value = exec_state.frame(0).localValue(2).value(); 617c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org checkValue(local0Value); 627c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org checkValue(local1Value); 637c537e2abe09729ed6cb827b4dd206470d8c4a42ager@chromium.org checkValue(local2Value); 649a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com listenerCalled = true; 659a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 669a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } catch (e) { 679a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com exception = e; 689a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com }; 699a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com}; 709a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 719a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Add the debug event listener. 72245aa859d34fd516161c48ef4c69d38d9b889284iposva@chromium.orgDebug.setListener(listener); 739a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 749a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Call a function with local variables passing a different number parameters 759a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// that the number of arguments. 769a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com(function(x,y){var a,b,c; debugger; return 3})() 779a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 789a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Make sure that the debug event listener vas invoked (again). 799a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertTrue(listenerCalled); 809a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertFalse(exception, "exception in listener") 81