parent
ec11595591
commit
c8a6ef3242
|
@ -80,10 +80,8 @@ function rotateLogFiles() {
|
|||
}
|
||||
}
|
||||
|
||||
// 初始化日志文件
|
||||
initializeLogFile();
|
||||
|
||||
// 日志输出函数
|
||||
function log(level: string, message: any) {
|
||||
const timestamp = new Date().toISOString();
|
||||
const logMessage = `[${timestamp}] [${level}] ${message}`;
|
||||
|
@ -95,22 +93,18 @@ function log(level: string, message: any) {
|
|||
}
|
||||
}
|
||||
|
||||
// 记录调试级别的日志
|
||||
function debug(message: any) {
|
||||
log(LOG_LEVEL.DEBUG, message);
|
||||
}
|
||||
|
||||
// 记录信息级别的日志
|
||||
function info(message: any) {
|
||||
log(LOG_LEVEL.INFO, message);
|
||||
}
|
||||
|
||||
// 记录警告级别的日志
|
||||
function warning(message: any) {
|
||||
log(LOG_LEVEL.WARNING, message);
|
||||
}
|
||||
|
||||
// 记录错误级别的日志
|
||||
function error(message: any) {
|
||||
log(LOG_LEVEL.ERROR, message);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ const numRegex = /\d+/;
|
|||
const logMsgMatch = /(^\$[0-9]*[\ ]*=[\ ]*)(.*)/;
|
||||
const logReplace = /{([^}]*)}/;
|
||||
const logReplaceTest = /{([^}]*)}/g;
|
||||
|
||||
const logger = require('../log');
|
||||
function isPositiveInteger(str: string): boolean {
|
||||
const regex = /^[1-9]\d*$/;
|
||||
return regex.test(str);
|
||||
|
@ -408,11 +408,13 @@ export class MI2 extends EventEmitter implements IBackend {
|
|||
this.log("console", "Log Message:" + this.logMsgVarProcess);
|
||||
}
|
||||
}else if(record.content.startsWith("No symbol")){
|
||||
logger.warning(`onOutput: No symbol, record:${JSON.stringify(record)}`);
|
||||
// this.log("log", "GDB -> App6: +++++++++:" + this.logMsgNum + ":" + record.content + ":" + this.logMsgVar);
|
||||
}
|
||||
} else {
|
||||
if(record.content.startsWith("No symbol")){
|
||||
this.log(record.type, record.content);
|
||||
logger.warning(`onOutput: No symbol, record:${JSON.stringify(record)}`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1140,6 +1142,8 @@ export class MI2 extends EventEmitter implements IBackend {
|
|||
this.handlers[sel] = (node: MINode) => {
|
||||
delete this.needOutput[sel];
|
||||
if (node && node.resultRecords && node.resultRecords.resultClass === "error") {
|
||||
logger.warning(`sendCommand: suppressFailure:${suppressFailure}, ${JSON.stringify(node)}`);
|
||||
|
||||
if (!suppressFailure) {
|
||||
this.log("stderr", `WARNING: Error executing command '${command}'`);
|
||||
if(command.includes("exec-finish") && node.resultRecords.results[0][1].includes("not meaningful in the outermost frame")){
|
||||
|
@ -1148,8 +1152,28 @@ export class MI2 extends EventEmitter implements IBackend {
|
|||
this.log("stderr", `WARNING: reject not meaningful in the outermost++++`);
|
||||
reject(new MIError(node.result("reject not meaningful in the outermost") || "reject not meaningful in the outermost", command));
|
||||
}
|
||||
|
||||
resolve(node);
|
||||
} else {
|
||||
let ignoreFail = false;
|
||||
node.resultRecords.results.forEach((result: [string, string]) => {
|
||||
const key = result[0];
|
||||
const value = result[1];
|
||||
logger.warning(`sendCommand:suppressFailure:${suppressFailure}, foreach Key: ${key}, Value: ${value}`);
|
||||
if(value.includes('No symbol')){
|
||||
ignoreFail = true;
|
||||
}
|
||||
else if(value.includes('Attempt to use a type name as an expression')){
|
||||
ignoreFail = true;
|
||||
}
|
||||
else if(value.includes('Problem parsing arguments: data-evaluate-expression')){
|
||||
ignoreFail = true;
|
||||
}
|
||||
});
|
||||
if(ignoreFail){
|
||||
resolve(node);
|
||||
}
|
||||
|
||||
this.log("stderr", `WARNING: reject '${command}'`);
|
||||
reject(new MIError(node.result("msg") || "Internal error", command));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue