From a0db96d50d6fc9738d7e4790e4cf4ee59bd531bd Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 21 May 2025 12:54:58 +0100 Subject: [PATCH 1/2] Add docs for debugging element desktop mostly for the magic to flip the fuses --- docs/SUMMARY.md | 1 + docs/debugging.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 docs/debugging.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index e476b2f..339b00e 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -6,6 +6,7 @@ - [Native Node modules](native-node-modules.md) - [Windows requirements](windows-requirements.md) +- [Debugging](debugging.md) - [Using gdb](gdb.md) # Distribution diff --git a/docs/debugging.md b/docs/debugging.md new file mode 100644 index 0000000..a028c88 --- /dev/null +++ b/docs/debugging.md @@ -0,0 +1,24 @@ +# Debugging Element-Desktop + +There are two parts of the desktop app that you might want to debug. + +## The renderer process +This is the regular element-web codeand can be debugged by just selecting 'toggle developer tools' +from the menu, even on ppackaged builds. This then works the same as chrome dev tools for element web. + +## The main process +This is debugged as a node app, so: + 1. Open any chrome dev tools window + 1. Start element with the `--inspect-brk` flag + 1. Notice that you now have a little green icon in the top left of your chrome devtools window, click it. + +You are now debugging the code of the desktop app itself. + +## The main process of a package app +When the app is shipped, electron's "fuses" are flipped, editing the electron binary itself to prevent certain features from being usable, one of which is debugging using `--inspect-brk` as above. You can flip the fuse back on Linux as follows: + +``` +sudo npx @electron/fuses write --app /opt/Element/element-desktop EnableNodeCliInspectArguments=on +``` + +A similar command will work, in theory, on mac and windows, except that this will break code signing (which is the point of fuses) so you would have to re-sign the app or somesuch. From 20f28abb4754164f17867fe40dec547c9db94dba Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 21 May 2025 13:00:45 +0100 Subject: [PATCH 2/2] prettier --- docs/debugging.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/debugging.md b/docs/debugging.md index a028c88..0cbab96 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -3,18 +3,22 @@ There are two parts of the desktop app that you might want to debug. ## The renderer process + This is the regular element-web codeand can be debugged by just selecting 'toggle developer tools' from the menu, even on ppackaged builds. This then works the same as chrome dev tools for element web. ## The main process + This is debugged as a node app, so: - 1. Open any chrome dev tools window - 1. Start element with the `--inspect-brk` flag - 1. Notice that you now have a little green icon in the top left of your chrome devtools window, click it. + +1. Open any chrome dev tools window +1. Start element with the `--inspect-brk` flag +1. Notice that you now have a little green icon in the top left of your chrome devtools window, click it. You are now debugging the code of the desktop app itself. ## The main process of a package app + When the app is shipped, electron's "fuses" are flipped, editing the electron binary itself to prevent certain features from being usable, one of which is debugging using `--inspect-brk` as above. You can flip the fuse back on Linux as follows: ```