Skip to content

Commit

Permalink
Merged pull request xdebug#963
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Jul 16, 2024
2 parents 75b16c2 + 61dbc8e commit 3ed0dc7
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions .xdebugci/ingest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$status = [
'run' => $runId,
'ts' => $timeStamp,
'ts_exp' => new \MongoDB\BSON\Timestamp(0, time()),
'ref' => trim( `git rev-parse --short --verify HEAD` ),
'abbrev' => $abbrev,
'cfg' => [
Expand Down
8 changes: 8 additions & 0 deletions src/coverage/code_coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@ static int xdebug_find_jumps(zend_op_array *opa, unsigned int position, size_t *
*jump_count = 1;
return 1;

#if PHP_VERSION_ID >= 80400
} else if (opcode.opcode == ZEND_JMP_FRAMELESS) {
jumps[0] = position + 1;
jumps[1] = XDEBUG_ZNODE_JMP_LINE(opcode.op2, position, base_address);
*jump_count = 2;
return 1;
#endif

} else if (
opcode.opcode == ZEND_GENERATOR_RETURN ||
opcode.opcode == ZEND_EXIT ||
Expand Down
6 changes: 6 additions & 0 deletions tests/coverage/jmp_frameless.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
namespace Foo {

echo substr("Derick Cool?\n", 7);

}
32 changes: 32 additions & 0 deletions tests/coverage/jmp_frameless.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
Test for JMP_FRAMELESS (>= PHP 8.4)
--SKIPIF--
<?php
require __DIR__ . '/../utils.inc';
check_reqs('PHP >= 8.4');
?>
--INI--
xdebug.mode=coverage
--FILE--
<?php
include 'dump-branch-coverage.inc';

xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE | XDEBUG_CC_BRANCH_CHECK );

require dirname(__FILE__) . '/jmp_frameless.inc';

$cc = xdebug_get_code_coverage();
dump_branch_coverage($cc);
xdebug_stop_code_coverage();
?>
--EXPECTF--
Cool?
{main}
- branches
- 00; OP: 00-%d; line: %d-04 HIT; out1: %d X ; out2: %d HIT
- %d; OP: %d-%d; line: 04-04 X ; out1: %d X
- %d; OP: %d-%d; line: 04-04 HIT; out1: %d HIT
- %d; OP: %d-%d; line: 04-07 HIT; out1: EX X
- paths
- 0 %d %d: X
- 0 %d %d: HIT

0 comments on commit 3ed0dc7

Please sign in to comment.