修改代码结构,封装函数接口

This commit is contained in:
changtao 2023-06-07 16:08:51 +08:00
parent cf5a97c12b
commit 51aa7b86a9
12 changed files with 402 additions and 137 deletions

View File

@ -8,6 +8,7 @@
"binutils":{},
"libc-bin":{}
}
},
"loongarch64":{
"KylinV10SP1":{

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script type="module" crossorigin src="/assets/index.805d1f9b.js"></script>
<script type="module" crossorigin src="/assets/index.e397990e.js"></script>
<link rel="stylesheet" href="/assets/index.6c6af714.css">
<script type="module">try{import("_").catch(()=>1);}catch(e){}window.__vite_is_dynamic_import_support=true;</script>
<script type="module">!function(){if(window.__vite_is_dynamic_import_support)return;console.warn("vite: loading legacy build because dynamic import is unsupported, syntax error above should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
@ -15,6 +15,6 @@
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
<script nomodule id="vite-legacy-polyfill" src="/assets/polyfills-legacy.82d708a7.js"></script>
<script nomodule id="vite-legacy-entry" data-src="/assets/index-legacy.7840883a.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
<script nomodule id="vite-legacy-entry" data-src="/assets/index-legacy.28a78ceb.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -63,6 +63,7 @@ export function activate(context: vscode.ExtensionContext) {
lockID:string;
lockowner:string;
}
// return---> info threads
function gdb_cmdof_info_thread(pid:string):string[]{
let temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${pid} -ex "info threads" -ex "q" `;
let cmdout = execSync(temcmd).toString();
@ -71,14 +72,184 @@ export function activate(context: vscode.ExtensionContext) {
//console.log("CCCC:",infothreads)
return infothreads;
}
//return--->threadID与LWP的映射关系
function get_threadid_lwp_relation(info_thread:string[]):{ [key: string]: string }{
const regex = /[\s\*]*(\d+).*Thread.*\(LWP (\d+)\).*/;
let lwp_to_thread_id={};
for(let i=0;i<info_thread.length;i++){
const match = info_thread[i].match(regex);
if(match){
let thread_id = match[1];
let thread_lwp = match[2];
lwp_to_thread_id[thread_lwp] = thread_id;
}
}
return lwp_to_thread_id
}
//return--->rwlock_infomation[]
function judge_mutex(pid:string,lwp_to_thread_id:{ [key: string]: string },symbol_flag:string):rwlock_infomation[]{
let lwp ="";
let thread_id = "";
let armRpmMutexlock = symbol_flag;
let thread_mutexlock_info:rwlock_infomation[]=[];
//提取括号内的锁地址和<>内的锁变量名
const regex = /\((0x[a-f0-9]+)\s*<([^>]+)>\)/i;
//arm-server--->__gthread_mutex_lock
for (const key in lwp_to_thread_id) {
if (lwp_to_thread_id.hasOwnProperty(key)) {
console.log(`LWP ${key}: thread ID is ${lwp_to_thread_id[key]}`);
lwp = key;
thread_id = lwp_to_thread_id[key];
let bt_output = gdb_cmdof_thread_n_and_bt(pid,thread_id);
for(let j=0;j<bt_output.length;j++){
if(bt_output[j].startsWith("#") && bt_output[j].includes(armRpmMutexlock))
{
let lockID="";
let lockname="";
const regex: RegExp = /<([a-zA-Z0-9_]+)>/;
const matches: RegExpMatchArray | null = bt_output[j].match(regex);
const regex1: RegExp = /0x[0-9a-f]+/;;
const matches1: RegExpMatchArray | null = bt_output[j].match(regex1);
if (matches1 !== null && matches !== null) {
lockID= matches1[0];
lockname = matches[1];
let lockowner = gdb_cmdof_thread_n_and_p(pid,thread_id,lockname);
const mutexlock_info_temp:rwlock_infomation={
threadID:lwp,
lockID:lockID,
lockowner:lockowner
};
thread_mutexlock_info.push(mutexlock_info_temp)
break;
} else {
console.log('No address found');
}
}
}
}
}
function gdb_cmdof_thread_n_and_bt(pid:string,thread_id:Number):string[]{
return thread_mutexlock_info;
}
function judge_rwlock(pid:string,lwp_to_thread_id:{ [key: string]: string },symbol_flag:string):rwlock_infomation[]{
let lwp ="";
let thread_id = "";
let armRpmMutexlock = symbol_flag;
let thread_mutexlock_info:rwlock_infomation[]=[];
//提取括号内的锁地址和<>内的锁变量名
const regex = /\((0x[a-f0-9]+)\s*<([^>]+)>\)/i;
//arm-server--->__gthread_mutex_lock
for (const key in lwp_to_thread_id) {
if (lwp_to_thread_id.hasOwnProperty(key)) {
console.log(`LWP ${key}: thread ID is ${lwp_to_thread_id[key]}`);
lwp = key;
thread_id = lwp_to_thread_id[key];
let bt_output = gdb_cmdof_thread_n_and_bt(pid,thread_id);
for(let j=0;j<bt_output.length;j++){
if(bt_output[j].startsWith("#") && bt_output[j].includes(armRpmMutexlock))
{
let lockID="";
let lockname="";
const regex: RegExp = /<([a-zA-Z0-9_]+)>/;
const matches: RegExpMatchArray | null = bt_output[j].match(regex);
const regex1: RegExp = /0x[0-9a-f]+/;;
const matches1: RegExpMatchArray | null = bt_output[j].match(regex1);
if (matches1 !== null && matches !== null) {
lockID= matches1[0];
lockname = matches[1];
let lockowner = gdb_cmdof_thread_n_and_p_rwlock(pid,thread_id,lockname);
const mutexlock_info_temp:rwlock_infomation={
threadID:lwp,
lockID:lockID,
lockowner:lockowner
};
thread_mutexlock_info.push(mutexlock_info_temp)
break;
} else {
console.log('No address found');
}
}
}
}
}
return thread_mutexlock_info;
}
function judge_semlock(pid:string,lwp_to_thread_id:{ [key: string]: string },symbol_flag:string):{ [key: string]: string }{
let lwp ="";
let thread_id = "";
let armRpmMutexlock = symbol_flag;
let blocked_threads={};
//提取括号内的锁地址和<>内的锁变量名
//const regex = /\((0x[a-f0-9]+)\s*<([^>]+)>\)/i;
for (const key in lwp_to_thread_id) {
if (lwp_to_thread_id.hasOwnProperty(key)) {
console.log(`LWP ${key}: thread ID is ${lwp_to_thread_id[key]}`);
lwp = key;
thread_id = lwp_to_thread_id[key];
let bt_output = gdb_cmdof_thread_n_and_bt(pid,thread_id);
for(let j=0;j<bt_output.length;j++){
if(bt_output[j].startsWith("#") && bt_output[j].includes(armRpmMutexlock))
{
console.log("semlock happen!!!")
blocked_threads[lwp] = "semlock"
break;
}
}
}
}
return blocked_threads;
}
//return---> bt output
function gdb_cmdof_thread_n_and_bt(pid:string,thread_id:string):string[]{
let temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${pid} -ex "info threads" -ex "thread ${thread_id}" -ex "bt" -ex "q"`;
let cmdout = execSync(temcmd).toString();
let bt_output = cmdout.trim().split('\n');
return bt_output;
}
//return--->print lockowner
function gdb_cmdof_thread_n_and_p(pid:string,thread_id:string,lockname:string):string{
let mutex_owner= lockname +"._M_mutex.__data.__owner"
let temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${pid} -ex "info threads" -ex "thread ${thread_id}" -ex "p ${mutex_owner}" -ex "q"`;
let cmdout = execSync(temcmd).toString()
let mutex_info = cmdout.trim().split('\n');
for(let j=mutex_info.length-1;j>=0;j--){
if(mutex_info[j].startsWith("$1")){
let temarry = mutex_info[j].split("=")
if (Number(temarry[1])!=0){
let lockowner = temarry[1]
return lockowner;
}
}
}
return "unknow";
}
function gdb_cmdof_thread_n_and_p_rwlock(pid:string,thread_id:string,lockname:string):string{
let mutex_owner= lockname +".__data.__cur_writer"
let temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${pid} -ex "info threads" -ex "thread ${thread_id}" -ex "p ${mutex_owner}" -ex "q"`;
let cmdout = execSync(temcmd).toString()
let mutex_info = cmdout.trim().split('\n');
for(let j=mutex_info.length-1;j>=0;j--){
if(mutex_info[j].startsWith("$1")){
let temarry = mutex_info[j].split("=")
if (Number(temarry[1])!=0){
let lockowner = temarry[1]
return lockowner;
}
}
}
return "unknow";
}
function is_openkylin():Boolean{
const { status, stdout, stderr } = spawnSync('cat', ['/etc/os-release']);
@ -101,6 +272,30 @@ export function activate(context: vscode.ExtensionContext) {
return false;
}
}
/*
return:"rpm" or "deb"
*/
function rpm_or_deb():string{
const { status, stdout, stderr } = spawnSync('cat', ['/etc/os-release']);
if (status !== 0) {
console.error(`执行错误:${stderr}`);
return "false";
}
// 获取NAME字段的值
const nameField = stdout.toString().match(/NAME="([^"]+)"/);
console.log("cat /etc/os-release")
if (nameField && nameField[1].includes("Server")) {
console.log('是rpm系统');
return "rpm";
} else {
console.log('是deb系统');
//isOpenkylin = true
return "deb";
}
}
@ -129,8 +324,9 @@ export function activate(context: vscode.ExtensionContext) {
{
//no __lll_lock_wait
let isOpenkylin =is_openkylin();//openkylin flag
if(form.dead_type== 1 && isOpenkylin == false){
let sys_flag = rpm_or_deb();
if(form.dead_type== 1 && isOpenkylin == false && sys_flag == "deb"){
//__lll_lock_wait
try{
cmdout = execSync(`cat ${__dirname}/../detect-tools/.user.pwd | sudo -S ${__dirname}/../detect-tools/${arch}/detect_deadlock ${form.pid}`).toString();
@ -144,7 +340,94 @@ export function activate(context: vscode.ExtensionContext) {
res: form});
}
}else if(form.dead_type== 1 && sys_flag == "rpm" && (arch =="arm64" || arch == "aarch64") ){
//服务器版本互斥锁
let info_threads = gdb_cmdof_info_thread(form.pid);
let lwp_to_thread_id = get_threadid_lwp_relation(info_threads);
let mutex_info = judge_mutex(form.pid,lwp_to_thread_id,"__gthread_mutex_lock");
if(mutex_info.length != 0){
console.log("start to send message")
form.mutexflag = true;
form.arch = "arm";
form.sys = "rpm";
form.success = 'success';
form.thread_mutexlock_info = mutex_info;
panel.webview.postMessage({
res: form});
}else{
form.mutexflag = false;
form.success='success';
form.arch = "arm";
form.sys = "rpm";
panel.webview.postMessage({
res: form});
}
}else if(form.dead_type == 1 && isOpenkylin == true && arch =="x86_64"){
//openkylin && x86
let info_threads = gdb_cmdof_info_thread(form.pid);
let lwp_to_thread_id = get_threadid_lwp_relation(info_threads);
let mutex_info = judge_mutex(form.pid,lwp_to_thread_id,"__GI___lll_lock_wait");
if(mutex_info.length !=0){
form.openkylin = true;
form.mutexflag = true;
form.arch = "x86";
form.success = 'success';
form.thread_mutexlock_info = mutex_info;
panel.webview.postMessage({
res: form});
}else{
form.openkylin = true;
form.mutexflag = false;
form.success='success';
form.arch = "x86"
panel.webview.postMessage({
res: form});
}
}else if((form.dead_type == 2 || form.dead_type == 3) && sys_flag == "deb" ){
//deb
let info_threads = gdb_cmdof_info_thread(form.pid);
let lwp_to_thread_id = get_threadid_lwp_relation(info_threads);
if(form.dead_type == 2){
let rwlock_info = judge_rwlock(form.pid,lwp_to_thread_id,"__pthread_rwlock_");
if(rwlock_info.length != 0){
form.rwflag = true;
form.arch = "loong64-arm64";
form.sys = "deb";
form.success = 'success';
form.thread_rwlock_info = rwlock_info;
panel.webview.postMessage({
res: form});
}else{
form.rwflag = false;
form.success='success';
form.arch = "loong64-arm64";
form.sys = "deb";
panel.webview.postMessage({
res: form});
}
}
if(form.dead_type == 3){
let blocked_threads = judge_semlock(form.pid,lwp_to_thread_id,"do_futex_wait");
if(Object.keys(blocked_threads).length != 0){
form.semflag = true;
form.arch = "loong64-arm64";
form.success='success';
form.blockedThread = blocked_threads;
panel.webview.postMessage({
res: form});
}else{
form.semflag = false
form.success='success';
form.arch = "loong64-arm64"
panel.webview.postMessage({
res: form});
}
}
}
/*
if(form.dead_type == 2 || form.dead_type == 3 ||(form.dead_type== 1 && isOpenkylin == true)){
try{
if(arch == "loong64" || arch =="arm64" || isOpenkylin == true){
@ -166,22 +449,21 @@ export function activate(context: vscode.ExtensionContext) {
let blocked_threads={};
let thread_rwlock_info:rwlock_infomation[]=[];
let thread_mutexlock_info:rwlock_infomation[]=[];
//console.log("AAAA:start to loongarch");
//start--- get info threads infomation
let temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${form.pid} -ex "info threads" -ex "q" `;
cmdout = execSync(temcmd).toString();
//console.log("BBBB:",cmdout)
let newcmdout = cmdout.trim().split('\n')
console.log("CCCC:",newcmdout)
/////////////////////////////
const regex = /[\s\*]*(\d+).*Thread.*\(LWP (\d+)\).*/;
///////////////////////////////////
/*
for(let i=0;i<newcmdout.length;i++){
const match = newcmdout[i].match(regex);
if(match){
let thread_id = match[1];
let thread_lwp = match[2];
lwp_to_thread_id[thread_lwp] = thread_id
console.log("thread_id:",thread_id)
console.log("thread_lwp_id:",thread_lwp)
console.log("lwp_to_thread_id:",lwp_to_thread_id)
//获取死锁类型semlock或者rwlock
if(form.dead_type== 1 && isOpenkylin == true){
WAITLIST = ["futex_wait"]
@ -235,30 +517,7 @@ export function activate(context: vscode.ExtensionContext) {
break
}
}
/*
for(let j=frame_lines.length-1;j>=0;j--){
if(frame_lines[j].startsWith("#")){
const regex: RegExp = /<([a-zA-Z0-9_]+)>/;
const matches: RegExpMatchArray | null = frame_lines[j].match(regex);
const regex1: RegExp = /0x[0-9a-f]+/;;
const matches1: RegExpMatchArray | null = frame_lines[j].match(regex1);
if (matches1 !== null) {
mutex_address= matches1[0];
console.log(`The address is: ${mutex_address}`);
} else {
console.log('No address found');
}
if (matches !== null) {
mutexName = matches[1];
console.log(`The mutex name is: ${mutexName}`);
} else {
console.log('No mutex name found');
}
break
}
}
*/
//print mutexName.owner
let mutex_owner= mutexName +"._M_mutex.__data.__owner"
temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${form.pid} -ex "info threads" -ex "thread ${thread_id}" -ex "p ${mutex_owner}" -ex "q"`;
@ -306,11 +565,7 @@ export function activate(context: vscode.ExtensionContext) {
mutex_type = "rwlock";
blocked_threads[thread_lwp] = mutex_type
//frame 1 获取读写锁变量,不确定读取frame n的n值故采用bt
/*
temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${form.pid} -ex "info threads" -ex "thread ${thread_id}" -ex "frame 1" -ex "q"`;
cmdout = execSync(temcmd).toString();
console.log("读写锁frame 1:",cmdout.length)
*/
let frame_lines = cmdout.trim().split('\n')
let LWP_rwlock = '';
let LWP_rwlock_address = '';
@ -368,59 +623,6 @@ export function activate(context: vscode.ExtensionContext) {
}else{
continue
}
/*
if(matches1){
if(matches1[0].includes("LWP ")){
console.log("不符合要求")
}else{
LWP_rwlock_address=matches1[1];
LWP_rwlock=matches1[1].replace(/\&/g,'');
LWP_write_owner=LWP_rwlock+".__data.__cur_writer"
console.log("RRRRRRR:",LWP_rwlock);
temcmd = `cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -q -p ${form.pid} -ex "info threads" -ex "thread ${thread_id}" -ex "p ${LWP_rwlock_address}" -ex "p ${LWP_rwlock}" -ex "p ${LWP_write_owner}" -ex "q"`;
cmdout = execSync(temcmd).toString()
let rwlock_info = cmdout.trim().split('\n');
let findall = 0;
let rwlock_value='';
let rwlock_owner='';
console.log("TTTTTTT:",rwlock_info)
for(let k=rwlock_info.length-1;k>0;k--){
if(findall == 2){
break;
}else{
if(rwlock_info[k].startsWith("$3")){
//rwlock writer_owner
findall+=1;
let tempinfo = rwlock_info[k].split("=");
if(Number(tempinfo[1])!=0){
rwlock_owner = tempinfo[1];
}
}else if(rwlock_info[k].startsWith("$1")){
//rwlock value
findall+=1;
let tempinfo = rwlock_info[k].split(" ");
for(let m=tempinfo.length-1;m>0;m--){
if(tempinfo[m].startsWith("0x")){
rwlock_value=tempinfo[m];
break;
}
}
}
}
}
const rwlock_info_temp:rwlock_infomation={
threadID:thread_lwp,
lockID:rwlock_value,
lockowner:rwlock_owner
};
thread_rwlock_info.push(rwlock_info_temp)
}
}
*/
}
}
@ -484,11 +686,6 @@ export function activate(context: vscode.ExtensionContext) {
}
}else{
cmdout = execSync(`cat ${__dirname}/../detect-tools/.user.pwd | sudo -S gdb -batch -quiet -p ${form.pid} -x ${__dirname}/../detect-tools/${arch}/sem_rw_deadlock.py -ex 'deadlock' `).toString();
form.data =cmdout;
@ -503,8 +700,7 @@ export function activate(context: vscode.ExtensionContext) {
res: form});
}
}
*/
}else{
vscode.window.showErrorMessage(`当前不存在${form.pid}进程`);
form.shuaxin = true;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script type="module" crossorigin src="/assets/index.805d1f9b.js"></script>
<script type="module" crossorigin src="/assets/index.e397990e.js"></script>
<link rel="stylesheet" href="/assets/index.6c6af714.css">
<script type="module">try{import("_").catch(()=>1);}catch(e){}window.__vite_is_dynamic_import_support=true;</script>
<script type="module">!function(){if(window.__vite_is_dynamic_import_support)return;console.warn("vite: loading legacy build because dynamic import is unsupported, syntax error above should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
@ -15,6 +15,6 @@
<script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
<script nomodule id="vite-legacy-polyfill" src="/assets/polyfills-legacy.82d708a7.js"></script>
<script nomodule id="vite-legacy-entry" data-src="/assets/index-legacy.7840883a.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
<script nomodule id="vite-legacy-entry" data-src="/assets/index-legacy.28a78ceb.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
</body>
</html>

View File

@ -294,6 +294,22 @@ export default {
if (event.data.res.CmdType == 1) {
if(this.c_dead_type == 3){
if(event.data.res.shuaxin == true){
this.local_thread_data = ''
this.thread_info = []
let echartsData=this.getdeadgraphData(this.thread_info);
this.deadgraph(echartsData);
if(event.data.res.wrongpid == true){
this.$message({
message: "进程号不存在或错误!",
})
}
if(event.data.res.wrongpasswd == true){
this.$message({
message: "密码错误!",
})
}
}
if(event.data.res.arch == "loong64-arm64"){
if(event.data.res.semflag == true){
this.local_thread_data = ''
@ -307,16 +323,24 @@ export default {
this.local_thread_data += "因等待信号量而阻塞"
this.$message({
message: "发现信号量死锁!",
})
})
this.thread_info = []
let echartsData=this.getdeadgraphData(this.thread_info);
this.deadgraph(echartsData);
}else{
this.loading1 = false;
console.log("未发现信号量死锁:",this.local_thread_data)
this.local_thread_data = ''
this.$message({
message: "未发现信号量死锁!",
})
message: "未发现信号量死锁!",
})
this.thread_info = []
let echartsData=this.getdeadgraphData(this.thread_info);
this.deadgraph(echartsData);
}
}else{//not loongarch
}/*else{//not loongarch
this.loading1 = false;
if(event.data.res.success=='success') {
this.drawDeadGraph(event.data.res.data);
}else{
@ -337,8 +361,24 @@ export default {
}
}
}
}
}*/
}else if(this.c_dead_type == 2){
if(event.data.res.shuaxin == true){
this.local_thread_data = ''
this.thread_info = []
let echartsData=this.getdeadgraphData(this.thread_info);
this.deadgraph(echartsData);
if(event.data.res.wrongpid == true){
this.$message({
message: "进程号不存在或错误!",
})
}
if(event.data.res.wrongpasswd == true){
this.$message({
message: "密码错误!",
})
}
}
if(event.data.res.arch == "loong64-arm64"){
if(event.data.res.rwflag == true){
this.thread_info = [];
@ -370,7 +410,7 @@ export default {
this.$message({
message: "发现读写锁死锁!",
})
}else{//loongarch
}else{
console.log("未发现读写锁死锁:",this.local_thread_data)
this.$message({
message: "未发现读写锁死锁!",
@ -380,7 +420,7 @@ export default {
let echartsData=this.getdeadgraphData(this.thread_info);
this.deadgraph(echartsData);
}
}else{//not loongarch
}/*else{//not loongarch
if(event.data.res.success=='success') {
this.drawDeadGraph(event.data.res.data);
}else{
@ -401,10 +441,23 @@ export default {
}
}
}
}
}*/
}else if(this.c_dead_type == 1 && event.data.res.openkylin == true){
if(event.data.res.openkylin == true){
console.log("hi,openkylin!!!")
if(event.data.res.shuaxin == true){
this.local_thread_data = ''
this.thread_info = []
let echartsData=this.getdeadgraphData(this.thread_info);
this.deadgraph(echartsData);
if(event.data.res.wrongpid == true){
this.$message({
message: "进程号不存在或错误!",
})
}
if(event.data.res.wrongpasswd == true){
this.$message({
message: "密码错误!",
})
}
}
if(event.data.res.mutexflag == true){
this.thread_info = [];
@ -436,7 +489,7 @@ export default {
this.$message({
message: "发现互斥锁死锁!",
})
}else{//loongarch
}else{
console.log("未发现互斥锁死锁:",this.local_thread_data)
this.$message({
message: "未发现互斥锁死锁!",
@ -447,7 +500,7 @@ export default {
this.deadgraph(echartsData);
}
}
else{//
else{//fzw deb
if(event.data.res.success=='success'){
this.drawDeadGraph(event.data.res.data);
}else{
@ -742,7 +795,9 @@ export default {
}
}
},
/*
C/C++死锁关系图对外接口
*/
drawDeadGraph(data){
if(this.c_dead_type==1){
if(/没有发现死锁/g.test(data)){
@ -773,7 +828,9 @@ export default {
}
},
/*
c/c++死锁关系图节点数据格式化,改用echartsInit
*/
getdeadgraphData(lockInfo){
let data=[];
let createdNodeArr=[];
@ -932,7 +989,9 @@ export default {
};
return returnData;
},
/*
c/c++死锁关系图
*/
deadgraph(echartsData) {
let myChart = echarts.init(document.getElementById(this.activeName == "first" ? "main_local" : "main_remote"));
let option = {
@ -978,7 +1037,9 @@ export default {
this.loading1 = false;
this.loading2 = false;
},
/*
根据jstack输出信息提取锁信息
*/
javalockInfoInit(data,arch){
/*
判断信号量死锁 this.java_dead_type == 1
@ -1039,7 +1100,7 @@ export default {
console.log("BBBB htmlInfoStr",htmlInfoStr)
}else{
if(item&&item.indexOf("java.lang.Thread.State: WAITING")!=-1){
// item
/*将字符串 item 两端的空白字符删除,然后按照换行符将字符串分割成多个子串*/
this.semlockflag = true
let infoObj={};
let htmlInfoStr='';
@ -1048,7 +1109,7 @@ export default {
splitItemArr.forEach((item1,index)=>{
console.log("origin info item1 is:",item1)
let lineReg=/a java.util.concurrent.Semaphore\$NonfairSync/;
//线线
/*线程号或线程名*/
if(index==0){
let match = item1.match(/"([^"]+)"/);
if(match){
@ -1057,7 +1118,6 @@ export default {
let threadName=item1.split('nid=')[1].split(' ')[0];
threadName=parseInt(threadName,16)
infoObj.threadName = threadName;
//infoObj.threadNum = threadName;
}
//
if(item1.includes('<') && item1.includes('>')){
@ -1178,7 +1238,9 @@ export default {
});
}
},
/*
java 互斥锁信息格式化
*/
deadTableData(b1,arch){
let c='';
if(arch&&(arch=='loong64'||arch=='loongarch64'||arch=='la64'||arch=='arm64'||arch=='sw_64'||arch=='mips64el')){//longxin5000FT2000/4LS3A4000
@ -1231,7 +1293,9 @@ export default {
"lockTableInfo":d1
}
},
/*
c/c++死锁关系图节点数据格式化
*/
echartsInit(lockInfo) {
let data=[];
let createdNodeArr=[];
@ -1422,7 +1486,9 @@ export default {
option && myChart.setOption(option);
this.loading3 = false;//java
},
/*
java死锁关系图节点数据格式化
*/
javasemgetEchartsData(lockInfo){
let data=[];
let createdNodeArr=[];
@ -1491,7 +1557,9 @@ export default {
console.log(returnData)
return returnData;
},
/*
java死锁关系图
*/
javasemechartsInit(echartsData) {
var myChart = echarts.init(document.getElementById("mainChart"));
let option = {