Skip to content

Commit 2219810

Browse files
committed
Fix GDB expansion of structures/arrays containing floating point values.
1 parent d39cdc9 commit 2219810

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/backend/gdb_expansion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const referenceStringRegex = /^(0x[0-9a-fA-F]+\s*)"/;
77
const referenceRegex = /^0x[0-9a-fA-F]+/;
88
const nullpointerRegex = /^0x0+\b/;
99
const charRegex = /^(\d+) ['"]/;
10-
const numberRegex = /^\d+/;
10+
const numberRegex = /^\d+(\.\d+)?/;
1111
const pointerCombineChar = ".";
1212

1313
export function isExpandable(value: string): number {

test/gdb_expansion.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,15 @@ suite("GDB Value Expansion", () => {
292292
}
293293
]);
294294
});
295+
test("float values", () => {
296+
let node = `{ intval1 = 123, floatval1 = 123.456, intval2 = 3, floatval2 = 234.45 }`;
297+
let variables = expandValue(variableCreate, node);
298+
299+
assert.deepEqual(variables, [
300+
{ name: "intval1", value: "123", variablesReference: 0 },
301+
{ name: "floatval1", value: "123.456", variablesReference: 0 },
302+
{ name: "intval2", value: "3", variablesReference: 0 },
303+
{ name: "floatval2", value: "234.45", variablesReference: 0 }
304+
]);
305+
});
295306
});

0 commit comments

Comments
 (0)