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