Skip to content

Commit

Permalink
* Fix debugger+interactive mode bug
Browse files Browse the repository at this point in the history
* Recognize whether an extension is with debug information or not
  • Loading branch information
zsuraski committed Apr 27, 1999
1 parent 1245356 commit 2493f68
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions Zend/zend-scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ zend_op_array *compile_string(zval *source_string CLS_DC)
source_string = &tmp;

init_op_array(op_array, INITIAL_OP_ARRAY_SIZE);
op_array->type = ZEND_EVAL_CODE;
save_lexical_state(&original_lex_state CLS_CC);
if (prepare_string_for_scanning(source_string CLS_CC)==FAILURE) {
destroy_op_array(op_array);
Expand Down
1 change: 1 addition & 0 deletions Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ int zendlex(znode *zendlval CLS_DC);
#define ZEND_INTERNAL_FUNCTION 1
#define ZEND_USER_FUNCTION 2
#define ZEND_OVERLOADED_FUNCTION 3
#define ZEND_EVAL_CODE 4

#define ZEND_INTERNAL_CLASS 1
#define ZEND_USER_CLASS 2
Expand Down
5 changes: 3 additions & 2 deletions Zend/zend_execute_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,9 @@ void execute_new_code(CLS_D)
ELS_FETCH();

if (!EG(interactive)
|| CG(active_op_array)->backpatch_count>0) {

|| CG(active_op_array)->backpatch_count>0
|| CG(active_op_array)->function_name
|| CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
return;
}
CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number;
Expand Down
7 changes: 7 additions & 0 deletions Zend/zend_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ int zend_load_extension(char *path)
(ZTS_V?"is":"isn't"));
DL_UNLOAD(handle);
return FAILURE;
} else if (ZEND_DEBUG_V!=extension_version_info->debug) {
zend_printf("Cannot load %s - it %s debug information, whereas Zend %s\n",
new_extension->name,
(extension_version_info->debug?"contains":"does not contain"),
(ZEND_DEBUG_V?"does":"does not"));
DL_UNLOAD(handle);
return FAILURE;
}

if (new_extension->startup) {
Expand Down
9 changes: 8 additions & 1 deletion Zend/zend_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef struct {
int zend_extension_api_no;
char *required_zend_version;
unsigned char thread_safe;
unsigned char debug;
} zend_extension_version_info;


Expand Down Expand Up @@ -73,9 +74,15 @@ ZEND_API int zend_get_resource_handle();
#define ZTS_V 0
#endif

#ifdef ZEND_DEBUG
#define ZEND_DEBUG_V 1
#else
#define ZEND_DEBUG_V 0
#endif


#define ZEND_EXTENSION() \
ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, "0.80A", ZTS_V }
ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, "0.80A", ZTS_V, ZEND_DEBUG_V }

#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ int pass_two(zend_op_array *op_array)
{
CLS_FETCH();

if (op_array->type != ZEND_USER_FUNCTION) {
if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
return 0;
}
if (CG(extended_info)) {
Expand Down

0 comments on commit 2493f68

Please sign in to comment.