Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/debug/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  Frame-onStep-15.js

  Sprache: JAVA
 

// Test how stepping interacts with for(;;) statements.

let g = newGlobal({newCompartment: true});

// We want a for(;;) loop whose body is evaluated at least once, to
// see whether the loop head is hit a second time.
g.eval(`function f() {
  let x = 0;
  debugger;                     // +0
  for(;;) {                     // +1
    if (x++ == 1break;        // +2
  }                             // +3
  debugger;                     // +4
}`);

let dbg = Debugger(g);

function test(s, expected) {
  let result = '';

  dbg.onDebuggerStatement = function(frame) {
    // On the second debugger statement, we're done.
    dbg.onDebuggerStatement = function(frame) {
      frame.onStep = undefined;
    };

    let debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
    frame.onStep = function() {
      // Only examine stops at entry points for the line.
      let lineNo = this.script.getOffsetLocation(this.offset).lineNumber;
      if (this.script.getLineOffsets(lineNo).indexOf(this.offset) < 0) {
        return undefined;
      }

      let delta = this.script.getOffsetLocation(this.offset).lineNumber - debugLine;
      result += delta;
    };
  };
  g.eval(s);
  assertEq(result, expected);
}

test('f()''2124');

Messung V0.5 in Prozent
C=90 H=90 G=90

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.