1、解决c/c++调试插件因gdb返回多余字段导致字符数组后其它变量查询失败问题;

2、解决数组变量设置失败问题
This commit is contained in:
xuhong 2023-10-13 15:36:53 +08:00
parent 0b69badad6
commit f4bca2266c
3 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,7 @@
# 0.1.8
- resolve the issue of being unable to parse other properties when a struct contains a character array;
- fix set variable fail issue;
# 0.1.7
- fix set variable fail issue;
- fix hitCount breakpoint does work bugs;
@ -7,6 +11,7 @@
# 0.1.5
- Changed the icon and plugin name to avoid confusion with native-debug;
# 0.1.4
- Set suppressFailure to prevent debugging from exiting due to exceptions;

View File

@ -14,7 +14,7 @@
"debug"
],
"license": "public domain",
"version": "0.1.7",
"version": "0.1.8",
"publisher": "KylinIDETeam",
"icon": "images/native-debug.png",
"engines": {

View File

@ -204,7 +204,10 @@ export class MI2DebugSession extends DebugSession {
if (args.variablesReference >= VAR_HANDLES_START) {
const pointerCombineChar = ".";
id = this.variableHandles.get(args.variablesReference);
if (typeof id == "string") {
if(id === "arr") {
name = id[0] == '*' ? id.substr(1):id + args.name;
}
else if (typeof id == "string") {
name = id[0] == '*' ? id.substr(1):id + pointerCombineChar + args.name;
}
}
@ -505,7 +508,6 @@ export class MI2DebugSession extends DebugSession {
}
return varObj.isCompound() ? id : 0;
};
if (typeof id == "number") {
let stack: Variable[];
try {
@ -584,7 +586,10 @@ export class MI2DebugSession extends DebugSession {
// TODO: this evals on an (effectively) unknown thread for multithreaded programs.
variable = await this.miDebugger.evalExpression(JSON.stringify(id), 0, 0);
try {
let expanded = expandValue(createVariable, variable.result("value"), id, variable);
let variableValue = variable.result("value");
// 过滤掉 "\\000 <repeats x times>" 部分
variableValue = variableValue.replace(/ '\\000' <repeats \d+ times>,/g, "");
let expanded = expandValue(createVariable, variableValue, id, variable);
if (!expanded) {
this.sendResponse(response);
//this.sendErrorResponse(response, 2, `Could not expand variable`);