Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build_support/localization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ const MENU_STATUS_HELP_KEYS: &[(&str, &str)] = &[
"IDM_PROC_COLLAPSE",
"crate::ui::resource_ids::IDM_PROC_COLLAPSE",
),
("IDM_PROC_DUMP", "crate::ui::resource_ids::IDM_PROC_DUMP"),
];

pub(crate) fn generate() {
Expand Down
6 changes: 6 additions & 0 deletions localization/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "Prozess&baum"
ExpandProcess = "&Erweitern"
CollapseProcess = "&Zuklappen"
OpenFileLocation = "Open File &Location"
CreateDumpFile = "Abbilddatei erstellen (&F)"
Debug = "&Debuggen"
SetPriority = "&Prioritaet festlegen"
Realtime = "&Echtzeit"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "Keine Rueckmeldung"
Running = "Wird ausgefuehrt"
MessageCouldNotBeSent = "Die Nachricht konnte nicht gesendet werden."
UnableToOpenFileLocation = "Unable to Open File Location"
UnableToCreateDumpFile = "Die Abbilddatei konnte nicht erstellt werden"
DumpFileCreated = "Die Abbilddatei wurde erstellt."
DumpFileFilter = "Abbilddateien"
DumpCleanupFailed = "Die temporäre Abbilddatei konnte nicht gelöscht werden."
KillProcessTreePrompt = """This operation will attempt to terminate this process and any
processes which were directly or indirectly started by it.

Expand Down Expand Up @@ -368,3 +373,4 @@ IDM_SERVICE_GOTOPROCESS = "Wählt den Prozess des Diensts auf der Seite Prozesse
IDM_PROC_TREE = "Gruppiert Prozesse unter dem übergeordneten Prozess, der sie erstellt hat"
IDM_PROC_EXPAND = "Zeigt die untergeordneten Prozesse der Auswahl"
IDM_PROC_COLLAPSE = "Blendet die untergeordneten Prozesse der Auswahl aus"
IDM_PROC_DUMP = "Schreibt ein vollständiges Speicherabbild dieses Prozesses in eine gewählte Datei"
6 changes: 6 additions & 0 deletions localization/en_us.toml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ ProcessTree = "Process &Tree"
ExpandProcess = "E&xpand"
CollapseProcess = "C&ollapse"
OpenFileLocation = "Open File &Location"
CreateDumpFile = "Create Dump &File"
Debug = "&Debug"
SetPriority = "Set &Priority"
Realtime = "&Realtime"
Expand Down Expand Up @@ -296,6 +297,10 @@ NotResponding = "Not Responding"
Running = "Running"
MessageCouldNotBeSent = "The message could not be sent."
UnableToOpenFileLocation = "Unable to Open File Location"
UnableToCreateDumpFile = "Unable to Create Dump File"
DumpFileCreated = "The dump file was created."
DumpFileFilter = "Dump Files"
DumpCleanupFailed = "The temporary dump file could not be deleted."
KillProcessTreePrompt = """This operation will attempt to terminate this process and any
processes which were directly or indirectly started by it.

Expand Down Expand Up @@ -375,3 +380,4 @@ IDM_SERVICE_GOTOPROCESS = "Selects the service process on the Processes page"
IDM_PROC_TREE = "Groups processes under the parent that created them"
IDM_PROC_EXPAND = "Shows the child processes of the selection"
IDM_PROC_COLLAPSE = "Hides the child processes of the selection"
IDM_PROC_DUMP = "Writes a full memory dump of this process to a file you choose"
6 changes: 6 additions & 0 deletions localization/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "Árbol de &procesos"
ExpandProcess = "&Expandir"
CollapseProcess = "&Contraer"
OpenFileLocation = "Open File &Location"
CreateDumpFile = "Crear archivo de volcado (&F)"
Debug = "&Depurar"
SetPriority = "Establecer &prioridad"
Realtime = "&Tiempo real"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "No responde"
Running = "En ejecucion"
MessageCouldNotBeSent = "No se pudo enviar el mensaje."
UnableToOpenFileLocation = "Unable to Open File Location"
UnableToCreateDumpFile = "No se puede crear el archivo de volcado"
DumpFileCreated = "Se creó el archivo de volcado."
DumpFileFilter = "Archivos de volcado"
DumpCleanupFailed = "No se pudo eliminar el archivo de volcado temporal."
KillProcessTreePrompt = """This operation will attempt to terminate this process and any
processes which were directly or indirectly started by it.

Expand Down Expand Up @@ -368,3 +373,4 @@ IDM_SERVICE_GOTOPROCESS = "Selecciona el proceso del servicio en la página Proc
IDM_PROC_TREE = "Agrupa los procesos bajo el proceso primario que los creó"
IDM_PROC_EXPAND = "Muestra los procesos secundarios de la selección"
IDM_PROC_COLLAPSE = "Oculta los procesos secundarios de la selección"
IDM_PROC_DUMP = "Escribe un volcado de memoria completo de este proceso en un archivo elegido"
6 changes: 6 additions & 0 deletions localization/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "Ar&borescence des processus"
ExpandProcess = "Dé&velopper"
CollapseProcess = "&Réduire"
OpenFileLocation = "Open File &Location"
CreateDumpFile = "Créer un fichier de vidage (&F)"
Debug = "&Déboguer"
SetPriority = "Définir la &priorité"
Realtime = "&Temps réel"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "Ne repond pas"
Running = "En cours d'execution"
MessageCouldNotBeSent = "Le message n'a pas pu etre envoye."
UnableToOpenFileLocation = "Unable to Open File Location"
UnableToCreateDumpFile = "Impossible de créer le fichier de vidage"
DumpFileCreated = "Le fichier de vidage a été créé."
DumpFileFilter = "Fichiers de vidage"
DumpCleanupFailed = "Le fichier de vidage temporaire n'a pas pu être supprimé."
KillProcessTreePrompt = """This operation will attempt to terminate this process and any
processes which were directly or indirectly started by it.

Expand Down Expand Up @@ -368,3 +373,4 @@ IDM_SERVICE_GOTOPROCESS = "Sélectionne le processus du service dans la page Pro
IDM_PROC_TREE = "Regroupe les processus sous le parent qui les a créés"
IDM_PROC_EXPAND = "Affiche les processus enfants de la sélection"
IDM_PROC_COLLAPSE = "Masque les processus enfants de la sélection"
IDM_PROC_DUMP = "Écrit un vidage mémoire complet de ce processus dans un fichier choisi"
6 changes: 6 additions & 0 deletions localization/pt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "Árvore de &processos"
ExpandProcess = "&Expandir"
CollapseProcess = "&Recolher"
OpenFileLocation = "Open File &Location"
CreateDumpFile = "Criar arquivo de despejo (&F)"
Debug = "&Depurar"
SetPriority = "Definir &prioridade"
Realtime = "&Tempo real"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "Nao esta respondendo"
Running = "Em execucao"
MessageCouldNotBeSent = "Nao foi possivel enviar a mensagem."
UnableToOpenFileLocation = "Unable to Open File Location"
UnableToCreateDumpFile = "Não foi possível criar o arquivo de despejo"
DumpFileCreated = "O arquivo de despejo foi criado."
DumpFileFilter = "Arquivos de despejo"
DumpCleanupFailed = "Não foi possível excluir o arquivo de despejo temporário."
KillProcessTreePrompt = """This operation will attempt to terminate this process and any
processes which were directly or indirectly started by it.

Expand Down Expand Up @@ -368,3 +373,4 @@ IDM_SERVICE_GOTOPROCESS = "Seleciona o processo do serviço na página Processos
IDM_PROC_TREE = "Agrupa os processos sob o processo pai que os criou"
IDM_PROC_EXPAND = "Mostra os processos filhos da seleção"
IDM_PROC_COLLAPSE = "Oculta os processos filhos da seleção"
IDM_PROC_DUMP = "Grava um despejo de memória completo deste processo em um arquivo escolhido"
6 changes: 6 additions & 0 deletions localization/ru.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "&Дерево процессов"
ExpandProcess = "&Развернуть"
CollapseProcess = "&Свернуть"
OpenFileLocation = "Open File &Location"
CreateDumpFile = "Создать файл дампа (&F)"
Debug = "&Отладка"
SetPriority = "Задать &приоритет"
Realtime = "&Реального времени"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "Не отвечает"
Running = "Работает"
MessageCouldNotBeSent = "Сообщение не удалось отправить."
UnableToOpenFileLocation = "Unable to Open File Location"
UnableToCreateDumpFile = "Не удалось создать файл дампа"
DumpFileCreated = "Файл дампа создан."
DumpFileFilter = "Файлы дампа"
DumpCleanupFailed = "Не удалось удалить временный файл дампа."
KillProcessTreePrompt = """This operation will attempt to terminate this process and any
processes which were directly or indirectly started by it.

Expand Down Expand Up @@ -368,3 +373,4 @@ IDM_SERVICE_GOTOPROCESS = "Выбирает процесс службы на с
IDM_PROC_TREE = "Группирует процессы под родительским процессом, который их создал"
IDM_PROC_EXPAND = "Показывает дочерние процессы выбранного элемента"
IDM_PROC_COLLAPSE = "Скрывает дочерние процессы выбранного элемента"
IDM_PROC_DUMP = "Записывает полный дамп памяти этого процесса в выбранный файл"
6 changes: 6 additions & 0 deletions localization/zh_cn.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "进程树(&T)"
ExpandProcess = "展开(&X)"
CollapseProcess = "折叠(&O)"
OpenFileLocation = "打开文件位置(&L)"
CreateDumpFile = "创建转储文件(&F)"
Debug = "调试(&D)"
SetPriority = "设置优先级(&P)"
Realtime = "实时(&R)"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "未响应"
Running = "正在运行"
MessageCouldNotBeSent = "无法发送该消息。"
UnableToOpenFileLocation = "无法打开文件位置"
UnableToCreateDumpFile = "无法创建转储文件"
DumpFileCreated = "已创建转储文件。"
DumpFileFilter = "转储文件"
DumpCleanupFailed = "无法删除临时转储文件。"
KillProcessTreePrompt = """此操作将尝试终止该进程,以及所有由它直接或间接启动的进程。

以这种方式强制终止进程可能会导致数据丢失和系统不稳定。
Expand Down Expand Up @@ -365,3 +370,4 @@ IDM_SERVICE_GOTOPROCESS = "在进程页选中该服务的进程"
IDM_PROC_TREE = "按创建该进程的父进程分组显示"
IDM_PROC_EXPAND = "显示所选进程的子进程"
IDM_PROC_COLLAPSE = "隐藏所选进程的子进程"
IDM_PROC_DUMP = "将此进程的完整内存转储写入所选文件"
6 changes: 6 additions & 0 deletions localization/zh_tw.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ProcessTree = "處理程序樹(&T)"
ExpandProcess = "展開(&X)"
CollapseProcess = "摺疊(&O)"
OpenFileLocation = "開啟檔案位置(&L)"
CreateDumpFile = "建立傾印檔案(&F)"
Debug = "偵錯(&D)"
SetPriority = "設定優先順序(&P)"
Realtime = "即時(&R)"
Expand Down Expand Up @@ -289,6 +290,10 @@ NotResponding = "沒有回應"
Running = "執行中"
MessageCouldNotBeSent = "無法傳送訊息。"
UnableToOpenFileLocation = "無法開啟檔案位置"
UnableToCreateDumpFile = "無法建立傾印檔案"
DumpFileCreated = "已建立傾印檔案。"
DumpFileFilter = "傾印檔案"
DumpCleanupFailed = "無法刪除暫存傾印檔案。"
KillProcessTreePrompt = """此操作會嘗試終止此處理程序,以及所有由它直接或間接啟動的處理程序。

以這種方式強制終止處理程序可能會造成資料遺失與系統不穩定。
Expand Down Expand Up @@ -365,3 +370,4 @@ IDM_SERVICE_GOTOPROCESS = "在處理程序頁選取該服務的處理程序"
IDM_PROC_TREE = "依建立該處理程序的父處理程序分組顯示"
IDM_PROC_EXPAND = "顯示選取處理程序的子處理程序"
IDM_PROC_COLLAPSE = "隱藏選取處理程序的子處理程序"
IDM_PROC_DUMP = "將此處理程序的完整記憶體傾印寫入所選檔案"
1 change: 1 addition & 0 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,7 @@ impl App {
| IDM_PROC_TERMINATE
| IDM_PROC_ENDTREE
| IDM_PROC_OPENFILELOCATION
| IDM_PROC_DUMP
| IDM_PROC_REALTIME
| IDM_PROC_HIGH
| IDM_PROC_ABOVENORMAL
Expand Down
12 changes: 10 additions & 2 deletions src/app/page_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ use crate::ui::resource_ids::{
IDC_CPU_DETAIL_GRAPH, IDC_CPUMETER, IDC_GPU_SELECTOR, IDC_MEMGRAPH, IDC_MEMMETER,
IDC_NICTOTALS, IDC_PROCLIST, IDC_SERVICELIST, IDC_TASKLIST, IDC_USERLIST,
PWM_CPU_FIRMWARE_WORKER_COMPLETE, PWM_CPU_WORKER_COMPLETE, PWM_GPU_METADATA_WORKER_COMPLETE,
PWM_GPU_WORKER_COMPLETE, PWM_NET_WORKER_COMPLETE, PWM_PROC_WORKER_COMPLETE,
PWM_SERVICE_WORKER_COMPLETE, PWM_TASK_WORKER_COMPLETE, PWM_USER_WORKER_COMPLETE,
PWM_GPU_WORKER_COMPLETE, PWM_NET_WORKER_COMPLETE, PWM_PROC_DUMP_COMPLETE,
PWM_PROC_WORKER_COMPLETE, PWM_SERVICE_WORKER_COMPLETE, PWM_TASK_WORKER_COMPLETE,
PWM_USER_WORKER_COMPLETE,
};
use crate::ui::runtime_menu::MenuBar;

Expand Down Expand Up @@ -617,6 +618,13 @@ impl PageState {
}
_ => None,
},
PWM_PROC_DUMP_COMPLETE => match self {
Self::Process(state) => {
state.handle_dump_worker_completion();
Some(1)
}
_ => None,
},
PWM_CPU_WORKER_COMPLETE => match self {
Self::Cpu(state) => {
state.handle_native_worker_completion();
Expand Down
30 changes: 30 additions & 0 deletions src/infrastructure/diagnostics/crash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,25 @@ const TEST_CRASH_ENVIRONMENT: &str = "TASKMGR_RS_DIAGNOSTIC_TEST_CRASH";

static CRASH_DIRECTORY: OnceLock<Box<[u16]>> = OnceLock::new();
static MINIDUMP_ENABLED: AtomicBool = AtomicBool::new(false);
/// Process-wide gate for `MiniDumpWriteDump`.
///
/// DbgHelp is not reentrant. The exception filter must not wait, allocate, or
/// take a lock, so this is one atomic compare-exchange.
static DBGHELP_DUMP_GATE: AtomicBool = AtomicBool::new(false);

/// Acquires the process-wide `MiniDumpWriteDump` gate without waiting.
///
/// Safe on the exception thread: one atomic compare-exchange, no allocation and no lock.
pub(crate) fn try_acquire_dbghelp_dump() -> bool {
DBGHELP_DUMP_GATE
.compare_exchange(false, true, Ordering::AcqRel, Ordering::Acquire)
.is_ok()
}

/// Releases the gate acquired by `try_acquire_dbghelp_dump`.
pub(crate) fn release_dbghelp_dump() {
DBGHELP_DUMP_GATE.store(false, Ordering::Release);
}

#[derive(Clone, Copy)]
struct NulTerminatedWide<'a> {
Expand Down Expand Up @@ -187,8 +206,10 @@ unsafe extern "system" fn unhandled_exception_filter(

if MINIDUMP_ENABLED.load(Ordering::Acquire)
&& let Some(path) = build_crash_path(&mut path, pid, tid, ".dmp")
&& try_acquire_dbghelp_dump()
{
write_minidump(path, pid, tid, &exception);
release_dbghelp_dump();
}

EXCEPTION_CONTINUE_SEARCH
Expand Down Expand Up @@ -505,6 +526,15 @@ mod tests {
assert_eq!(exception_details(&exception), (0, 0));
}

#[test]
fn dbghelp_dump_gate_does_not_wait_for_the_holder() {
assert!(try_acquire_dbghelp_dump());
assert!(!try_acquire_dbghelp_dump());
release_dbghelp_dump();
assert!(try_acquire_dbghelp_dump());
release_dbghelp_dump();
}

#[test]
fn controlled_crash_requires_the_exact_opt_in_value() {
assert!(test_crash_value_requested(Some(OsStr::new(
Expand Down
2 changes: 2 additions & 0 deletions src/infrastructure/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ mod archive;
mod crash;
mod secure_fs;

pub(crate) use crash::{release_dbghelp_dump, try_acquire_dbghelp_dump};

use std::cell::Cell;
use std::env;
use std::ffi::{OsStr, OsString};
Expand Down
Loading