Skip to content

Commit 091281e

Browse files
committed
Test for eval with stack depth.
1 parent 6633087 commit 091281e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/phpDebug.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,14 +1484,14 @@ class PhpDebugSession extends vscode.DebugSession {
14841484
}
14851485
} else if (args.context === 'clipboard') {
14861486
const uuid = randomUUID()
1487-
const eres = await connection.sendEvalCommand(
1488-
`$GLOBALS['eval_cache']['${uuid}']=var_export(${args.expression}, true)`
1487+
const ctx = await stackFrame.getContexts() // TODO CACHE THIS
1488+
await connection.sendEvalCommand(
1489+
`$GLOBALS['eval_cache']['${uuid}']=var_export(${args.expression}, true)`,
1490+
ctx[1]
14891491
)
1490-
response.body = { result: eres.result.value, variablesReference: 0 }
1491-
//const ctx = await stackFrame.getContexts() // TODO CACHE THIS
1492-
//const res = await connection.sendPropertyValueNameCommand(`$eval_cache['${uuid}']`, ctx[1])
1492+
const res = await connection.sendPropertyValueNameCommand(`$eval_cache['${uuid}']`, ctx[1])
14931493
// force a string response
1494-
//response.body = { result: res.value, variablesReference: 0 }
1494+
response.body = { result: res.value, variablesReference: 0 }
14951495
this.sendResponse(response)
14961496
return
14971497
} else {

src/xdebugConnection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,13 +1146,13 @@ export class Connection extends DbgpConnection {
11461146
)
11471147
}
11481148

1149-
/** Sends a property_value by name command */
1149+
/** Sends a property_value by name command and request full data */
11501150
public async sendPropertyValueNameCommand(name: string, context: Context): Promise<PropertyValueResponse> {
11511151
const escapedFullName = '"' + name.replace(/("|\\)/g, '\\$1') + '"'
11521152
return new PropertyValueResponse(
11531153
await this._enqueueCommand(
11541154
'property_value',
1155-
`-d ${context.stackFrame.level} -c ${context.id} -n ${escapedFullName}`
1155+
`-m 0 -d ${context.stackFrame.level} -c ${context.id} -n ${escapedFullName}`
11561156
),
11571157
context.stackFrame.connection
11581158
)
@@ -1173,8 +1173,8 @@ export class Connection extends DbgpConnection {
11731173
// ------------------------------- eval -----------------------------------------
11741174

11751175
/** sends an eval command */
1176-
public async sendEvalCommand(expression: string): Promise<EvalResponse> {
1177-
return new EvalResponse(await this._enqueueCommand('eval', undefined, expression), this)
1176+
public async sendEvalCommand(expression: string, context?: Context): Promise<EvalResponse> {
1177+
return new EvalResponse(await this._enqueueCommand('eval', context ? `-d ${context.stackFrame.level}` : undefined, expression), this)
11781178
}
11791179

11801180
// ------------------------------ stream ----------------------------------------

0 commit comments

Comments
 (0)