Skip to content

Commit 3f5a307

Browse files
committed
Fix evaluateName expressions for arrays and array children.
Array names shouldn't be put into square brackets, only their children. Identify array entry indexes by being numbers if varobj parent not present. Additionally check parent varobj to be an array for array children. May be redundant but reduces diff to previous code for this commit. Signed-off-by: Jens Reinecke <jens.reinecke@arm.com>
1 parent 9f30726 commit 3f5a307

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/gdb/GDBDebugSessionBase.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,21 +2794,17 @@ export abstract class GDBDebugSessionBase extends LoggingDebugSession {
27942794
let name = `${ref.varobjName}.${child.exp}`;
27952795
const varobjName = name;
27962796
const value = child.value ? child.value : child.type;
2797-
const isArrayParent = arrayRegex.test(child.type);
27982797
const isArrayChild =
2799-
varobj !== undefined
2800-
? arrayRegex.test(varobj.type) &&
2801-
arrayChildRegex.test(child.exp)
2802-
: false;
2798+
arrayChildRegex.test(child.exp) &&
2799+
(!varobj || arrayRegex.test(varobj.type));
28032800
if (isArrayChild) {
28042801
// update the display name for array elements to have square brackets
28052802
name = `[${child.exp}]`;
28062803
}
28072804
const variableName = isArrayChild ? name : child.exp;
2808-
const evaluateName =
2809-
isArrayParent || isArrayChild
2810-
? `${topLevelPathExpression}[${child.exp}]`
2811-
: `${topLevelPathExpression}.${child.exp}`;
2805+
const evaluateName = isArrayChild
2806+
? `${topLevelPathExpression}[${child.exp}]`
2807+
: `${topLevelPathExpression}.${child.exp}`;
28122808
variables.push({
28132809
name: variableName,
28142810
evaluateName,

0 commit comments

Comments
 (0)