modify detect-plugin/README.md & fix sshpass pop-up notification error
This commit is contained in:
parent
081127d4e0
commit
4dfd45a8b2
|
@ -1,9 +1,8 @@
|
|||
# C/C++ 程序锁分析
|
||||
#### [仓库](https://gitee.com/openkylin/deadlock-detect)
|
||||
|
||||
## 介绍
|
||||
|
||||
deadlock-detect 是一款基于OpenKylin社区kylin-code的拓展插件,用于C/C++程序的死锁检测及锁状态分析,帮助开发者在Linux系统下识别多线程死锁状态、互斥锁自旋锁等状态异常问题。
|
||||
deadlock-detect 用于C/C++程序的死锁检测及锁状态分析,帮助开发者在Linux系统下识别多线程死锁状态、互斥锁状态异常问题。
|
||||
|
||||
---
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
(()=>{"use strict";var e={496:e=>{e.exports=require("vscode")},81:e=>{e.exports=require("child_process")},147:e=>{e.exports=require("fs")},17:e=>{e.exports=require("path")},282:e=>{e.exports=require("process")}},s={};function t(r){var o=s[r];if(void 0!==o)return o.exports;var c=s[r]={exports:{}};return e[r](c,c.exports,t),c.exports}var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.deactivate=e.activate=void 0;const s=t(496),o=t(17),c=t(147),i=t(81);t(81);const{pid:n}=t(282);e.activate=function(e){console.log('Congratulations, your extension "deadlock-detect" is now active!');let t=process.arch;function r(e){(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd ssh -o StrictHostKeyChecking=no ${e.user}@${e.ip} 'rm -rf .user.pwd detect.sh detect_deadlock'`),c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}"x64"==t&&(t="x86_64"),s.commands.registerCommand("deadlock-detect.open",(()=>{const e=s.window.createWebviewPanel("deadlockdetectWebview","C/C++进程死锁检测",s.ViewColumn.One,{enableScripts:!0,retainContextWhenHidden:!0});e.webview.onDidReceiveMessage((o=>{switch(o.form.CmdType){case 1:!function(e,r){let o=e.form,n="";c.writeFileSync(`${__dirname}/../detect-tools/.user.pwd`,`${o.pwd}`,{encoding:"utf8",flag:"w"}),1===o.CmdType&&function(e){try{(0,i.execSync)(`cat ${__dirname}/../detect-tools/.user.pwd | sudo -S ls /root/`),e(!0)}catch(s){e(!1)}}((e=>{if(e)if(c.existsSync(`/proc/${o.pid}`))try{n=(0,i.execSync)(`cat ${__dirname}/../detect-tools/.user.pwd | sudo -S ${__dirname}/../detect-tools/${t}/detect_deadlock ${o.pid}`).toString(),o.data=n,o.success="success",r.webview.postMessage({res:o})}catch(e){o.success="error",r.webview.postMessage({res:o})}else s.window.showErrorMessage(`当前不存在${o.pid}进程`);else s.window.showErrorMessage("用户密码不匹配")})),c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}(o,e);break;case 3:!function(e,t){let o=e.form,n="",d="";c.writeFileSync(`${__dirname}/../detect-tools/.user.pwd`,`${o.pwd}`,{encoding:"utf8",flag:"w"});try{d=(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd ssh -o StrictHostKeyChecking=no ${o.user}@${o.ip} 'uname -m'`).toString()}catch(e){return s.window.showErrorMessage(`${e.message}`),void c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}d.includes("aarch64")?d="arm64":d.includes("x64")||d.includes("x86_64")?d="x86_64":d.includes("loongarch64")&&(d="loong64");try{n=(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd scp -o StrictHostKeyChecking=no ${__dirname}/../detect-tools/.user.pwd ${__dirname}/../detect-tools/detect.sh ${__dirname}/../detect-tools/${d}/detect_deadlock ${o.user}@${o.ip}:./`).toString()}catch(e){let t=`${e.message}`;return t.includes("Permission denied, please try again")?s.window.showErrorMessage("远程主机用户名或密码错误"):t.includes("scp:")?s.window.showErrorMessage("远程主机无法拷贝文件, 请确认登录用户是否拥有权限."):s.window.showErrorMessage(t),void c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}n="";try{n=(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd ssh -o StrictHostKeyChecking=no ${o.user}@${o.ip} 'bash detect.sh ${o.pid};'`).toString()}catch(e){let c=`${e.message}`;return c.includes("ls:")?s.window.showErrorMessage(`远程主机不存在${o.pid}进程`):c.includes("Permission denied, please try again")?s.window.showErrorMessage("远程主机用户名或密码错误"):(console.log(c),s.window.showErrorMessage("远程主机无法路由,或其他未知错误"),o.success="error",t.webview.postMessage({res:o})),void r(o)}o.data=n,o.success="success",t.webview.postMessage({res:o}),r(o)}(o,e)}})),e.webview.html=function(e,t){const r=o.join(o.dirname(__dirname),"dist/index.html"),i=o.dirname(r);let n=c.readFileSync(r,"utf-8");return n=n.replace(/(<link.+?href="|<script.+?src="|<img.+?src=")(.+?)"/g,((e,t,r)=>("/"===r[0]&&(r="."+r),t+s.Uri.file(o.resolve(i,r)).with({scheme:"vscode-resource"}).toString()+'"'))),n}()})),(0,i.exec)("which sshpass",((e,t,r)=>{e&&s.window.showWarningMessage("当前环境缺失sshpass工具,C/C++程序远程死锁检测功能受限,请执行 sudo apt install sshpass 安装.")}))},e.deactivate=function(){}})(),module.exports=r})();
|
||||
(()=>{"use strict";var e={496:e=>{e.exports=require("vscode")},81:e=>{e.exports=require("child_process")},147:e=>{e.exports=require("fs")},17:e=>{e.exports=require("path")},282:e=>{e.exports=require("process")}},s={};function t(r){var o=s[r];if(void 0!==o)return o.exports;var c=s[r]={exports:{}};return e[r](c,c.exports,t),c.exports}var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.deactivate=e.activate=void 0;const s=t(496),o=t(17),c=t(147),i=t(81);t(81);const{pid:n}=t(282);e.activate=function(e){console.log('Congratulations, your extension "deadlock-detect" is now active!');let t=process.arch;function r(e){(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd ssh -o StrictHostKeyChecking=no ${e.user}@${e.ip} 'rm -rf .user.pwd detect.sh detect_deadlock'`),c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}"x64"==t&&(t="x86_64"),s.commands.registerCommand("deadlock-detect.open",(()=>{const e=s.window.createWebviewPanel("deadlockdetectWebview","C/C++进程死锁检测",s.ViewColumn.One,{enableScripts:!0,retainContextWhenHidden:!0});e.webview.onDidReceiveMessage((o=>{switch(o.form.CmdType){case 1:!function(e,r){let o=e.form,n="";c.writeFileSync(`${__dirname}/../detect-tools/.user.pwd`,`${o.pwd}`,{encoding:"utf8",flag:"w"}),1===o.CmdType&&function(e){try{(0,i.execSync)(`cat ${__dirname}/../detect-tools/.user.pwd | sudo -S ls /root/`),e(!0)}catch(s){e(!1)}}((e=>{if(e)if(c.existsSync(`/proc/${o.pid}`))try{n=(0,i.execSync)(`cat ${__dirname}/../detect-tools/.user.pwd | sudo -S ${__dirname}/../detect-tools/${t}/detect_deadlock ${o.pid}`).toString(),o.data=n,o.success="success",r.webview.postMessage({res:o})}catch(e){o.success="error",r.webview.postMessage({res:o})}else s.window.showErrorMessage(`当前不存在${o.pid}进程`);else s.window.showErrorMessage("用户密码不匹配")})),c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}(o,e);break;case 3:!function(e,t){let o=e.form,n="",d="";c.writeFileSync(`${__dirname}/../detect-tools/.user.pwd`,`${o.pwd}`,{encoding:"utf8",flag:"w"});try{d=(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd ssh -o StrictHostKeyChecking=no ${o.user}@${o.ip} 'uname -m'`).toString()}catch(e){return s.window.showErrorMessage(`${e.message}`),void c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}d.includes("aarch64")?d="arm64":d.includes("x64")||d.includes("x86_64")?d="x86_64":d.includes("loongarch64")&&(d="loong64");try{n=(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd scp -o StrictHostKeyChecking=no ${__dirname}/../detect-tools/.user.pwd ${__dirname}/../detect-tools/detect.sh ${__dirname}/../detect-tools/${d}/detect_deadlock ${o.user}@${o.ip}:./`).toString()}catch(e){let t=`${e.message}`;return t.includes("Permission denied, please try again")?s.window.showErrorMessage("远程主机用户名或密码错误"):t.includes("scp:")?s.window.showErrorMessage("远程主机无法拷贝文件, 请确认登录用户是否拥有权限."):s.window.showErrorMessage(t),void c.unlinkSync(`${__dirname}/../detect-tools/.user.pwd`)}n="";try{n=(0,i.execSync)(`sshpass -f ${__dirname}/../detect-tools/.user.pwd ssh -o StrictHostKeyChecking=no ${o.user}@${o.ip} 'bash detect.sh ${o.pid};'`).toString()}catch(e){let c=`${e.message}`;return c.includes("ls:")?s.window.showErrorMessage(`远程主机不存在${o.pid}进程`):c.includes("Permission denied, please try again")?s.window.showErrorMessage("远程主机用户名或密码错误"):(console.log(c),s.window.showErrorMessage("远程主机无法路由,或其他未知错误"),o.success="error",t.webview.postMessage({res:o})),void r(o)}o.data=n,o.success="success",t.webview.postMessage({res:o}),r(o)}(o,e)}})),e.webview.html=function(e,t){const r=o.join(o.dirname(__dirname),"dist/index.html"),i=o.dirname(r);let n=c.readFileSync(r,"utf-8");return n=n.replace(/(<link.+?href="|<script.+?src="|<img.+?src=")(.+?)"/g,((e,t,r)=>("/"===r[0]&&(r="."+r),t+s.Uri.file(o.resolve(i,r)).with({scheme:"vscode-resource"}).toString()+'"'))),n}()}))},e.deactivate=function(){}})(),module.exports=r})();
|
|
@ -184,13 +184,14 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
panel.webview.html = getWebViewContent(context, 'dist/index.html');
|
||||
});
|
||||
// 进程锁分析
|
||||
/*
|
||||
exec(`which sshpass`, (e, o, err)=>{
|
||||
if(e){
|
||||
vscode.window.showWarningMessage('当前环境缺失sshpass工具,C/C++程序远程死锁检测功能受限,请执行 sudo apt install sshpass 安装.');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
// C/C++ 程序检测任务machunyu
|
||||
/*
|
||||
const workspaceRoot = (vscode.workspace.workspaceFolders && (vscode.workspace.workspaceFolders.length > 0)) ? vscode.workspace.workspaceFolders[0].uri.fsPath : homedir();
|
||||
|
|
Loading…
Reference in New Issue